mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-09 00:04:59 +00:00
Use Person::centerHistory
to load fixtures with given center
This commit is contained in:
@@ -43,16 +43,16 @@ final class HouseholdControllerTest extends WebTestCase
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$ids = $em->createQuery(
|
||||
'SELECT DISTINCT h.id FROM ' . Household::class . ' h ' .
|
||||
'JOIN h.members m ' .
|
||||
'JOIN m.person p ' .
|
||||
'JOIN p.center c ' .
|
||||
'WHERE c.name = :center'
|
||||
sprintf("SELECT DISTINCT h.id FROM %s h JOIN h.members m JOIN m.person p JOIN p.centerHistory ch JOIN ch.center c WHERE c.name = :center AND ch.endDate IS NULL", Household::class)
|
||||
)
|
||||
->setParameter('center', 'Center A')
|
||||
->setMaxResults(100)
|
||||
->getScalarResult();
|
||||
|
||||
if ([] === $ids) {
|
||||
throw new \RuntimeException('no household ids with center "Center A"');
|
||||
}
|
||||
|
||||
shuffle($ids);
|
||||
|
||||
yield [array_pop($ids)['id']];
|
||||
|
Reference in New Issue
Block a user