More useful error message when not enough people in database fixture

This commit is contained in:
Julien Fastré 2023-07-28 00:51:44 +02:00
parent ae04172929
commit abc067adae
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -139,16 +139,18 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
throw new \RuntimeException("no user found");
}
/** @var Person $person */
[$person, $anotherPerson, $person2, $person3] = $this->entityManager
$persons = $this->entityManager
->createQuery("SELECT p FROM " . Person::class . " p JOIN p.centerCurrent current_center")
->setMaxResults(4)
->getResult();
if (null === $person || null === $anotherPerson || null === $person2 || null === $person3) {
if (4 > count($persons)) {
throw new \RuntimeException("no person found");
}
/** @var Person $person */
[$person, $anotherPerson, $person2, $person3] = $persons;
$scopes = $this->scopeRepository->findAll();
if (3 > count($scopes)) {
@ -311,15 +313,17 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
}
/** @var Person $person */
[$person, $anotherPerson, $person2, $person3] = $this->entityManager
$persons = $this->entityManager
->createQuery("SELECT p FROM " . Person::class . " p ")
->setMaxResults(4)
->getResult();
if (null === $person || null === $anotherPerson || null === $person2 || null === $person3) {
if (4 > count($persons)) {
throw new \RuntimeException("no person found");
}
[$person, $anotherPerson, $person2, $person3] = $persons;
$scopes = $this->scopeRepository->findAll();
if (3 > count($scopes)) {
@ -439,15 +443,17 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
throw new \RuntimeException("no user found");
}
[$person, $anotherPerson, $person2, $person3] = $this->entityManager
$persons = $this->entityManager
->createQuery("SELECT p FROM " . Person::class . " p WHERE SIZE(p.accompanyingPeriodParticipations) = 0")
->setMaxResults(4)
->getResult();
if (null === $person || null === $anotherPerson || null === $person2 || null === $person3) {
if (4 > count($persons)) {
throw new \RuntimeException("no person found");
}
[$person, $anotherPerson, $person2, $person3] = $persons;
$scopes = $this->scopeRepository->findAll();
if (3 > count($scopes)) {