mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,16 +1,26 @@
|
||||
<?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\PersonBundle\Tests\Serializer\Normalizer;
|
||||
|
||||
use Chill\PersonBundle\Entity\Household\Position;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Chill\PersonBundle\Entity\Household\Position;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use DateTimeImmutable;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class HouseholdNormalizerTest extends KernelTestCase
|
||||
{
|
||||
private ?NormalizerInterface $normalizer;
|
||||
@@ -18,7 +28,7 @@ class HouseholdNormalizerTest extends KernelTestCase
|
||||
protected function setUp()
|
||||
{
|
||||
self::bootKernel();
|
||||
$this->normalizer= self::$container->get(NormalizerInterface::class);
|
||||
$this->normalizer = self::$container->get(NormalizerInterface::class);
|
||||
}
|
||||
|
||||
public function testNormalizationRecursive()
|
||||
@@ -28,21 +38,22 @@ class HouseholdNormalizerTest extends KernelTestCase
|
||||
$household = new Household();
|
||||
$position = (new Position())
|
||||
->setShareHousehold(true)
|
||||
->setAllowHolder(true)
|
||||
;
|
||||
->setAllowHolder(true);
|
||||
|
||||
$member->setPerson($person)
|
||||
->setStartDate(new \DateTimeImmutable('1 year ago'))
|
||||
->setEndDate(new \DateTimeImmutable('1 month ago'));
|
||||
->setStartDate(new DateTimeImmutable('1 year ago'))
|
||||
->setEndDate(new DateTimeImmutable('1 month ago'));
|
||||
|
||||
$household->addMember($member);
|
||||
|
||||
$normalized = $this->normalizer->normalize($household,
|
||||
'json', [ 'groups' => [ 'read' ]]);
|
||||
$normalized = $this->normalizer->normalize(
|
||||
$household,
|
||||
'json',
|
||||
['groups' => ['read']]
|
||||
);
|
||||
|
||||
$this->assertIsArray($normalized);
|
||||
$this->assertArrayHasKey('type', $normalized);
|
||||
$this->assertEquals('household', $normalized['type']);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user