From ad1e5ecc95ed2b9730d32355a23c6f3e7f7453b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 25 Aug 2023 22:23:18 +0200 Subject: [PATCH] Fix data provider for person, using the association with person center current --- .../Controller/PersonApiControllerTest.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonApiControllerTest.php index cb91d2ccf..b2f3215b4 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonApiControllerTest.php @@ -33,9 +33,10 @@ final class PersonApiControllerTest extends WebTestCase { self::bootKernel(); $em = self::$container->get(EntityManagerInterface::class); - $personIds = $em->createQuery('SELECT p.id FROM ' . Person::class . ' p ' . - 'JOIN p.center c ' . - 'WHERE c.name = :center') + $personIds = $em->createQuery(sprintf( + "SELECT p.id FROM %s p JOIN p.centerCurrent pc JOIN pc.center c WHERE c.name = :center", + Person::class + )) ->setParameter('center', 'Center A') ->setMaxResults(100) ->getScalarResult(); @@ -55,9 +56,9 @@ final class PersonApiControllerTest extends WebTestCase { self::bootKernel(); $em = self::$container->get(EntityManagerInterface::class); - $personIds = $em->createQuery('SELECT p.id FROM ' . Person::class . ' p ' . - 'JOIN p.center c ' . - 'WHERE c.name = :center') + $personIds = $em->createQuery( + sprintf("SELECT p.id FROM %s p JOIN p.centerCurrent pc JOIN pc.center c WHERE c.name = :center", Person::class) + ) ->setParameter('center', 'Center B') ->setMaxResults(100) ->getScalarResult(); @@ -72,7 +73,7 @@ final class PersonApiControllerTest extends WebTestCase /** * @dataProvider dataGetPersonFromCenterA */ - public function testPersonAddressSuggestion(mixed $personId): void + public function testPersonAddressSuggestion(int $personId): void { $client = $this->getClientAuthenticated(); @@ -97,7 +98,7 @@ final class PersonApiControllerTest extends WebTestCase /** * @dataProvider dataGetPersonFromCenterA */ - public function testPersonGet(mixed $personId): void + public function testPersonGet(int $personId): void { $client = $this->getClientAuthenticated();