mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-17 03:17:44 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -15,22 +15,16 @@ use Chill\MainBundle\Entity\Address;
|
||||
use Chill\MainBundle\Entity\AddressReference;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use RuntimeException;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use function array_map;
|
||||
use function array_pop;
|
||||
use function random_int;
|
||||
use function shuffle;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class HouseholdApiControllerTest extends WebTestCase
|
||||
@@ -64,11 +58,11 @@ final class HouseholdApiControllerTest extends WebTestCase
|
||||
->getQuery()->getSingleScalarResult();
|
||||
|
||||
if (0 === $nbReference) {
|
||||
throw new RuntimeException('any reference found. Add a reference in database to perform this test');
|
||||
throw new \RuntimeException('any reference found. Add a reference in database to perform this test');
|
||||
}
|
||||
|
||||
$reference = $em->createQueryBuilder()->select('ar')->from(AddressReference::class, 'ar')
|
||||
->setFirstResult(random_int(0, $nbReference - 1))
|
||||
->setFirstResult(\random_int(0, $nbReference - 1))
|
||||
->setMaxResults(1)
|
||||
->getQuery()->getSingleResult();
|
||||
|
||||
@@ -79,14 +73,14 @@ final class HouseholdApiControllerTest extends WebTestCase
|
||||
$em->persist($p);
|
||||
$h = new Household();
|
||||
$h->addMember($m = (new HouseholdMember())->setPerson($p));
|
||||
$h->addAddress($a = Address::createFromAddressReference($reference)->setValidFrom(new DateTime('today')));
|
||||
$h->addAddress($a = Address::createFromAddressReference($reference)->setValidFrom(new \DateTime('today')));
|
||||
$em->persist($a);
|
||||
$em->persist($m);
|
||||
$em->persist($h);
|
||||
|
||||
$em->flush();
|
||||
|
||||
$this->toDelete = $this->toDelete + [
|
||||
$this->toDelete += [
|
||||
[HouseholdMember::class, $m->getId()],
|
||||
[User::class, $p->getId()],
|
||||
[Household::class, $h->getId()],
|
||||
@@ -119,13 +113,13 @@ final class HouseholdApiControllerTest extends WebTestCase
|
||||
->getQuery()
|
||||
->getResult();
|
||||
|
||||
shuffle($householdIds);
|
||||
\shuffle($householdIds);
|
||||
|
||||
yield [array_pop($householdIds)['id']];
|
||||
yield [\array_pop($householdIds)['id']];
|
||||
|
||||
yield [array_pop($householdIds)['id']];
|
||||
yield [\array_pop($householdIds)['id']];
|
||||
|
||||
yield [array_pop($householdIds)['id']];
|
||||
yield [\array_pop($householdIds)['id']];
|
||||
|
||||
self::ensureKernelShutdown();
|
||||
}
|
||||
@@ -138,7 +132,7 @@ final class HouseholdApiControllerTest extends WebTestCase
|
||||
->createQueryBuilder();
|
||||
|
||||
$personIds = $qb
|
||||
->select("p.id AS pid")
|
||||
->select('p.id AS pid')
|
||||
->from(Person::class, 'p')
|
||||
->where(
|
||||
$qb->expr()->gte('SIZE(p.accompanyingPeriodParticipations)', 2)
|
||||
@@ -169,7 +163,7 @@ final class HouseholdApiControllerTest extends WebTestCase
|
||||
$this->assertArrayHasKey('count', $data);
|
||||
$this->assertArrayHasKey('results', $data);
|
||||
|
||||
$householdIds = array_map(static fn ($r) => $r['id'], $data['results']);
|
||||
$householdIds = \array_map(static fn ($r) => $r['id'], $data['results']);
|
||||
|
||||
$this->assertContains($expectedHouseholdId, $householdIds);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user