mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
try to fix test with null id
This commit is contained in:
parent
ff5aeaae17
commit
fced8ef4b7
@ -16,6 +16,8 @@ use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
|||||||
use Chill\PersonBundle\Entity\Household\Position;
|
use Chill\PersonBundle\Entity\Household\Position;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||||
|
|
||||||
@ -27,15 +29,22 @@ final class HouseholdNormalizerTest extends KernelTestCase
|
|||||||
{
|
{
|
||||||
private ?NormalizerInterface $normalizer;
|
private ?NormalizerInterface $normalizer;
|
||||||
|
|
||||||
|
private EntityManagerInterface $entityManager;
|
||||||
|
|
||||||
|
private array $toDelete;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
$this->normalizer = self::$container->get(NormalizerInterface::class);
|
$this->normalizer = self::$container->get(NormalizerInterface::class);
|
||||||
|
$this->entityManager = self::$container->get(EntityManagerInterface::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNormalizationRecursive()
|
public function testNormalizationRecursive()
|
||||||
{
|
{
|
||||||
$person = new Person();
|
$person = new Person();
|
||||||
|
$person->setFirstName('ok')->setLastName('ok');
|
||||||
|
$this->entityManager->persist($person);
|
||||||
$member = new HouseholdMember();
|
$member = new HouseholdMember();
|
||||||
$household = new Household();
|
$household = new Household();
|
||||||
$position = (new Position())
|
$position = (new Position())
|
||||||
@ -44,7 +53,9 @@ final class HouseholdNormalizerTest extends KernelTestCase
|
|||||||
|
|
||||||
$member->setPerson($person)
|
$member->setPerson($person)
|
||||||
->setStartDate(new DateTimeImmutable('1 year ago'))
|
->setStartDate(new DateTimeImmutable('1 year ago'))
|
||||||
->setEndDate(new DateTimeImmutable('1 month ago'));
|
->setEndDate(new DateTimeImmutable('1 month ago'))
|
||||||
|
->setPosition($position)
|
||||||
|
;
|
||||||
|
|
||||||
$household->addMember($member);
|
$household->addMember($member);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user