diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php new file mode 100644 index 000000000..f6adc5d01 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdApiControllerTest.php @@ -0,0 +1,55 @@ +getClientAuthenticated(); + + $client->request( + Request::METHOD_GET, + "/api/1.0/person/household/suggest/by-person/{$personId}/through-accompanying-period-participation.json" + ); + + $this->assertResponseIsSuccessful(); + } + + public function generatePersonId() + { + self::bootKernel(); + + $qb = self::$container->get(EntityManagerInterface::class) + ->createQueryBuilder(); + + $period = $qb + ->select('ap') + ->from(AccompanyingPeriod::class, 'ap') + ->where( + $qb->expr()->gte('SIZE(ap.participations)', 2) + ) + ->getQuery() + ->setMaxResults(1) + ->getSingleResult() + ; + + $person = $period->getParticipations() + ->first()->getPerson(); + + yield [ $person->getId() ]; + } +}