mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-27 18:13:48 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,14 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Tests\Serializer\Normalizer;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Serializer\Normalizer\DoctrineExistingEntityNormalizer;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class DoctrineExistingEntityNormalizerTest extends KernelTestCase
|
||||
{
|
||||
protected DoctrineExistingEntityNormalizer $normalizer;
|
||||
@@ -16,23 +26,12 @@ class DoctrineExistingEntityNormalizerTest extends KernelTestCase
|
||||
protected function setUp()
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
$serializerFactory = self::$container->get(ClassMetadataFactoryInterface::class);
|
||||
|
||||
$this->normalizer = new DoctrineExistingEntityNormalizer($em, $serializerFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataProviderUserId
|
||||
*/
|
||||
public function testGetMappedClass($userId)
|
||||
{
|
||||
$data = [ 'type' => 'user', 'id' => $userId];
|
||||
$supports = $this->normalizer->supportsDenormalization($data, User::class);
|
||||
|
||||
$this->assertTrue($supports);
|
||||
}
|
||||
|
||||
public function dataProviderUserId()
|
||||
{
|
||||
self::bootKernel();
|
||||
@@ -43,9 +42,21 @@ class DoctrineExistingEntityNormalizerTest extends KernelTestCase
|
||||
->select('u.id')
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
->getResult();
|
||||
|
||||
yield [ $userIds[0]['id'] ];
|
||||
yield [$userIds[0]['id']];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataProviderUserId
|
||||
*
|
||||
* @param mixed $userId
|
||||
*/
|
||||
public function testGetMappedClass($userId)
|
||||
{
|
||||
$data = ['type' => 'user', 'id' => $userId];
|
||||
$supports = $this->normalizer->supportsDenormalization($data, User::class);
|
||||
|
||||
$this->assertTrue($supports);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user