From fced8ef4b70c076b7083ff359bbaab56f2caf32e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 21 Mar 2022 11:34:54 +0100 Subject: [PATCH] try to fix test with null id --- .../Normalizer/HouseholdNormalizerTest.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/HouseholdNormalizerTest.php b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/HouseholdNormalizerTest.php index ac015155b..102108f90 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/HouseholdNormalizerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/HouseholdNormalizerTest.php @@ -16,6 +16,8 @@ use Chill\PersonBundle\Entity\Household\HouseholdMember; use Chill\PersonBundle\Entity\Household\Position; use Chill\PersonBundle\Entity\Person; use DateTimeImmutable; +use Doctrine\ORM\EntityManagerInterface; +use Prophecy\PhpUnit\ProphecyTrait; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; @@ -27,15 +29,22 @@ final class HouseholdNormalizerTest extends KernelTestCase { private ?NormalizerInterface $normalizer; + private EntityManagerInterface $entityManager; + + private array $toDelete; + protected function setUp(): void { self::bootKernel(); $this->normalizer = self::$container->get(NormalizerInterface::class); + $this->entityManager = self::$container->get(EntityManagerInterface::class); } public function testNormalizationRecursive() { $person = new Person(); + $person->setFirstName('ok')->setLastName('ok'); + $this->entityManager->persist($person); $member = new HouseholdMember(); $household = new Household(); $position = (new Position()) @@ -44,7 +53,9 @@ final class HouseholdNormalizerTest extends KernelTestCase $member->setPerson($person) ->setStartDate(new DateTimeImmutable('1 year ago')) - ->setEndDate(new DateTimeImmutable('1 month ago')); + ->setEndDate(new DateTimeImmutable('1 month ago')) + ->setPosition($position) + ; $household->addMember($member);