mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-05 14:25:00 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -19,6 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AccompanyingPeriodConfidentialTest extends WebTestCase
|
||||
@@ -45,7 +46,7 @@ final class AccompanyingPeriodConfidentialTest extends WebTestCase
|
||||
*/
|
||||
public function testConfidentialInvalid()
|
||||
{
|
||||
$this->markTestSkipped("test not written fully");
|
||||
$this->markTestSkipped('test not written fully');
|
||||
|
||||
// Disabling this dataprovider to avoid having errors while running the test.
|
||||
return yield from [];
|
||||
|
@@ -22,18 +22,15 @@ use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Event\Person\PersonAddressMoveEvent;
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
use Prophecy\Argument;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use ReflectionClass;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Templating\EngineInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class PersonMoveEventSubscriberTest extends KernelTestCase
|
||||
@@ -51,23 +48,23 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
|
||||
$this->forceIdToPeriod($period);
|
||||
|
||||
$previousHousehold = (new Household())->addAddress(
|
||||
(new Address())->setValidFrom(new DateTime('1 year ago'))
|
||||
(new Address())->setValidFrom(new \DateTime('1 year ago'))
|
||||
);
|
||||
$previousMembership = new HouseholdMember();
|
||||
$previousMembership
|
||||
->setPerson($person)
|
||||
->setHousehold($previousHousehold)
|
||||
->setStartDate(new DateTimeImmutable('1 year ago'))
|
||||
->setEndDate(new DateTimeImmutable('tomorrow'));
|
||||
->setStartDate(new \DateTimeImmutable('1 year ago'))
|
||||
->setEndDate(new \DateTimeImmutable('tomorrow'));
|
||||
|
||||
$nextHousehold = (new Household())->addAddress(
|
||||
(new Address())->setValidFrom(new DateTime('tomorrow'))
|
||||
(new Address())->setValidFrom(new \DateTime('tomorrow'))
|
||||
);
|
||||
$nextMembership = new HouseholdMember();
|
||||
$nextMembership
|
||||
->setPerson($person)
|
||||
->setHousehold($nextHousehold)
|
||||
->setStartDate(new DateTimeImmutable('tomorrow'));
|
||||
->setStartDate(new \DateTimeImmutable('tomorrow'));
|
||||
|
||||
$event = new PersonAddressMoveEvent($person);
|
||||
$event
|
||||
@@ -93,23 +90,23 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
|
||||
$this->forceIdToPeriod($period);
|
||||
|
||||
$previousHousehold = (new Household())->addAddress(
|
||||
($previousAddress = new Address())->setValidFrom(new DateTime('1 year ago'))
|
||||
($previousAddress = new Address())->setValidFrom(new \DateTime('1 year ago'))
|
||||
);
|
||||
$previousMembership = new HouseholdMember();
|
||||
$previousMembership
|
||||
->setPerson($person)
|
||||
->setHousehold($previousHousehold)
|
||||
->setStartDate(new DateTimeImmutable('1 year ago'))
|
||||
->setEndDate(new DateTimeImmutable('tomorrow'));
|
||||
->setStartDate(new \DateTimeImmutable('1 year ago'))
|
||||
->setEndDate(new \DateTimeImmutable('tomorrow'));
|
||||
|
||||
$nextHousehold = (new Household())->addAddress(
|
||||
(new Address())->setValidFrom(new DateTime('tomorrow'))
|
||||
(new Address())->setValidFrom(new \DateTime('tomorrow'))
|
||||
);
|
||||
$nextMembership = new HouseholdMember();
|
||||
$nextMembership
|
||||
->setPerson($person)
|
||||
->setHousehold($nextHousehold)
|
||||
->setStartDate(new DateTimeImmutable('tomorrow'));
|
||||
->setStartDate(new \DateTimeImmutable('tomorrow'));
|
||||
|
||||
$event = new PersonAddressMoveEvent($person);
|
||||
$event
|
||||
@@ -138,23 +135,23 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
|
||||
$this->forceIdToPeriod($period);
|
||||
|
||||
$previousHousehold = (new Household())->addAddress(
|
||||
($previousAddress = new Address())->setValidFrom(new DateTime('1 year ago'))
|
||||
($previousAddress = new Address())->setValidFrom(new \DateTime('1 year ago'))
|
||||
);
|
||||
$previousMembership = new HouseholdMember();
|
||||
$previousMembership
|
||||
->setPerson($person)
|
||||
->setHousehold($previousHousehold)
|
||||
->setStartDate(new DateTimeImmutable('1 year ago'))
|
||||
->setEndDate(new DateTimeImmutable('tomorrow'));
|
||||
->setStartDate(new \DateTimeImmutable('1 year ago'))
|
||||
->setEndDate(new \DateTimeImmutable('tomorrow'));
|
||||
|
||||
$nextHousehold = (new Household())->addAddress(
|
||||
(new Address())->setValidFrom(new DateTime('1 month ago'))
|
||||
(new Address())->setValidFrom(new \DateTime('1 month ago'))
|
||||
);
|
||||
$nextMembership = new HouseholdMember();
|
||||
$nextMembership
|
||||
->setPerson($person)
|
||||
->setHousehold($nextHousehold)
|
||||
->setStartDate(new DateTimeImmutable('1 month ago'));
|
||||
->setStartDate(new \DateTimeImmutable('1 month ago'));
|
||||
|
||||
$event = new PersonAddressMoveEvent($person);
|
||||
$event
|
||||
@@ -183,14 +180,14 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
|
||||
$this->forceIdToPeriod($period);
|
||||
|
||||
$previousHousehold = (new Household())->addAddress(
|
||||
($previousAddress = new Address())->setValidFrom(new DateTime('1 year ago'))
|
||||
($previousAddress = new Address())->setValidFrom(new \DateTime('1 year ago'))
|
||||
);
|
||||
$previousMembership = new HouseholdMember();
|
||||
$previousMembership
|
||||
->setPerson($person)
|
||||
->setHousehold($previousHousehold)
|
||||
->setStartDate(new DateTimeImmutable('1 year ago'))
|
||||
->setEndDate(new DateTimeImmutable('tomorrow'));
|
||||
->setStartDate(new \DateTimeImmutable('1 year ago'))
|
||||
->setEndDate(new \DateTimeImmutable('tomorrow'));
|
||||
|
||||
$event = new PersonAddressMoveEvent($person);
|
||||
$event
|
||||
@@ -221,14 +218,14 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
|
||||
$membership
|
||||
->setPerson($person)
|
||||
->setHousehold($household = new Household())
|
||||
->setStartDate(new DateTimeImmutable('1 year ago'));
|
||||
->setStartDate(new \DateTimeImmutable('1 year ago'));
|
||||
|
||||
$previousAddress = new Address();
|
||||
$previousAddress->setValidFrom(new DateTime('6 months ago'));
|
||||
$previousAddress->setValidFrom(new \DateTime('6 months ago'));
|
||||
$household->addAddress($previousAddress);
|
||||
|
||||
$newAddress = new Address();
|
||||
$newAddress->setValidFrom(new DateTime('tomorrow'));
|
||||
$newAddress->setValidFrom(new \DateTime('tomorrow'));
|
||||
$household->addAddress($newAddress);
|
||||
|
||||
$event = new PersonAddressMoveEvent($person);
|
||||
@@ -247,10 +244,10 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
|
||||
}
|
||||
|
||||
private function buildSubscriber(
|
||||
?\Twig\Environment $engine = null,
|
||||
?NotificationPersisterInterface $notificationPersister = null,
|
||||
?Security $security = null,
|
||||
?TranslatorInterface $translator = null
|
||||
\Twig\Environment $engine = null,
|
||||
NotificationPersisterInterface $notificationPersister = null,
|
||||
Security $security = null,
|
||||
TranslatorInterface $translator = null
|
||||
): PersonAddressMoveEventSubscriber {
|
||||
if (null === $translator) {
|
||||
$double = $this->prophesize(TranslatorInterface::class);
|
||||
@@ -283,7 +280,7 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
|
||||
|
||||
private function forceIdToPeriod(AccompanyingPeriod $period): void
|
||||
{
|
||||
$reflectionClass = new ReflectionClass($period);
|
||||
$reflectionClass = new \ReflectionClass($period);
|
||||
$property = $reflectionClass->getProperty('id');
|
||||
$property->setAccessible(true);
|
||||
$property->setValue($period, 0);
|
||||
|
@@ -20,6 +20,7 @@ use Symfony\Component\Clock\MockClock;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
class AccompanyingPeriodStepChangeCronjobTest extends TestCase
|
||||
|
@@ -18,7 +18,6 @@ use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Event\LifecycleEventArgs;
|
||||
use Doctrine\ORM\Event\PrePersistEventArgs;
|
||||
use Doctrine\ORM\Event\PreUpdateEventArgs;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@@ -26,6 +25,7 @@ use Prophecy\PhpUnit\ProphecyTrait;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AccompanyingPeriodSocialIssueConsistencyEntityListenerTest extends TestCase
|
||||
|
@@ -18,14 +18,12 @@ use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
||||
use Chill\PersonBundle\Actions\Remove\PersonMove;
|
||||
use Chill\PersonBundle\Actions\Remove\PersonMoveManager;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\Relationships\Relation;
|
||||
use Chill\PersonBundle\Entity\Relationships\Relationship;
|
||||
use Chill\PersonBundle\Repository\Person\PersonCenterHistoryInterface;
|
||||
use Chill\PersonBundle\Repository\PersonRepository;
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
@@ -33,6 +31,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
class PersonMoveTest extends KernelTestCase
|
||||
@@ -85,13 +84,13 @@ class PersonMoveTest extends KernelTestCase
|
||||
{
|
||||
$move = new PersonMove($this->em, $this->personMoveManager, $this->eventDispatcher);
|
||||
$sqls = $move->getSQL($personA, $personB);
|
||||
$this->em->getConnection()->transactional(function (Connection $conn) use ($personA, $personB, $sqls) {
|
||||
$this->em->getConnection()->transactional(function (Connection $conn) use ($sqls) {
|
||||
foreach ($sqls as $sql) {
|
||||
$conn->executeStatement($sql);
|
||||
}
|
||||
});
|
||||
|
||||
$personsByIdOfA = $this->em->createQuery("SELECT p FROM " . Person::class . " p WHERE p.id = :id")
|
||||
$personsByIdOfA = $this->em->createQuery('SELECT p FROM '.Person::class.' p WHERE p.id = :id')
|
||||
->setParameter('id', $personA->getId())
|
||||
->getResult();
|
||||
$personB = $this->em->find(Person::class, $personB->getId());
|
||||
@@ -137,13 +136,13 @@ class PersonMoveTest extends KernelTestCase
|
||||
|
||||
$move = new PersonMove($this->em, $this->personMoveManager, $this->eventDispatcher);
|
||||
$sqls = $move->getSQL($personA, $personB);
|
||||
$this->em->getConnection()->transactional(function (Connection $conn) use ($personA, $personB, $sqls) {
|
||||
$this->em->getConnection()->transactional(function (Connection $conn) use ($sqls) {
|
||||
foreach ($sqls as $sql) {
|
||||
$conn->executeStatement($sql);
|
||||
}
|
||||
});
|
||||
|
||||
$personsByIdOfA = $this->em->createQuery("SELECT p FROM " . Person::class . " p WHERE p.id = :id")
|
||||
$personsByIdOfA = $this->em->createQuery('SELECT p FROM '.Person::class.' p WHERE p.id = :id')
|
||||
->setParameter('id', $personA->getId())
|
||||
->getResult();
|
||||
/** @var Person $personB */
|
||||
@@ -188,7 +187,7 @@ class PersonMoveTest extends KernelTestCase
|
||||
self::$entitiesToDelete[] = [Person::class, $personA];
|
||||
self::$entitiesToDelete[] = [Person::class, $personB];
|
||||
|
||||
yield [$personA, $personB, "move 2 people without any associated data"];
|
||||
yield [$personA, $personB, 'move 2 people without any associated data'];
|
||||
|
||||
$personA = new Person();
|
||||
$personB = new Person();
|
||||
@@ -206,7 +205,7 @@ class PersonMoveTest extends KernelTestCase
|
||||
self::$entitiesToDelete[] = [Person::class, $personB];
|
||||
self::$entitiesToDelete[] = [Activity::class, $activity];
|
||||
|
||||
yield [$personA, $personB, "move 2 people having an activity"];
|
||||
yield [$personA, $personB, 'move 2 people having an activity'];
|
||||
|
||||
$personA = new Person();
|
||||
$personB = new Person();
|
||||
@@ -232,7 +231,7 @@ class PersonMoveTest extends KernelTestCase
|
||||
self::$entitiesToDelete[] = [Person::class, $personA];
|
||||
self::$entitiesToDelete[] = [Person::class, $personB];
|
||||
|
||||
yield [$personA, $personB, "move 2 people having the same household at the same time"];
|
||||
yield [$personA, $personB, 'move 2 people having the same household at the same time'];
|
||||
|
||||
$personA = new Person();
|
||||
$personB = new Person();
|
||||
@@ -249,13 +248,13 @@ class PersonMoveTest extends KernelTestCase
|
||||
self::$entitiesToDelete[] = [Person::class, $personB];
|
||||
self::$entitiesToDelete[] = [AccompanyingPeriod::class, $parcours];
|
||||
|
||||
yield [$personA, $personB, "move 2 people participating to the same parcours"];
|
||||
yield [$personA, $personB, 'move 2 people participating to the same parcours'];
|
||||
|
||||
$personA = new Person();
|
||||
$personB = new Person();
|
||||
$relationship = new Relationship();
|
||||
$relation = new Relation();
|
||||
$user = (new User())->setUsername(uniqid())->setEmail(uniqid() . '@foo.com');
|
||||
$user = (new User())->setUsername(uniqid())->setEmail(uniqid().'@foo.com');
|
||||
|
||||
$relationship->setRelation($relation);
|
||||
$relationship->setToPerson($personA);
|
||||
@@ -275,7 +274,7 @@ class PersonMoveTest extends KernelTestCase
|
||||
self::$entitiesToDelete[] = [User::class, $user];
|
||||
self::$entitiesToDelete[] = [Relationship::class, $relationship];
|
||||
|
||||
yield [$personA, $personB, "move 2 people with a relationship"];
|
||||
yield [$personA, $personB, 'move 2 people with a relationship'];
|
||||
|
||||
$this->em->flush();
|
||||
$this->em->clear();
|
||||
|
@@ -20,24 +20,15 @@ use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriodRepository;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Iterator;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use function array_map;
|
||||
use function array_pop;
|
||||
use function array_rand;
|
||||
use function count;
|
||||
use function in_array;
|
||||
use function json_decode;
|
||||
use function json_encode;
|
||||
|
||||
/**
|
||||
* Test api for AccompanyingCourseControllerTest.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
@@ -62,17 +53,17 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$period = new AccompanyingPeriod(new DateTime('1 week ago'));
|
||||
$period = new AccompanyingPeriod(new \DateTime('1 week ago'));
|
||||
$user = $em->getRepository(User::class)
|
||||
->findOneByUsernameCanonical('center a_social');
|
||||
$period->setCreatedBy($user);
|
||||
//$period->setCreatedAt(new \DateTime('yesterday'));
|
||||
// $period->setCreatedAt(new \DateTime('yesterday'));
|
||||
|
||||
$center = $em->getRepository(Center::class)
|
||||
->findOneBy(['name' => 'Center A']);
|
||||
|
||||
$personIds = $em->createQuery('SELECT p.id FROM ' .
|
||||
Person::class . ' p JOIN p.centerCurrent cc' .
|
||||
$personIds = $em->createQuery('SELECT p.id FROM '.
|
||||
Person::class.' p JOIN p.centerCurrent cc'.
|
||||
' WHERE cc.center = :center')
|
||||
->setParameter('center', $center)
|
||||
->setMaxResults(100)
|
||||
@@ -82,7 +73,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
shuffle($personIds);
|
||||
|
||||
for ($i = 0; 2 > $i; ++$i) {
|
||||
$person = $em->getRepository(Person::class)->find(array_pop($personIds));
|
||||
$person = $em->getRepository(Person::class)->find(\array_pop($personIds));
|
||||
$period->addPerson($person);
|
||||
}
|
||||
|
||||
@@ -147,13 +138,13 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
$nbGenerated = 0;
|
||||
|
||||
while ($nbGenerated < $maxGenerated) {
|
||||
$id = array_pop($personIds)['id'];
|
||||
$id = \array_pop($personIds)['id'];
|
||||
|
||||
$person = $em->getRepository(Person::class)
|
||||
->find($id);
|
||||
$periods = $person->getAccompanyingPeriods();
|
||||
|
||||
yield [array_pop($personIds)['id'], $periods[array_rand($periods)]->getId()];
|
||||
yield [\array_pop($personIds)['id'], $periods[\array_rand($periods)]->getId()];
|
||||
|
||||
++$nbGenerated;
|
||||
}
|
||||
@@ -211,21 +202,21 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
// create a random order
|
||||
shuffle($personIds);
|
||||
|
||||
$socialIssues = $em->createQuery('SELECT s FROM ' .
|
||||
SocialIssue::class . ' s ')
|
||||
$socialIssues = $em->createQuery('SELECT s FROM '.
|
||||
SocialIssue::class.' s ')
|
||||
->setMaxResults(10)
|
||||
->getResult();
|
||||
|
||||
$nbGenerated = 0;
|
||||
|
||||
while ($nbGenerated < $maxGenerated) {
|
||||
$id = array_pop($personIds)['id'];
|
||||
$id = \array_pop($personIds)['id'];
|
||||
|
||||
$person = $em->getRepository(Person::class)
|
||||
->find($id);
|
||||
$periods = $person->getAccompanyingPeriods();
|
||||
|
||||
yield [$periods[array_rand($periods)], $socialIssues[array_rand($socialIssues)]];
|
||||
yield [$periods[\array_rand($periods)], $socialIssues[\array_rand($socialIssues)]];
|
||||
|
||||
++$nbGenerated;
|
||||
}
|
||||
@@ -233,7 +224,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
self::ensureKernelShutdown();
|
||||
}
|
||||
|
||||
public function dataGenerateRandomRequestorValidData(): Iterator
|
||||
public function dataGenerateRandomRequestorValidData(): \Iterator
|
||||
{
|
||||
$dataLength = 2;
|
||||
$maxResults = 100;
|
||||
@@ -275,8 +266,8 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
// create a random order
|
||||
shuffle($personIds);
|
||||
|
||||
$thirdPartyIds = $em->createQuery('SELECT t.id FROM ' .
|
||||
ThirdParty::class . ' t ')
|
||||
$thirdPartyIds = $em->createQuery('SELECT t.id FROM '.
|
||||
ThirdParty::class.' t ')
|
||||
->setMaxResults($maxResults)
|
||||
->getScalarResult();
|
||||
|
||||
@@ -287,15 +278,15 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
|
||||
while ($i <= $dataLength) {
|
||||
$person = $em->getRepository(Person::class)
|
||||
->find(array_pop($personIds)['id']);
|
||||
->find(\array_pop($personIds)['id']);
|
||||
|
||||
if (count($person->getAccompanyingPeriods()) === 0) {
|
||||
if (0 === \count($person->getAccompanyingPeriods())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$period = $person->getAccompanyingPeriods()[0];
|
||||
|
||||
yield [$period, array_pop($personIds)['id'], array_pop($thirdPartyIds)['id']];
|
||||
yield [$period, \array_pop($personIds)['id'], \array_pop($thirdPartyIds)['id']];
|
||||
++$i;
|
||||
}
|
||||
|
||||
@@ -314,14 +305,14 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
[], // parameters
|
||||
[], // files
|
||||
[], // server parameters
|
||||
json_encode(['type' => 'person', 'id' => $personId], JSON_THROW_ON_ERROR)
|
||||
\json_encode(['type' => 'person', 'id' => $personId], JSON_THROW_ON_ERROR)
|
||||
);
|
||||
$response = $this->client->getResponse();
|
||||
$data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$data = \json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($response->getStatusCode(), [200, 422], true));
|
||||
|
||||
if ($response->getStatusCode() === 422) {
|
||||
if (422 === $response->getStatusCode()) {
|
||||
$this->markTestSkipped('the next tests should appears only on valid accompanying period');
|
||||
}
|
||||
|
||||
@@ -332,17 +323,17 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
// check by deownloading the accompanying cours
|
||||
|
||||
$this->client->request(Request::METHOD_GET, sprintf('/api/1.0/person/accompanying-course/%d.json', $periodId));
|
||||
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($response->getStatusCode(), [200, 422], true));
|
||||
|
||||
if ($response->getStatusCode() === 422) {
|
||||
if (422 === $response->getStatusCode()) {
|
||||
$this->markTestSkipped('the next tests should appears only on valid accompanying period');
|
||||
}
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
$data = json_decode((string) $response->getContent(), null, 512, JSON_THROW_ON_ERROR);
|
||||
$data = \json_decode((string) $response->getContent(), null, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
// check that the person id is contained
|
||||
$participationsPersonsIds = array_map(
|
||||
$participationsPersonsIds = \array_map(
|
||||
static fn ($participation) => $participation->person->id,
|
||||
$data->participations
|
||||
);
|
||||
@@ -356,14 +347,14 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
[], // parameters
|
||||
[], // files
|
||||
[], // server parameters
|
||||
json_encode(['type' => 'person', 'id' => $personId], JSON_THROW_ON_ERROR)
|
||||
\json_encode(['type' => 'person', 'id' => $personId], JSON_THROW_ON_ERROR)
|
||||
);
|
||||
$response = $this->client->getResponse();
|
||||
$data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$data = \json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($response->getStatusCode(), [200, 422], true));
|
||||
|
||||
if ($response->getStatusCode() === 422) {
|
||||
if (422 === $response->getStatusCode()) {
|
||||
$this->markTestSkipped('the next tests should appears only on valid accompanying period');
|
||||
}
|
||||
|
||||
@@ -386,16 +377,16 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
json_encode(['type' => 'social_issue', 'id' => $si->getId()], JSON_THROW_ON_ERROR)
|
||||
\json_encode(['type' => 'social_issue', 'id' => $si->getId()], JSON_THROW_ON_ERROR)
|
||||
);
|
||||
|
||||
$this->assertTrue(in_array($this->client->getResponse()->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($this->client->getResponse()->getStatusCode(), [200, 422], true));
|
||||
|
||||
if ($this->client->getResponse()->getStatusCode() === 422) {
|
||||
if (422 === $this->client->getResponse()->getStatusCode()) {
|
||||
$this->markTestSkipped('the next tests should appears only on valid accompanying period');
|
||||
}
|
||||
|
||||
$data = json_decode((string) $this->client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$data = \json_decode((string) $this->client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$this->assertArrayHasKey('id', $data);
|
||||
$this->assertArrayHasKey('type', $data);
|
||||
$this->assertEquals('social_issue', $data['type']);
|
||||
@@ -406,10 +397,10 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
json_encode(['type' => 'social_issue', 'id' => $si->getId()], JSON_THROW_ON_ERROR)
|
||||
\json_encode(['type' => 'social_issue', 'id' => $si->getId()], JSON_THROW_ON_ERROR)
|
||||
);
|
||||
|
||||
$this->assertTrue(in_array($this->client->getResponse()->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($this->client->getResponse()->getStatusCode(), [200, 422], true));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -421,13 +412,13 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
$client->request(Request::METHOD_GET, sprintf('/api/1.0/person/accompanying-course/%d.json', $periodId));
|
||||
$response = $client->getResponse();
|
||||
|
||||
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($response->getStatusCode(), [200, 422], true));
|
||||
|
||||
if ($response->getStatusCode() === 422) {
|
||||
if (422 === $response->getStatusCode()) {
|
||||
$this->markTestSkipped('the next tests should appears only on valid accompanying period');
|
||||
}
|
||||
|
||||
$data = json_decode((string) $response->getContent(), null, 512, JSON_THROW_ON_ERROR);
|
||||
$data = \json_decode((string) $response->getContent(), null, 512, JSON_THROW_ON_ERROR);
|
||||
$this->assertEquals(
|
||||
$data->id,
|
||||
$periodId,
|
||||
@@ -453,13 +444,13 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
[], // parameters
|
||||
[], // files
|
||||
[], // server parameters
|
||||
json_encode(['type' => 'accompanying_period', 'emergency' => !$initialValueEmergency], JSON_THROW_ON_ERROR)
|
||||
\json_encode(['type' => 'accompanying_period', 'emergency' => !$initialValueEmergency], JSON_THROW_ON_ERROR)
|
||||
);
|
||||
$response = $this->client->getResponse();
|
||||
|
||||
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($response->getStatusCode(), [200, 422], true));
|
||||
|
||||
if ($response->getStatusCode() === 422) {
|
||||
if (422 === $response->getStatusCode()) {
|
||||
$this->markTestSkipped('the next tests should appears only on valid accompanying period');
|
||||
}
|
||||
|
||||
@@ -486,14 +477,14 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
[], // parameters
|
||||
[], // files
|
||||
[], // server parameters
|
||||
json_encode(['type' => 'accompanying_period_comment', 'content' => 'this is a text'])
|
||||
\json_encode(['type' => 'accompanying_period_comment', 'content' => 'this is a text'])
|
||||
);
|
||||
$response = $this->client->getResponse();
|
||||
$data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$data = \json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($response->getStatusCode(), [200, 422], true));
|
||||
|
||||
if ($response->getStatusCode() === 422) {
|
||||
if (422 === $response->getStatusCode()) {
|
||||
$this->markTestSkipped('the next tests should appears only on valid accompanying period');
|
||||
}
|
||||
|
||||
@@ -505,12 +496,12 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
[], // parameters
|
||||
[], // files
|
||||
[], // server parameters
|
||||
json_encode(['type' => 'accompanying_period_comment', 'id' => $data['id']], JSON_THROW_ON_ERROR)
|
||||
\json_encode(['type' => 'accompanying_period_comment', 'id' => $data['id']], JSON_THROW_ON_ERROR)
|
||||
);
|
||||
$response = $this->client->getResponse();
|
||||
$data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$data = \json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($response->getStatusCode(), [200, 422], true));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -524,9 +515,9 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
sprintf('/api/1.0/person/accompanying-course/%d/confirm.json', $period->getId())
|
||||
);
|
||||
|
||||
$this->assertTrue(in_array($this->client->getResponse()->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($this->client->getResponse()->getStatusCode(), [200, 422], true));
|
||||
|
||||
if ($this->client->getResponse()->getStatusCode() === 422) {
|
||||
if (422 === $this->client->getResponse()->getStatusCode()) {
|
||||
$this->markTestSkipped('the next tests should appears only on valid accompanying period');
|
||||
}
|
||||
|
||||
@@ -545,7 +536,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
sprintf('/api/1.0/person/accompanying-course/%d/referrers-suggested.json', $periodId)
|
||||
);
|
||||
|
||||
$this->assertTrue(in_array($client->getResponse()->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($client->getResponse()->getStatusCode(), [200, 422], true));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -563,14 +554,14 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
[], // parameters
|
||||
[], // files
|
||||
[], // server parameters
|
||||
json_encode(['type' => 'person', 'id' => $personId], JSON_THROW_ON_ERROR)
|
||||
\json_encode(['type' => 'person', 'id' => $personId], JSON_THROW_ON_ERROR)
|
||||
);
|
||||
$response = $this->client->getResponse();
|
||||
$data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$data = \json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($response->getStatusCode(), [200, 422], true));
|
||||
|
||||
if ($response->getStatusCode() === 422) {
|
||||
if (422 === $response->getStatusCode()) {
|
||||
$this->markTestSkipped('the next tests should appears only on valid accompanying period');
|
||||
}
|
||||
|
||||
@@ -590,14 +581,14 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
[], // parameters
|
||||
[], // files
|
||||
[], // server parameters
|
||||
json_encode(['type' => 'thirdparty', 'id' => $thirdPartyId], JSON_THROW_ON_ERROR)
|
||||
\json_encode(['type' => 'thirdparty', 'id' => $thirdPartyId], JSON_THROW_ON_ERROR)
|
||||
);
|
||||
$response = $this->client->getResponse();
|
||||
$data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$data = \json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($response->getStatusCode(), [200, 422], true));
|
||||
|
||||
if ($response->getStatusCode() === 422) {
|
||||
if (422 === $response->getStatusCode()) {
|
||||
$this->markTestSkipped('the next tests should appears only on valid accompanying period');
|
||||
}
|
||||
|
||||
@@ -616,9 +607,9 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
sprintf('/api/1.0/person/accompanying-course/%d/requestor.json', $period->getId())
|
||||
);
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($response->getStatusCode(), [200, 422], true));
|
||||
|
||||
if ($response->getStatusCode() === 422) {
|
||||
if (422 === $response->getStatusCode()) {
|
||||
$this->markTestSkipped('the next tests should appears only on valid accompanying period');
|
||||
}
|
||||
|
||||
@@ -644,14 +635,14 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
[], // parameters
|
||||
[], // files
|
||||
[], // server parameters
|
||||
json_encode(['type' => 'accompanying_period_resource', 'resource' => ['type' => 'person', 'id' => $personId]])
|
||||
\json_encode(['type' => 'accompanying_period_resource', 'resource' => ['type' => 'person', 'id' => $personId]])
|
||||
);
|
||||
$response = $this->client->getResponse();
|
||||
$data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$data = \json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($response->getStatusCode(), [200, 422], true));
|
||||
|
||||
if ($response->getStatusCode() === 422) {
|
||||
if (422 === $response->getStatusCode()) {
|
||||
$this->markTestSkipped('the next tests should appears only on valid accompanying period');
|
||||
}
|
||||
|
||||
@@ -671,13 +662,13 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
sprintf('/api/1.0/person/accompanying-course/%d/requestor.json', $period->getId()),
|
||||
[],
|
||||
[],
|
||||
[], //server
|
||||
json_encode(['type' => 'accompanying_period_resource', 'id' => $resource->getId()], JSON_THROW_ON_ERROR)
|
||||
[], // server
|
||||
\json_encode(['type' => 'accompanying_period_resource', 'id' => $resource->getId()], JSON_THROW_ON_ERROR)
|
||||
);
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($response->getStatusCode(), [200, 422], true));
|
||||
|
||||
if ($response->getStatusCode() === 422) {
|
||||
if (422 === $response->getStatusCode()) {
|
||||
$this->markTestSkipped('the next tests should appears only on valid accompanying period');
|
||||
}
|
||||
|
||||
@@ -688,14 +679,14 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
[], // parameters
|
||||
[], // files
|
||||
[], // server parameters
|
||||
json_encode(['type' => 'accompanying_period_resource', 'resource' => ['type' => 'thirdparty', 'id' => $thirdPartyId]])
|
||||
\json_encode(['type' => 'accompanying_period_resource', 'resource' => ['type' => 'thirdparty', 'id' => $thirdPartyId]])
|
||||
);
|
||||
$response = $this->client->getResponse();
|
||||
$data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$data = \json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($response->getStatusCode(), [200, 422], true));
|
||||
|
||||
if ($response->getStatusCode() === 422) {
|
||||
if (422 === $response->getStatusCode()) {
|
||||
$this->markTestSkipped('the next tests should appears only on valid accompanying period');
|
||||
}
|
||||
|
||||
@@ -715,11 +706,11 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
|
||||
sprintf('/api/1.0/person/accompanying-course/%d/requestor.json', $period->getId()),
|
||||
[],
|
||||
[],
|
||||
[], //server
|
||||
json_encode(['type' => 'accompanying_period_resource', 'id' => $resource->getId()], JSON_THROW_ON_ERROR)
|
||||
[], // server
|
||||
\json_encode(['type' => 'accompanying_period_resource', 'id' => $resource->getId()], JSON_THROW_ON_ERROR)
|
||||
);
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
|
||||
$this->assertTrue(\in_array($response->getStatusCode(), [200, 422], true));
|
||||
}
|
||||
|
||||
public function testShow404()
|
||||
|
@@ -16,17 +16,13 @@ use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Iterator;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use function array_pop;
|
||||
use function count;
|
||||
use function preg_match;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AccompanyingCourseControllerTest extends WebTestCase
|
||||
@@ -45,28 +41,28 @@ final class AccompanyingCourseControllerTest extends WebTestCase
|
||||
self::ensureKernelShutdown();
|
||||
}
|
||||
|
||||
public function dataGenerateRandomUsers(): Iterator
|
||||
public function dataGenerateRandomUsers(): \Iterator
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$period = new AccompanyingPeriod(new DateTime('1 week ago'));
|
||||
$period = new AccompanyingPeriod(new \DateTime('1 week ago'));
|
||||
$user = $em->getRepository(User::class)
|
||||
->findOneByUsernameCanonical('center a_social');
|
||||
$period->setCreatedBy($user);
|
||||
//$period->setCreatedAt(new \DateTime('yesterday'));
|
||||
// $period->setCreatedAt(new \DateTime('yesterday'));
|
||||
|
||||
$center = $em->getRepository(Center::class)
|
||||
->findOneBy(['name' => 'Center A']);
|
||||
|
||||
$personIds = $em->createQuery('SELECT p.id FROM ' .
|
||||
Person::class . ' p JOIN p.centerCurrent cc ' .
|
||||
$personIds = $em->createQuery('SELECT p.id FROM '.
|
||||
Person::class.' p JOIN p.centerCurrent cc '.
|
||||
' WHERE cc.center = :center')
|
||||
->setParameter('center', $center)
|
||||
->setMaxResults(100)
|
||||
->getScalarResult();
|
||||
|
||||
yield [array_pop($personIds), array_pop($personIds)];
|
||||
yield [\array_pop($personIds), \array_pop($personIds)];
|
||||
|
||||
self::ensureKernelShutdown();
|
||||
}
|
||||
@@ -78,7 +74,7 @@ final class AccompanyingCourseControllerTest extends WebTestCase
|
||||
$this->assertResponseRedirects();
|
||||
$location = $this->client->getResponse()->headers->get('Location');
|
||||
|
||||
$this->assertEquals(1, preg_match('|^\\/[^\\/]+\\/parcours/([\\d]+)/edit$|', (string) $location));
|
||||
$this->assertEquals(1, \preg_match('|^\\/[^\\/]+\\/parcours/([\\d]+)/edit$|', (string) $location));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +93,7 @@ final class AccompanyingCourseControllerTest extends WebTestCase
|
||||
$location = $this->client->getResponse()->headers->get('Location');
|
||||
$matches = [];
|
||||
|
||||
$this->assertEquals(1, preg_match('|^\\/[^\\/]+\\/parcours/([\\d]+)/edit$|', (string) $location, $matches));
|
||||
$this->assertEquals(1, \preg_match('|^\\/[^\\/]+\\/parcours/([\\d]+)/edit$|', (string) $location, $matches));
|
||||
$id = $matches[1];
|
||||
|
||||
$period = self::$container->get(EntityManagerInterface::class)
|
||||
@@ -106,6 +102,6 @@ final class AccompanyingCourseControllerTest extends WebTestCase
|
||||
|
||||
$this->assertNotNull($period);
|
||||
|
||||
$this->assertEquals(2, count($period->getParticipations()));
|
||||
$this->assertEquals(2, \count($period->getParticipations()));
|
||||
}
|
||||
}
|
||||
|
@@ -13,11 +13,8 @@ namespace Chill\PersonBundle\Tests\Controller;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTime;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use LogicalException;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use function array_key_exists;
|
||||
|
||||
/**
|
||||
* Test the creation or deletion of accompanying periods.
|
||||
@@ -26,6 +23,7 @@ use function array_key_exists;
|
||||
* closed) starting the 2015-01-05.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
@@ -74,7 +72,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
$center = self::$em->getRepository(\Chill\MainBundle\Entity\Center::class)
|
||||
->findOneBy(['name' => 'Center A']);
|
||||
|
||||
$this->person = (new Person(new DateTime('2015-01-05')))
|
||||
$this->person = (new Person(new \DateTime('2015-01-05')))
|
||||
->setFirstName('Roland')
|
||||
->setLastName('Gallorime')
|
||||
->setCenter($center)
|
||||
@@ -108,7 +106,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
public function testAddNewPeriodBeforeActual()
|
||||
{
|
||||
$crawler = $this->client->request('GET', '/fr/person/'
|
||||
. $this->person->getId() . '/accompanying-period/create');
|
||||
.$this->person->getId().'/accompanying-period/create');
|
||||
|
||||
$form = $crawler->selectButton('Créer une période d\'accompagnement')->form();
|
||||
$form->get(self::CLOSING_MOTIVE_INPUT)
|
||||
@@ -122,7 +120,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
|
||||
$this->assertTrue(
|
||||
$this->client->getResponse()->isRedirect(
|
||||
'/fr/person/' . $this->person->getId() . '/accompanying-period'
|
||||
'/fr/person/'.$this->person->getId().'/accompanying-period'
|
||||
),
|
||||
'the server redirects to /accompanying-period page'
|
||||
);
|
||||
@@ -149,20 +147,20 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
public function testClosingCurrentPeriod()
|
||||
{
|
||||
$crawler = $this->client->request('GET', '/fr/person/'
|
||||
. $this->person->getId() . '/accompanying-period/close');
|
||||
.$this->person->getId().'/accompanying-period/close');
|
||||
|
||||
$form = $crawler->selectButton('Clôre la période')->form();
|
||||
|
||||
$form->get(self::CLOSING_MOTIVE_INPUT)
|
||||
->setValue($this->getLastValueOnClosingMotive($form));
|
||||
$form->get(self::CLOSING_INPUT)
|
||||
->setValue((new DateTime('2015-02-01'))->format('d-m-Y'));
|
||||
->setValue((new \DateTime('2015-02-01'))->format('d-m-Y'));
|
||||
|
||||
$cr = $this->client->submit($form);
|
||||
|
||||
$this->assertTrue(
|
||||
$this->client->getResponse()->isRedirect(
|
||||
'/fr/person/' . $this->person->getId() . '/accompanying-period'
|
||||
'/fr/person/'.$this->person->getId().'/accompanying-period'
|
||||
),
|
||||
'the server redirects to /accompanying-period page'
|
||||
);
|
||||
@@ -189,14 +187,14 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
public function testClosingCurrentPeriodWithDateClosingBeforeOpeningFails()
|
||||
{
|
||||
$crawler = $this->client->request('GET', '/fr/person/'
|
||||
. $this->person->getId() . '/accompanying-period/close');
|
||||
.$this->person->getId().'/accompanying-period/close');
|
||||
|
||||
$form = $crawler->selectButton('Clôre la période')->form();
|
||||
|
||||
$form->get(self::CLOSING_MOTIVE_INPUT)
|
||||
->setValue($this->getLastValueOnClosingMotive($form));
|
||||
$form->get(self::CLOSING_INPUT)
|
||||
->setValue((new DateTime('2014-01-01'))->format('d-m-Y'));
|
||||
->setValue((new \DateTime('2014-01-01'))->format('d-m-Y'));
|
||||
|
||||
$crawlerResponse = $this->client->submit($form);
|
||||
|
||||
@@ -236,7 +234,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
]);
|
||||
|
||||
$crawler = $this->client->request('GET', '/fr/person/'
|
||||
. $this->person->getId() . '/accompanying-period/create');
|
||||
.$this->person->getId().'/accompanying-period/create');
|
||||
|
||||
$form = $crawler->selectButton('Créer une période d\'accompagnement')->form();
|
||||
$form->get(self::CLOSING_MOTIVE_INPUT)
|
||||
@@ -272,11 +270,11 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
*/
|
||||
public function testCreatePeriodWithClosingAfterCurrentFails(): never
|
||||
{
|
||||
$this->markTestSkipped('Multiple period may now cover. This test is kept ' .
|
||||
$this->markTestSkipped('Multiple period may now cover. This test is kept '.
|
||||
'in case of a configuration may add this feature again');
|
||||
|
||||
$crawler = $this->client->request('GET', '/fr/person/'
|
||||
. $this->person->getId() . '/accompanying-period/create');
|
||||
.$this->person->getId().'/accompanying-period/create');
|
||||
|
||||
$form = $crawler->selectButton("Créer une période d'accompagnement")->form();
|
||||
$form->get(self::CLOSING_MOTIVE_INPUT)
|
||||
@@ -312,7 +310,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
public function testCreatePeriodWithClosingBeforeOpeningFails()
|
||||
{
|
||||
$crawler = $this->client->request('GET', '/fr/person/'
|
||||
. $this->person->getId() . '/accompanying-period/create');
|
||||
.$this->person->getId().'/accompanying-period/create');
|
||||
|
||||
$form = $crawler->selectButton('Créer une période d\'accompagnement')->form();
|
||||
$form->get(self::CLOSING_MOTIVE_INPUT)
|
||||
@@ -358,7 +356,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
]);
|
||||
|
||||
$crawler = $this->client->request('GET', '/fr/person/'
|
||||
. $this->person->getId() . '/accompanying-period/create');
|
||||
.$this->person->getId().'/accompanying-period/create');
|
||||
|
||||
$form = $crawler->selectButton('Créer une période d\'accompagnement')->form();
|
||||
$form->get(self::CLOSING_MOTIVE_INPUT)
|
||||
@@ -404,7 +402,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
]);
|
||||
|
||||
$crawler = $this->client->request('GET', '/fr/person/'
|
||||
. $this->person->getId() . '/accompanying-period/create');
|
||||
.$this->person->getId().'/accompanying-period/create');
|
||||
|
||||
$form = $crawler->selectButton('Créer une période d\'accompagnement')->form();
|
||||
$form->get(self::CLOSING_MOTIVE_INPUT)
|
||||
@@ -440,11 +438,11 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
*/
|
||||
public function testCreatePeriodWithOpeningAndClosingAfterCurrentFails(): never
|
||||
{
|
||||
$this->markTestSkipped('Multiple period may now cover. This test is kept ' .
|
||||
$this->markTestSkipped('Multiple period may now cover. This test is kept '.
|
||||
'in case of a configuration may add this feature again');
|
||||
|
||||
$crawler = $this->client->request('GET', '/fr/person/'
|
||||
. $this->person->getId() . '/accompanying-period/create');
|
||||
.$this->person->getId().'/accompanying-period/create');
|
||||
|
||||
$form = $crawler->selectButton("Créer une période d'accompagnement")->form();
|
||||
$form->get(self::CLOSING_MOTIVE_INPUT)
|
||||
@@ -489,7 +487,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
|
||||
// close the current period
|
||||
$period = $this->person->getOpenedAccompanyingPeriod();
|
||||
$period->setClosingDate(new DateTime('2015-02-05'));
|
||||
$period->setClosingDate(new \DateTime('2015-02-05'));
|
||||
$this->person->close($period);
|
||||
|
||||
$this->generatePeriods([
|
||||
@@ -503,7 +501,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
$periods = $this->person->getAccompanyingPeriodsOrdered();
|
||||
/** @var Criteria $criteria */
|
||||
$criteria = Criteria::create();
|
||||
//$criteria->where(Criteria::expr()->eq('openingDate', \DateTime::createFromFormat()))
|
||||
// $criteria->where(Criteria::expr()->eq('openingDate', \DateTime::createFromFormat()))
|
||||
$firstPeriod = reset($periods);
|
||||
$lastPeriod = end($periods);
|
||||
|
||||
@@ -546,15 +544,14 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
protected function generatePeriods(array $periods)
|
||||
{
|
||||
foreach ($periods as $periodDef) {
|
||||
$period = new AccompanyingPeriod(new DateTime($periodDef['openingDate']));
|
||||
$period = new AccompanyingPeriod(new \DateTime($periodDef['openingDate']));
|
||||
|
||||
if (array_key_exists('closingDate', $periodDef)) {
|
||||
if (!array_key_exists('closingMotive', $periodDef)) {
|
||||
throw new LogicalException('you must define a closing '
|
||||
. 'motive into your periods fixtures');
|
||||
if (\array_key_exists('closingDate', $periodDef)) {
|
||||
if (!\array_key_exists('closingMotive', $periodDef)) {
|
||||
throw new \LogicalException('you must define a closing motive into your periods fixtures');
|
||||
}
|
||||
|
||||
$period->setClosingDate(new DateTime($periodDef['closingDate']))
|
||||
$period->setClosingDate(new \DateTime($periodDef['closingDate']))
|
||||
->setClosingMotive($periodDef['closingMotive']);
|
||||
}
|
||||
|
||||
@@ -571,7 +568,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
|
||||
* @var \Symfony\Component\DomCrawler\Form The form
|
||||
*
|
||||
* @return Chill\PersonBundle\Entity\AccompanyingPeriod The last value of closing
|
||||
* motive
|
||||
* motive
|
||||
*/
|
||||
protected function getLastValueOnClosingMotive(\Symfony\Component\DomCrawler\Form $form)
|
||||
{
|
||||
|
@@ -16,6 +16,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AccompanyingPeriodRegulationListControllerTest extends WebTestCase
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -13,17 +13,14 @@ namespace Chill\PersonBundle\Tests\Controller;
|
||||
|
||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use DateInterval;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use function array_pop;
|
||||
use function shuffle;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class HouseholdControllerTest extends WebTestCase
|
||||
@@ -48,7 +45,7 @@ final class HouseholdControllerTest extends WebTestCase
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$ids = $em->createQuery(
|
||||
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)
|
||||
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)
|
||||
@@ -58,13 +55,13 @@ final class HouseholdControllerTest extends WebTestCase
|
||||
throw new \RuntimeException('no household ids with center "Center A"');
|
||||
}
|
||||
|
||||
shuffle($ids);
|
||||
\shuffle($ids);
|
||||
|
||||
yield [array_pop($ids)['id']];
|
||||
yield [\array_pop($ids)['id']];
|
||||
|
||||
yield [array_pop($ids)['id']];
|
||||
yield [\array_pop($ids)['id']];
|
||||
|
||||
yield [array_pop($ids)['id']];
|
||||
yield [\array_pop($ids)['id']];
|
||||
|
||||
self::ensureKernelShutdown();
|
||||
}
|
||||
@@ -117,8 +114,8 @@ final class HouseholdControllerTest extends WebTestCase
|
||||
|
||||
$form['household[commentMembers][comment]'] = 'This is a text **generated** by automatic tests';
|
||||
$form['household[waitingForBirth]']->tick();
|
||||
$form['household[waitingForBirthDate]'] = (new DateTime('today'))
|
||||
->add(new DateInterval('P1M'))->format('Y-m-d');
|
||||
$form['household[waitingForBirthDate]'] = (new \DateTime('today'))
|
||||
->add(new \DateInterval('P1M'))->format('Y-m-d');
|
||||
|
||||
$this->client->submit($form);
|
||||
|
||||
|
@@ -16,34 +16,26 @@ use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Chill\PersonBundle\Entity\Household\Position;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTimeImmutable;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Iterator;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use function array_pop;
|
||||
use function count;
|
||||
use function json_decode;
|
||||
use function json_encode;
|
||||
use function random_int;
|
||||
use function shuffle;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class HouseholdMemberControllerTest extends WebTestCase
|
||||
{
|
||||
use PrepareClientTrait;
|
||||
|
||||
public function provideValidDataEditMember(): Iterator
|
||||
public function provideValidDataEditMember(): \Iterator
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$membershipIds = $em->createQuery(sprintf("SELECT m.id FROM %s m JOIN m.person p JOIN p.centerHistory ch JOIN ch.center c WHERE c.name = :center AND m.endDate IS NULL AND ch.endDate IS NULL", HouseholdMember::class))
|
||||
$membershipIds = $em->createQuery(sprintf('SELECT m.id FROM %s m JOIN m.person p JOIN p.centerHistory ch JOIN ch.center c WHERE c.name = :center AND m.endDate IS NULL AND ch.endDate IS NULL', HouseholdMember::class))
|
||||
->setParameter('center', 'Center A')
|
||||
->getScalarResult();
|
||||
|
||||
@@ -51,19 +43,19 @@ final class HouseholdMemberControllerTest extends WebTestCase
|
||||
throw new \RuntimeException("no memberships for person associated to 'Center A'");
|
||||
}
|
||||
|
||||
shuffle($membershipIds);
|
||||
\shuffle($membershipIds);
|
||||
|
||||
yield [array_pop($membershipIds)['id']];
|
||||
yield [\array_pop($membershipIds)['id']];
|
||||
}
|
||||
|
||||
public function provideValidDataMove(): Iterator
|
||||
public function provideValidDataMove(): \Iterator
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
$yesterday = new DateTimeImmutable('yesterday');
|
||||
$yesterday = new \DateTimeImmutable('yesterday');
|
||||
|
||||
$personIds = $em->createQuery(
|
||||
sprintf("SELECT p.id FROM %s p JOIN p.centerHistory ch JOIN ch.center c WHERE c.name = :center AND ch.endDate IS NULL", Person::class)
|
||||
sprintf('SELECT p.id FROM %s p JOIN p.centerHistory ch JOIN ch.center c WHERE c.name = :center AND ch.endDate IS NULL', Person::class)
|
||||
)
|
||||
->setParameter('center', 'Center A')
|
||||
->setMaxResults(100)
|
||||
@@ -73,20 +65,20 @@ final class HouseholdMemberControllerTest extends WebTestCase
|
||||
throw new \RuntimeException('no person associated with "Center A"');
|
||||
}
|
||||
|
||||
shuffle($personIds);
|
||||
\shuffle($personIds);
|
||||
|
||||
$household = new Household();
|
||||
$em->persist($household);
|
||||
$em->flush();
|
||||
|
||||
$positions = $em->createQuery('SELECT pos.id FROM ' . Position::class . ' pos ' .
|
||||
$positions = $em->createQuery('SELECT pos.id FROM '.Position::class.' pos '.
|
||||
'WHERE pos.shareHouseHold = TRUE')
|
||||
->getResult();
|
||||
|
||||
$i = 0;
|
||||
|
||||
do {
|
||||
$id = array_pop($personIds)['id'];
|
||||
$id = \array_pop($personIds)['id'];
|
||||
$person = self::$container->get(EntityManagerInterface::class)
|
||||
->getRepository(Person::class)
|
||||
->find($id);
|
||||
@@ -103,8 +95,8 @@ final class HouseholdMemberControllerTest extends WebTestCase
|
||||
yield [
|
||||
$id,
|
||||
$household->getId(),
|
||||
$positions[random_int(0, count($positions) - 1)]['id'],
|
||||
new DateTimeImmutable('tomorrow'),
|
||||
$positions[\random_int(0, \count($positions) - 1)]['id'],
|
||||
new \DateTimeImmutable('tomorrow'),
|
||||
];
|
||||
}
|
||||
} while (1 >= $i);
|
||||
@@ -135,7 +127,7 @@ final class HouseholdMemberControllerTest extends WebTestCase
|
||||
/**
|
||||
* @dataProvider provideValidDataMove
|
||||
*/
|
||||
public function testLeaveWithoutHousehold(mixed $personId, mixed $householdId, mixed $positionId, DateTimeInterface $date)
|
||||
public function testLeaveWithoutHousehold(mixed $personId, mixed $householdId, mixed $positionId, \DateTimeInterface $date)
|
||||
{
|
||||
$client = $this->getClientAuthenticated();
|
||||
|
||||
@@ -145,7 +137,7 @@ final class HouseholdMemberControllerTest extends WebTestCase
|
||||
[], // parameters
|
||||
[], // files
|
||||
[], // server
|
||||
json_encode(
|
||||
\json_encode(
|
||||
[
|
||||
'concerned' => [
|
||||
[
|
||||
@@ -154,7 +146,7 @@ final class HouseholdMemberControllerTest extends WebTestCase
|
||||
'id' => $personId,
|
||||
],
|
||||
'start_date' => [
|
||||
'datetime' => $date->format(DateTimeInterface::RFC3339),
|
||||
'datetime' => $date->format(\DateTimeInterface::RFC3339),
|
||||
],
|
||||
'position' => [
|
||||
'type' => 'household_position',
|
||||
@@ -175,7 +167,7 @@ final class HouseholdMemberControllerTest extends WebTestCase
|
||||
$client->getResponse()->getStatusCode()
|
||||
);
|
||||
|
||||
$data = json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$data = \json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
$this->assertEquals(null, $data);
|
||||
}
|
||||
@@ -183,7 +175,7 @@ final class HouseholdMemberControllerTest extends WebTestCase
|
||||
/**
|
||||
* @dataProvider provideValidDataMove
|
||||
*/
|
||||
public function testMoveMember(mixed $personId, mixed $householdId, mixed $positionId, DateTimeInterface $date)
|
||||
public function testMoveMember(mixed $personId, mixed $householdId, mixed $positionId, \DateTimeInterface $date)
|
||||
{
|
||||
$client = $this->getClientAuthenticated();
|
||||
|
||||
@@ -193,7 +185,7 @@ final class HouseholdMemberControllerTest extends WebTestCase
|
||||
[], // parameters
|
||||
[], // files
|
||||
[], // server
|
||||
json_encode(
|
||||
\json_encode(
|
||||
[
|
||||
'concerned' => [
|
||||
[
|
||||
@@ -202,7 +194,7 @@ final class HouseholdMemberControllerTest extends WebTestCase
|
||||
'id' => $personId,
|
||||
],
|
||||
'start_date' => [
|
||||
'datetime' => $date->format(DateTimeInterface::RFC3339),
|
||||
'datetime' => $date->format(\DateTimeInterface::RFC3339),
|
||||
],
|
||||
'position' => [
|
||||
'type' => 'household_position',
|
||||
@@ -230,7 +222,7 @@ final class HouseholdMemberControllerTest extends WebTestCase
|
||||
/**
|
||||
* @dataProvider provideValidDataMove
|
||||
*/
|
||||
public function testMoveMemberToNewHousehold(mixed $personId, mixed $householdId, mixed $positionId, DateTimeInterface $date)
|
||||
public function testMoveMemberToNewHousehold(mixed $personId, mixed $householdId, mixed $positionId, \DateTimeInterface $date)
|
||||
{
|
||||
$client = $this->getClientAuthenticated();
|
||||
|
||||
@@ -240,7 +232,7 @@ final class HouseholdMemberControllerTest extends WebTestCase
|
||||
[], // parameters
|
||||
[], // files
|
||||
[], // server
|
||||
json_encode(
|
||||
\json_encode(
|
||||
[
|
||||
'concerned' => [
|
||||
[
|
||||
@@ -249,7 +241,7 @@ final class HouseholdMemberControllerTest extends WebTestCase
|
||||
'id' => $personId,
|
||||
],
|
||||
'start_date' => [
|
||||
'datetime' => $date->format(DateTimeInterface::RFC3339),
|
||||
'datetime' => $date->format(\DateTimeInterface::RFC3339),
|
||||
],
|
||||
'position' => [
|
||||
'type' => 'household_position',
|
||||
@@ -272,14 +264,14 @@ final class HouseholdMemberControllerTest extends WebTestCase
|
||||
$client->getResponse()->getStatusCode()
|
||||
);
|
||||
|
||||
$data = json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$data = \json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
$this->assertIsArray($data);
|
||||
$this->assertArrayHasKey('members', $data);
|
||||
$this->assertIsArray($data['members']);
|
||||
$this->assertEquals(
|
||||
1,
|
||||
count($data['members']),
|
||||
\count($data['members']),
|
||||
'assert new household count one member'
|
||||
);
|
||||
$this->assertArrayHasKey('person', $data['members'][0]);
|
||||
|
@@ -16,6 +16,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class PersonAddressControllerTest extends WebTestCase
|
||||
@@ -91,8 +92,8 @@ final class PersonAddressControllerTest extends WebTestCase
|
||||
*/
|
||||
public function testCreateAddress()
|
||||
{
|
||||
$crawler = $this->client->request('GET', '/fr/person/' .
|
||||
self::$person->getId() . '/address/new');
|
||||
$crawler = $this->client->request('GET', '/fr/person/'.
|
||||
self::$person->getId().'/address/new');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isSuccessful());
|
||||
|
||||
@@ -134,8 +135,8 @@ final class PersonAddressControllerTest extends WebTestCase
|
||||
|
||||
public function testEmptyList()
|
||||
{
|
||||
$crawler = $this->client->request('GET', '/fr/person/' .
|
||||
self::$person->getId() . '/address/list');
|
||||
$crawler = $this->client->request('GET', '/fr/person/'.
|
||||
self::$person->getId().'/address/list');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isSuccessful());
|
||||
|
||||
@@ -155,8 +156,8 @@ final class PersonAddressControllerTest extends WebTestCase
|
||||
$this->refreshPerson();
|
||||
$address = self::$person->getLastAddress();
|
||||
|
||||
$crawler = $this->client->request('GET', '/fr/person/' . self::$person->getId()
|
||||
. '/address/' . $address->getId() . '/edit');
|
||||
$crawler = $this->client->request('GET', '/fr/person/'.self::$person->getId()
|
||||
.'/address/'.$address->getId().'/edit');
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isSuccessful());
|
||||
|
||||
|
@@ -14,60 +14,57 @@ namespace Chill\PersonBundle\Tests\Controller;
|
||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Iterator;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use function array_pop;
|
||||
use function json_decode;
|
||||
use function shuffle;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class PersonApiControllerTest extends WebTestCase
|
||||
{
|
||||
use PrepareClientTrait;
|
||||
|
||||
public function dataGetPersonFromCenterA(): Iterator
|
||||
public function dataGetPersonFromCenterA(): \Iterator
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
$personIds = $em->createQuery(sprintf(
|
||||
"SELECT p.id FROM %s p JOIN p.centerCurrent pc JOIN pc.center c WHERE c.name = :center",
|
||||
'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();
|
||||
|
||||
shuffle($personIds);
|
||||
\shuffle($personIds);
|
||||
|
||||
yield array_pop($personIds);
|
||||
yield \array_pop($personIds);
|
||||
|
||||
yield array_pop($personIds);
|
||||
yield \array_pop($personIds);
|
||||
|
||||
yield array_pop($personIds);
|
||||
yield \array_pop($personIds);
|
||||
|
||||
yield array_pop($personIds);
|
||||
yield \array_pop($personIds);
|
||||
}
|
||||
|
||||
public function dataGetPersonFromCenterB(): Iterator
|
||||
public function dataGetPersonFromCenterB(): \Iterator
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
$personIds = $em->createQuery(
|
||||
sprintf("SELECT p.id FROM %s p JOIN p.centerCurrent pc JOIN pc.center c WHERE c.name = :center", Person::class)
|
||||
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();
|
||||
|
||||
shuffle($personIds);
|
||||
\shuffle($personIds);
|
||||
|
||||
yield array_pop($personIds);
|
||||
yield \array_pop($personIds);
|
||||
|
||||
yield array_pop($personIds);
|
||||
yield \array_pop($personIds);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,7 +104,7 @@ final class PersonApiControllerTest extends WebTestCase
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
|
||||
$data = json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$data = \json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
$this->assertArrayHasKey('type', $data);
|
||||
$this->assertArrayHasKey('id', $data);
|
||||
|
@@ -12,18 +12,16 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Controller;
|
||||
|
||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\DomCrawler\Form;
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
* Test creation and deletion for persons.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class PersonControllerCreateTest extends WebTestCase
|
||||
@@ -51,7 +49,7 @@ final class PersonControllerCreateTest extends WebTestCase
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
//remove two people created during test
|
||||
// remove two people created during test
|
||||
$jesus = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)
|
||||
->findOneBy(['firstName' => 'God']);
|
||||
|
||||
@@ -120,15 +118,15 @@ final class PersonControllerCreateTest extends WebTestCase
|
||||
);
|
||||
$this->assertEquals(
|
||||
3,
|
||||
count($genderType->availableOptionValues()),
|
||||
\count($genderType->availableOptionValues()),
|
||||
'The gender input has three options: man, women and undefined'
|
||||
);
|
||||
$this->assertTrue(
|
||||
in_array('man', $genderType->availableOptionValues(), true),
|
||||
\in_array('man', $genderType->availableOptionValues(), true),
|
||||
'gender has "homme" option'
|
||||
);
|
||||
$this->assertTrue(
|
||||
in_array('woman', $genderType->availableOptionValues(), true),
|
||||
\in_array('woman', $genderType->availableOptionValues(), true),
|
||||
'gender has "femme" option'
|
||||
);
|
||||
$this->assertFalse($genderType->hasValue(), 'The gender input is not checked');
|
||||
@@ -143,11 +141,11 @@ final class PersonControllerCreateTest extends WebTestCase
|
||||
|
||||
$crawler = $client->request('GET', '/fr/person/new');
|
||||
|
||||
//test the page is loaded before continuing
|
||||
// test the page is loaded before continuing
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$form = $crawler->selectButton("Créer l'usager")->form();
|
||||
$form = $this->fillAValidCreationForm($form, 'Charline', 'dd', new DateTime('1970-10-15'));
|
||||
$form = $this->fillAValidCreationForm($form, 'Charline', 'dd', new \DateTime('1970-10-15'));
|
||||
$client->submit($form);
|
||||
|
||||
$this->assertStringContainsString(
|
||||
@@ -156,7 +154,7 @@ final class PersonControllerCreateTest extends WebTestCase
|
||||
'check that the page has detected the lastname of a person existing in database'
|
||||
);
|
||||
|
||||
//inversion
|
||||
// inversion
|
||||
$form = $crawler->selectButton("Créer l'usager")->form();
|
||||
$form = $this->fillAValidCreationForm($form, 'dd', 'Charline');
|
||||
$client->submit($form);
|
||||
@@ -224,12 +222,12 @@ final class PersonControllerCreateTest extends WebTestCase
|
||||
Form &$creationForm,
|
||||
string $firstname = 'God',
|
||||
string $lastname = 'Jesus',
|
||||
?DateTime $birthdate = null
|
||||
\DateTime $birthdate = null
|
||||
) {
|
||||
$creationForm->get(self::FIRSTNAME_INPUT)->setValue($firstname . '_' . uniqid());
|
||||
$creationForm->get(self::LASTNAME_INPUT)->setValue($lastname . '_' . uniqid());
|
||||
$creationForm->get(self::FIRSTNAME_INPUT)->setValue($firstname.'_'.uniqid());
|
||||
$creationForm->get(self::LASTNAME_INPUT)->setValue($lastname.'_'.uniqid());
|
||||
$creationForm->get(self::GENDER_INPUT)->select('man');
|
||||
$date = $birthdate ?? new DateTime('1947-02-01');
|
||||
$date = $birthdate ?? new \DateTime('1947-02-01');
|
||||
$creationForm->get(self::BIRTHDATE_INPUT)->setValue($date->format('Y-m-d'));
|
||||
|
||||
return $creationForm;
|
||||
|
@@ -16,9 +16,7 @@ use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Repository\PersonRepository;
|
||||
use Closure;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use PHPUnit\Framework\Constraint\StringContains;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
@@ -28,6 +26,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
* As I am logged in as "center a_social"
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class PersonControllerUpdateTest extends WebTestCase
|
||||
@@ -157,7 +156,7 @@ final class PersonControllerUpdateTest extends WebTestCase
|
||||
|
||||
$alerts = $crawler->filter('.alert-danger');
|
||||
|
||||
self::assertEquals(1, $alerts->count(), "there is an alert message displayed on the page");
|
||||
self::assertEquals(1, $alerts->count(), 'there is an alert message displayed on the page');
|
||||
}
|
||||
|
||||
public static function providePerson(): iterable
|
||||
|
@@ -11,10 +11,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Controller;
|
||||
|
||||
//ini_set('memory_limit', '-1');
|
||||
// ini_set('memory_limit', '-1');
|
||||
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Closure;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
/**
|
||||
@@ -23,6 +22,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
* As I am logged in as "center a_social"
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
|
||||
@@ -63,8 +63,8 @@ final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
|
||||
$this->em->persist($this->person);
|
||||
$this->em->flush();
|
||||
|
||||
$this->editUrl = '/en/person/' . $this->person->getId() . '/general/edit';
|
||||
$this->viewUrl = '/en/person/' . $this->person->getId() . '/general';
|
||||
$this->editUrl = '/en/person/'.$this->person->getId().'/general/edit';
|
||||
$this->viewUrl = '/en/person/'.$this->person->getId().'/general';
|
||||
|
||||
$this->client = self::createClient(
|
||||
[
|
||||
@@ -109,13 +109,13 @@ final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
|
||||
* @param string $field
|
||||
* @param string $value
|
||||
*/
|
||||
public function testEditTextField($field, $value, Closure $callback)
|
||||
public function testEditTextField($field, $value, \Closure $callback)
|
||||
{
|
||||
$crawler = $this->client->request('GET', $this->editUrl);
|
||||
|
||||
$form = $crawler->selectButton('Submit')
|
||||
->form();
|
||||
//transform countries into value if needed
|
||||
// transform countries into value if needed
|
||||
switch ($field) {
|
||||
case 'nationality':
|
||||
case 'countryOfBirth':
|
||||
@@ -133,7 +133,7 @@ final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
|
||||
$transformedValue = $value;
|
||||
}
|
||||
|
||||
$form->get('chill_personbundle_person[' . $field . ']')
|
||||
$form->get('chill_personbundle_person['.$field.']')
|
||||
->setValue($transformedValue);
|
||||
|
||||
$this->client->submit($form);
|
||||
@@ -146,7 +146,7 @@ final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
|
||||
$this->assertEquals(
|
||||
$value,
|
||||
$callback($this->person),
|
||||
'the value ' . $field . ' is updated in db'
|
||||
'the value '.$field.' is updated in db'
|
||||
);
|
||||
|
||||
$crawler = $this->client->followRedirect();
|
||||
@@ -160,7 +160,7 @@ final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
|
||||
|| 'gender' === $field) {
|
||||
// we do not perform test on the web page contents.
|
||||
} else {
|
||||
$this->assertGreaterThan(0, $crawler->filter('html:contains("' . $value . '")')->count());
|
||||
$this->assertGreaterThan(0, $crawler->filter('html:contains("'.$value.'")')->count());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,10 +175,10 @@ final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
|
||||
|
||||
$configurables = ['placeOfBirth', 'phonenumber', 'email',
|
||||
'countryOfBirth', 'nationality', 'spokenLanguages', 'maritalStatus', ];
|
||||
$form = $crawler->selectButton('Submit')->form(); //;
|
||||
$form = $crawler->selectButton('Submit')->form(); // ;
|
||||
|
||||
foreach ($configurables as $key) {
|
||||
$this->assertFalse($form->has('chill_personbundle_person[' . $key . ']'));
|
||||
$this->assertFalse($form->has('chill_personbundle_person['.$key.']'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -19,6 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class PersonControllerViewTest extends WebTestCase
|
||||
|
@@ -16,6 +16,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class PersonControllerViewWithHiddenFieldsTest extends WebTestCase
|
||||
@@ -31,26 +32,26 @@ final class PersonControllerViewWithHiddenFieldsTest extends WebTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
/**
|
||||
self::bootKernel(['environment' => 'test_with_hidden_fields']);
|
||||
|
||||
$this->em = self::$kernel->getContainer()
|
||||
->get('doctrine.orm.entity_manager');
|
||||
|
||||
$center = $this->em->getRepository(\Chill\MainBundle\Entity\Center::class)
|
||||
->findOneBy(['name' => 'Center A']);
|
||||
|
||||
$this->person = (new Person())
|
||||
->setLastName('Tested Person')
|
||||
->setFirstName('Réginald')
|
||||
->setCenter($center)
|
||||
->setGender(Person::MALE_GENDER);
|
||||
|
||||
$this->em->persist($this->person);
|
||||
$this->em->flush();
|
||||
|
||||
$this->viewUrl = '/en/person/' . $this->person->getId() . '/general';
|
||||
*/
|
||||
/*
|
||||
* self::bootKernel(['environment' => 'test_with_hidden_fields']);
|
||||
*
|
||||
* $this->em = self::$kernel->getContainer()
|
||||
* ->get('doctrine.orm.entity_manager');
|
||||
*
|
||||
* $center = $this->em->getRepository(\Chill\MainBundle\Entity\Center::class)
|
||||
* ->findOneBy(['name' => 'Center A']);
|
||||
*
|
||||
* $this->person = (new Person())
|
||||
* ->setLastName('Tested Person')
|
||||
* ->setFirstName('Réginald')
|
||||
* ->setCenter($center)
|
||||
* ->setGender(Person::MALE_GENDER);
|
||||
*
|
||||
* $this->em->persist($this->person);
|
||||
* $this->em->flush();
|
||||
*
|
||||
* $this->viewUrl = '/en/person/' . $this->person->getId() . '/general';
|
||||
*/
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
|
@@ -18,6 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class PersonDuplicateControllerViewTest extends WebTestCase
|
||||
@@ -62,7 +63,6 @@ final class PersonDuplicateControllerViewTest extends WebTestCase
|
||||
|
||||
/**
|
||||
* @dataProvider providePersonData
|
||||
* @return void
|
||||
*/
|
||||
public function testViewDuplicatePerson(int $personId, int $person2Id): void
|
||||
{
|
||||
@@ -71,7 +71,7 @@ final class PersonDuplicateControllerViewTest extends WebTestCase
|
||||
'PHP_AUTH_PW' => 'password',
|
||||
]);
|
||||
|
||||
$crawler = $client->request('GET', '/en/person/' . $personId . '/duplicate/view');
|
||||
$crawler = $client->request('GET', '/en/person/'.$personId.'/duplicate/view');
|
||||
$response = $client->getResponse();
|
||||
$this->assertTrue($response->isSuccessful());
|
||||
|
||||
@@ -79,14 +79,14 @@ final class PersonDuplicateControllerViewTest extends WebTestCase
|
||||
$this->assertGreaterThan(0, $crawler->filter('html:contains("Réginal")')->count());
|
||||
$this->assertGreaterThan(0, $crawler->filter('html:contains("Réginald")')->count());
|
||||
|
||||
$crawler = $client->request('GET', '/en/person/' . $personId . '/duplicate/' . $person2Id . '/confirm');
|
||||
$crawler = $client->request('GET', '/en/person/'.$personId.'/duplicate/'.$person2Id.'/confirm');
|
||||
$response = $client->getResponse();
|
||||
$this->assertTrue($response->isSuccessful());
|
||||
|
||||
$this->assertGreaterThan(0, $crawler->filter('html:contains("Old person")')->count());
|
||||
$this->assertGreaterThan(0, $crawler->filter('html:contains("New person")')->count());
|
||||
|
||||
$crawler = $client->request('POST', '/en/person/' . $personId . '/duplicate/' . $person2Id . '/confirm', [
|
||||
$crawler = $client->request('POST', '/en/person/'.$personId.'/duplicate/'.$person2Id.'/confirm', [
|
||||
'chill_personbundle_person_confirm_duplicate[confirm]' => 1,
|
||||
]);
|
||||
$response = $client->getResponse();
|
||||
|
@@ -17,12 +17,10 @@ use Chill\PersonBundle\Entity\Relationships\Relation;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use function array_rand;
|
||||
use function json_encode;
|
||||
use function random_int;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class RelationshipApiControllerTest extends WebTestCase
|
||||
@@ -63,7 +61,7 @@ final class RelationshipApiControllerTest extends WebTestCase
|
||||
->setParameter('name', 'Center A')
|
||||
->getQuery()
|
||||
->setMaxResults(1)
|
||||
->setFirstResult(random_int(0, $countPersons - 1))
|
||||
->setFirstResult(\random_int(0, $countPersons - 1))
|
||||
->getSingleResult();
|
||||
|
||||
self::ensureKernelShutdown();
|
||||
@@ -96,7 +94,7 @@ final class RelationshipApiControllerTest extends WebTestCase
|
||||
->setParameter('name', 'Center A')
|
||||
->getQuery()
|
||||
->setMaxResults(2)
|
||||
->setFirstResult(random_int(0, $countPersons - 1))
|
||||
->setFirstResult(\random_int(0, $countPersons - 1))
|
||||
->getResult();
|
||||
|
||||
self::ensureKernelShutdown();
|
||||
@@ -132,7 +130,7 @@ final class RelationshipApiControllerTest extends WebTestCase
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
json_encode([
|
||||
\json_encode([
|
||||
'type' => 'relationship',
|
||||
'fromPerson' => ['id' => $fromPersonId, 'type' => 'person'],
|
||||
'toPerson' => ['id' => $toPersonId, 'type' => 'person'],
|
||||
@@ -152,6 +150,6 @@ final class RelationshipApiControllerTest extends WebTestCase
|
||||
->findAll();
|
||||
}
|
||||
|
||||
return $this->relations[array_rand($this->relations)];
|
||||
return $this->relations[\array_rand($this->relations)];
|
||||
}
|
||||
}
|
||||
|
@@ -14,12 +14,10 @@ namespace Chill\PersonBundle\Tests\Controller;
|
||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use function array_pop;
|
||||
use function count;
|
||||
use function json_decode;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class SocialIssueApiControllerTest extends WebTestCase
|
||||
@@ -38,14 +36,14 @@ final class SocialIssueApiControllerTest extends WebTestCase
|
||||
{
|
||||
$socialIssues = $data['results'];
|
||||
shuffle($socialIssues);
|
||||
$socialIssue = array_pop($socialIssues);
|
||||
$socialIssue = \array_pop($socialIssues);
|
||||
|
||||
$client = $this->getClientAuthenticated();
|
||||
$client->request(Request::METHOD_GET, sprintf('/api/1.0/person/social-work/social-issue/%d.json', $socialIssue['id']));
|
||||
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$data = json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$data = \json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
$this->assertArrayHasKey('id', $data);
|
||||
$this->assertArrayHasKey('type', $data);
|
||||
@@ -58,10 +56,10 @@ final class SocialIssueApiControllerTest extends WebTestCase
|
||||
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$data = json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$data = \json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
$this->assertGreaterThan(0, $data['count']);
|
||||
$this->assertGreaterThan(0, count($data['results']));
|
||||
$this->assertGreaterThan(0, \count($data['results']));
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class SocialWorkEvaluationApiControllerTest extends WebTestCase
|
||||
@@ -52,7 +53,7 @@ final class SocialWorkEvaluationApiControllerTest extends WebTestCase
|
||||
|
||||
/** @var SocialAction $socialAction */
|
||||
$socialAction = $this->em->createQuery(
|
||||
'SELECT s FROM ' . SocialAction::class . ' s WHERE SIZE(s.evaluations) >= 2'
|
||||
'SELECT s FROM '.SocialAction::class.' s WHERE SIZE(s.evaluations) >= 2'
|
||||
)
|
||||
->setMaxResults(1)
|
||||
->getSingleResult();
|
||||
|
@@ -18,6 +18,7 @@ use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
class AccompanyingPeriodWorkTest extends TestCase
|
||||
@@ -58,7 +59,6 @@ class AccompanyingPeriodWorkTest extends TestCase
|
||||
|
||||
public function testReferrerHistoryOnDifferentDays(): void
|
||||
{
|
||||
|
||||
$work = new AccompanyingPeriodWork();
|
||||
$userA = new User();
|
||||
$userB = new User();
|
||||
|
@@ -18,6 +18,7 @@ use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ResourceTest extends TestCase
|
||||
|
@@ -11,7 +11,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Entity;
|
||||
|
||||
use ArrayIterator;
|
||||
use Chill\MainBundle\Entity\Address;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
@@ -19,12 +18,10 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use DateTime;
|
||||
use DateTimeInterface;
|
||||
use function count;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
||||
@@ -44,12 +41,12 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertCount(1, $period->getStepHistories());
|
||||
$this->assertEquals(AccompanyingPeriod::STEP_CONFIRMED, $period->getStepHistories()->first()->getStep());
|
||||
|
||||
$period->setOpeningDate($aMonthAgo = new DateTime('1 month ago'));
|
||||
$period->setOpeningDate($aMonthAgo = new \DateTime('1 month ago'));
|
||||
|
||||
$this->assertCount(1, $period->getStepHistories());
|
||||
$this->assertEquals($aMonthAgo, $period->getStepHistories()->first()->getStartDate(), 'when changing the opening date, the start date of the first history should change');
|
||||
|
||||
$period->setOpeningDate($tenDaysAgo = new DateTime('10 days ago'));
|
||||
$period->setOpeningDate($tenDaysAgo = new \DateTime('10 days ago'));
|
||||
|
||||
$this->assertCount(1, $period->getStepHistories());
|
||||
$this->assertEquals($tenDaysAgo, $period->getStepHistories()->first()->getStartDate(), 'when changing the opening date, the start date of the first history should change');
|
||||
@@ -57,13 +54,13 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
||||
$period->setStep(AccompanyingPeriod::STEP_CLOSED);
|
||||
$this->assertCount(2, $period->getStepHistories());
|
||||
|
||||
$period->setOpeningDate($tomorrow = new DateTime('tomorrow'));
|
||||
$period->setOpeningDate($tomorrow = new \DateTime('tomorrow'));
|
||||
$this->assertEquals($tenDaysAgo, $period->getStepHistories()->first()->getStartDate(), 'when changing the opening date to a later one and no history after, start date should change');
|
||||
}
|
||||
|
||||
public function testClosingEqualOpening()
|
||||
{
|
||||
$datetime = new DateTime('now');
|
||||
$datetime = new \DateTime('now');
|
||||
|
||||
$period = new AccompanyingPeriod($datetime);
|
||||
$period->setClosingDate($datetime);
|
||||
@@ -73,8 +70,8 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testClosingIsAfterOpeningConsistency()
|
||||
{
|
||||
$datetime1 = new DateTime('now');
|
||||
$datetime2 = new DateTime('tomorrow');
|
||||
$datetime1 = new \DateTime('now');
|
||||
$datetime2 = new \DateTime('tomorrow');
|
||||
|
||||
$period = new AccompanyingPeriod($datetime1);
|
||||
$period->setClosingDate($datetime2);
|
||||
@@ -86,8 +83,8 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testClosingIsBeforeOpeningConsistency()
|
||||
{
|
||||
$datetime1 = new DateTime('tomorrow');
|
||||
$datetime2 = new DateTime('now');
|
||||
$datetime1 = new \DateTime('tomorrow');
|
||||
$datetime2 = new \DateTime('now');
|
||||
|
||||
$period = new AccompanyingPeriod($datetime1);
|
||||
$period->setClosingDate($datetime2);
|
||||
@@ -156,7 +153,7 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
usort($locations, static fn (AccompanyingPeriod\AccompanyingPeriodLocationHistory $a, AccompanyingPeriod\AccompanyingPeriodLocationHistory $b) => $a->getStartDate() <=> $b->getStartDate());
|
||||
|
||||
$iterator = new ArrayIterator($locations);
|
||||
$iterator = new \ArrayIterator($locations);
|
||||
$iterator->rewind();
|
||||
|
||||
do {
|
||||
@@ -174,7 +171,6 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
||||
} while ($iterator->valid());
|
||||
}
|
||||
|
||||
|
||||
public function testHistoryLocationNotHavingBothAtStart()
|
||||
{
|
||||
$period = new AccompanyingPeriod();
|
||||
@@ -197,15 +193,15 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testIsClosed()
|
||||
{
|
||||
$period = new AccompanyingPeriod(new DateTime());
|
||||
$period->setClosingDate(new DateTime('tomorrow'));
|
||||
$period = new AccompanyingPeriod(new \DateTime());
|
||||
$period->setClosingDate(new \DateTime('tomorrow'));
|
||||
|
||||
$this->assertFalse($period->isOpen());
|
||||
}
|
||||
|
||||
public function testIsOpen()
|
||||
{
|
||||
$period = new AccompanyingPeriod(new DateTime());
|
||||
$period = new AccompanyingPeriod(new \DateTime());
|
||||
|
||||
$this->assertTrue($period->isOpen());
|
||||
}
|
||||
@@ -215,7 +211,7 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
||||
$person = new Person();
|
||||
$person2 = new Person();
|
||||
$person3 = new Person();
|
||||
$period = new AccompanyingPeriod(new DateTime());
|
||||
$period = new AccompanyingPeriod(new \DateTime());
|
||||
|
||||
$participation0 = $period->createParticipationFor($person);
|
||||
$period->createParticipationFor($person2);
|
||||
@@ -238,7 +234,7 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
if ($participationL instanceof AccompanyingPeriodParticipation) {
|
||||
$this->assertSame($participationL, $participation);
|
||||
$this->assertTrue($participationL->getEndDate() instanceof DateTimeInterface);
|
||||
$this->assertTrue($participationL->getEndDate() instanceof \DateTimeInterface);
|
||||
}
|
||||
|
||||
$participation = $period->getOpenParticipationContainsPerson($person);
|
||||
@@ -260,7 +256,7 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testPinnedComment()
|
||||
{
|
||||
$period = new AccompanyingPeriod(new DateTime());
|
||||
$period = new AccompanyingPeriod(new \DateTime());
|
||||
$comment = new Comment();
|
||||
$replacingComment = new Comment();
|
||||
|
||||
@@ -271,14 +267,14 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$this->assertSame($period->getPinnedComment(), $comment);
|
||||
$this->assertNull($comment->getAccompanyingPeriod());
|
||||
$this->assertEquals(0, count($period->getComments()));
|
||||
$this->assertEquals(0, \count($period->getComments()));
|
||||
|
||||
$period->setPinnedComment($replacingComment);
|
||||
|
||||
$this->assertSame($period->getPinnedComment(), $replacingComment);
|
||||
$this->assertNull($replacingComment->getAccompanyingPeriod());
|
||||
$this->assertSame($period, $comment->getAccompanyingPeriod());
|
||||
$this->assertEquals(1, count($period->getComments()));
|
||||
$this->assertEquals(1, \count($period->getComments()));
|
||||
$this->assertContains($comment, $period->getComments());
|
||||
|
||||
$period->setPinnedComment(null);
|
||||
@@ -286,14 +282,14 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertNull($period->getPinnedComment());
|
||||
$this->assertSame($period, $comment->getAccompanyingPeriod());
|
||||
$this->assertSame($period, $replacingComment->getAccompanyingPeriod());
|
||||
$this->assertEquals(2, count($period->getComments()));
|
||||
$this->assertEquals(2, \count($period->getComments()));
|
||||
$this->assertContains($comment, $period->getComments());
|
||||
$this->assertContains($replacingComment, $period->getComments());
|
||||
}
|
||||
|
||||
public function testRequestor()
|
||||
{
|
||||
$period = new AccompanyingPeriod(new DateTime());
|
||||
$period = new AccompanyingPeriod(new \DateTime());
|
||||
$person = new Person();
|
||||
$thirdParty = new ThirdParty();
|
||||
|
||||
|
@@ -17,6 +17,7 @@ use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class HouseholdMemberTest extends TestCase
|
||||
|
@@ -16,12 +16,11 @@ use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdComposition;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class HouseholdTest extends TestCase
|
||||
@@ -31,38 +30,38 @@ final class HouseholdTest extends TestCase
|
||||
$household = new Household();
|
||||
|
||||
$household->addMember($householdMemberA = (new HouseholdMember())
|
||||
->setStartDate(new DateTimeImmutable('2020-01-01'))
|
||||
->setEndDate(new DateTimeImmutable('2020-12-31'))
|
||||
->setStartDate(new \DateTimeImmutable('2020-01-01'))
|
||||
->setEndDate(new \DateTimeImmutable('2020-12-31'))
|
||||
->setPerson(new Person()));
|
||||
$household->addMember($householdMemberB = (new HouseholdMember())
|
||||
->setStartDate(new DateTimeImmutable('2020-06-01'))
|
||||
->setEndDate(new DateTimeImmutable('2021-06-31'))
|
||||
->setStartDate(new \DateTimeImmutable('2020-06-01'))
|
||||
->setEndDate(new \DateTimeImmutable('2021-06-31'))
|
||||
->setPerson(new Person()));
|
||||
$household->addMember($householdMemberC = (new HouseholdMember())
|
||||
->setStartDate(new DateTimeImmutable('2021-01-01'))
|
||||
->setStartDate(new \DateTimeImmutable('2021-01-01'))
|
||||
->setEndDate(null)
|
||||
->setPerson(new Person()));
|
||||
|
||||
$members = $household->getMembersOnRange(new DateTimeImmutable('2019-01-01'), null);
|
||||
$members = $household->getMembersOnRange(new \DateTimeImmutable('2019-01-01'), null);
|
||||
|
||||
$this->assertCount(3, $members);
|
||||
$this->assertContains($householdMemberA, $members);
|
||||
$this->assertContains($householdMemberB, $members);
|
||||
$this->assertContains($householdMemberC, $members);
|
||||
|
||||
$members = $household->getMembersOnRange(new DateTimeImmutable('2020-01-01'), new DateTimeImmutable('2020-07-01'));
|
||||
$members = $household->getMembersOnRange(new \DateTimeImmutable('2020-01-01'), new \DateTimeImmutable('2020-07-01'));
|
||||
$this->assertCount(2, $members);
|
||||
$this->assertContains($householdMemberA, $members);
|
||||
$this->assertContains($householdMemberB, $members);
|
||||
$this->assertNotContains($householdMemberC, $members);
|
||||
|
||||
$members = $household->getMembersOnRange(new DateTimeImmutable('2020-01-01'), new DateTimeImmutable('2022-12-31'));
|
||||
$members = $household->getMembersOnRange(new \DateTimeImmutable('2020-01-01'), new \DateTimeImmutable('2022-12-31'));
|
||||
$this->assertCount(3, $members);
|
||||
$this->assertContains($householdMemberA, $members);
|
||||
$this->assertContains($householdMemberB, $members);
|
||||
$this->assertContains($householdMemberC, $members);
|
||||
|
||||
$members = $household->getMembersOnRange(new DateTimeImmutable('2021-01-01'), new DateTimeImmutable('2022-12-31'));
|
||||
$members = $household->getMembersOnRange(new \DateTimeImmutable('2021-01-01'), new \DateTimeImmutable('2022-12-31'));
|
||||
$this->assertCount(2, $members);
|
||||
$this->assertNotContains($householdMemberA, $members);
|
||||
$this->assertContains($householdMemberB, $members);
|
||||
@@ -74,16 +73,16 @@ final class HouseholdTest extends TestCase
|
||||
$household = new Household();
|
||||
|
||||
$lastAddress = new Address();
|
||||
$lastAddress->setValidFrom($yesterday = new DateTime('yesterday'));
|
||||
$lastAddress->setValidTo(new DateTime('tomorrow'));
|
||||
$lastAddress->setValidFrom($yesterday = new \DateTime('yesterday'));
|
||||
$lastAddress->setValidTo(new \DateTime('tomorrow'));
|
||||
$household->addAddress($lastAddress);
|
||||
|
||||
$this->assertNull($lastAddress->getValidTo());
|
||||
$this->assertEquals($yesterday, $lastAddress->getValidFrom());
|
||||
|
||||
$previousAddress = new Address();
|
||||
$previousAddress->setValidFrom($oneMonthAgo = new DateTime('1 month ago'));
|
||||
$previousAddress->setValidTo(new DateTime('now'));
|
||||
$previousAddress->setValidFrom($oneMonthAgo = new \DateTime('1 month ago'));
|
||||
$previousAddress->setValidTo(new \DateTime('now'));
|
||||
$household->addAddress($previousAddress);
|
||||
|
||||
$addresses = $household->getAddressesOrdered();
|
||||
@@ -96,8 +95,8 @@ final class HouseholdTest extends TestCase
|
||||
$this->assertNull($lastAddress->getValidTo());
|
||||
|
||||
$futureAddress = new Address();
|
||||
$futureAddress->setValidFrom($tomorrow = new DateTime('tomorrow'));
|
||||
$futureAddress->setValidTo(new DateTime('2150-01-01'));
|
||||
$futureAddress->setValidFrom($tomorrow = new \DateTime('tomorrow'));
|
||||
$futureAddress->setValidTo(new \DateTime('2150-01-01'));
|
||||
$household->addAddress($futureAddress);
|
||||
|
||||
$addresses = $household->getAddressesOrdered();
|
||||
@@ -118,22 +117,22 @@ final class HouseholdTest extends TestCase
|
||||
$household = new Household();
|
||||
|
||||
$household->addComposition(($first = new HouseholdComposition())
|
||||
->setStartDate(new DateTimeImmutable('2021-12-01')));
|
||||
->setStartDate(new \DateTimeImmutable('2021-12-01')));
|
||||
|
||||
$this->assertNull($first->getEndDate());
|
||||
|
||||
$household->addComposition(($second = new HouseholdComposition())
|
||||
->setStartDate(new DateTimeImmutable('2021-12-31')));
|
||||
->setStartDate(new \DateTimeImmutable('2021-12-31')));
|
||||
|
||||
$this->assertEquals(new DateTimeImmutable('2021-12-31'), $first->getEndDate());
|
||||
$this->assertEquals(new DateTimeImmutable('2021-12-31'), $second->getStartDate());
|
||||
$this->assertEquals(new \DateTimeImmutable('2021-12-31'), $first->getEndDate());
|
||||
$this->assertEquals(new \DateTimeImmutable('2021-12-31'), $second->getStartDate());
|
||||
|
||||
$household->addComposition(($inside = new HouseholdComposition())
|
||||
->setStartDate(new DateTimeImmutable('2021-12-15')));
|
||||
->setStartDate(new \DateTimeImmutable('2021-12-15')));
|
||||
|
||||
$this->assertEquals(new DateTimeImmutable('2021-12-15'), $first->getEndDate());
|
||||
$this->assertEquals(new DateTimeImmutable('2021-12-31'), $second->getStartDate());
|
||||
$this->assertEquals(new DateTimeImmutable('2021-12-31'), $inside->getEndDate());
|
||||
$this->assertEquals(new \DateTimeImmutable('2021-12-15'), $first->getEndDate());
|
||||
$this->assertEquals(new \DateTimeImmutable('2021-12-31'), $second->getStartDate());
|
||||
$this->assertEquals(new \DateTimeImmutable('2021-12-31'), $inside->getEndDate());
|
||||
}
|
||||
|
||||
public function testHouseholdGetPersonsDuringMembership()
|
||||
@@ -145,29 +144,29 @@ final class HouseholdTest extends TestCase
|
||||
|
||||
$household->addMember(
|
||||
$member1 = (new HouseholdMember())
|
||||
->setStartDate(new DateTimeImmutable('2021-01-01'))
|
||||
->setEndDate(new DateTimeImmutable('2021-12-01'))
|
||||
->setStartDate(new \DateTimeImmutable('2021-01-01'))
|
||||
->setEndDate(new \DateTimeImmutable('2021-12-01'))
|
||||
->setPerson($person1)
|
||||
);
|
||||
|
||||
$household->addMember(
|
||||
$member2a = (new HouseholdMember())
|
||||
->setStartDate(new DateTimeImmutable('2021-01-01'))
|
||||
->setEndDate(new DateTimeImmutable('2021-05-01'))
|
||||
->setStartDate(new \DateTimeImmutable('2021-01-01'))
|
||||
->setEndDate(new \DateTimeImmutable('2021-05-01'))
|
||||
->setPerson($person2)
|
||||
);
|
||||
|
||||
$household->addMember(
|
||||
$member2b = (new HouseholdMember())
|
||||
->setStartDate(new DateTimeImmutable('2021-11-01'))
|
||||
->setEndDate(new DateTimeImmutable('2022-06-01'))
|
||||
->setStartDate(new \DateTimeImmutable('2021-11-01'))
|
||||
->setEndDate(new \DateTimeImmutable('2022-06-01'))
|
||||
->setPerson($person2)
|
||||
);
|
||||
|
||||
$household->addMember(
|
||||
$memberOut = (new HouseholdMember())
|
||||
->setStartDate(new DateTimeImmutable('2019-01-01'))
|
||||
->setEndDate(new DateTimeImmutable('2019-12-01'))
|
||||
->setStartDate(new \DateTimeImmutable('2019-01-01'))
|
||||
->setEndDate(new \DateTimeImmutable('2019-12-01'))
|
||||
->setPerson($personOut)
|
||||
);
|
||||
|
||||
|
@@ -17,13 +17,12 @@ use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Chill\PersonBundle\Entity\Household\Position;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* Unit tests for the person Entity.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
@@ -34,18 +33,18 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testAccompanyingPeriodOrderSameDateOpening()
|
||||
{
|
||||
$d = new DateTime('2013/2/1');
|
||||
$d = new \DateTime('2013/2/1');
|
||||
$p = new Person();
|
||||
$p->addAccompanyingPeriod(new AccompanyingPeriod($d));
|
||||
|
||||
$g = new DateTime('2013/4/1');
|
||||
$g = new \DateTime('2013/4/1');
|
||||
$period = $p->getCurrentAccompanyingPeriod()->setClosingDate($g);
|
||||
$p->close($period);
|
||||
|
||||
$f = new DateTime('2013/2/1');
|
||||
$f = new \DateTime('2013/2/1');
|
||||
$p->open(new AccompanyingPeriod($f));
|
||||
|
||||
$e = new DateTime('2013/3/1');
|
||||
$e = new \DateTime('2013/3/1');
|
||||
$period = $p->getCurrentAccompanyingPeriod()->setClosingDate($e);
|
||||
$p->close($period);
|
||||
|
||||
@@ -62,18 +61,18 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testAccompanyingPeriodOrderWithUnorderedAccompanyingPeriod()
|
||||
{
|
||||
$d = new DateTime('2013/2/1');
|
||||
$d = new \DateTime('2013/2/1');
|
||||
$p = new Person();
|
||||
$p->addAccompanyingPeriod(new AccompanyingPeriod($d));
|
||||
|
||||
$e = new DateTime('2013/3/1');
|
||||
$e = new \DateTime('2013/3/1');
|
||||
$period = $p->getCurrentAccompanyingPeriod()->setClosingDate($e);
|
||||
$p->close($period);
|
||||
|
||||
$f = new DateTime('2013/1/1');
|
||||
$f = new \DateTime('2013/1/1');
|
||||
$p->open(new AccompanyingPeriod($f));
|
||||
|
||||
$g = new DateTime('2013/4/1');
|
||||
$g = new \DateTime('2013/4/1');
|
||||
$period = $p->getCurrentAccompanyingPeriod()->setClosingDate($g);
|
||||
$p->close($period);
|
||||
|
||||
@@ -91,18 +90,18 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testDateCoveringWithCoveringAccompanyingPeriod()
|
||||
{
|
||||
$d = new DateTime('2013/2/1');
|
||||
$d = new \DateTime('2013/2/1');
|
||||
$p = new Person();
|
||||
$p->addAccompanyingPeriod(new AccompanyingPeriod($d));
|
||||
|
||||
$e = new DateTime('2013/3/1');
|
||||
$e = new \DateTime('2013/3/1');
|
||||
$period = $p->getCurrentAccompanyingPeriod()->setClosingDate($e);
|
||||
$p->close($period);
|
||||
|
||||
$f = new DateTime('2013/1/1');
|
||||
$f = new \DateTime('2013/1/1');
|
||||
$p->open(new AccompanyingPeriod($f));
|
||||
|
||||
$g = new DateTime('2013/4/1');
|
||||
$g = new \DateTime('2013/4/1');
|
||||
$period = $p->getCurrentAccompanyingPeriod()->setClosingDate($g);
|
||||
$p->close($period);
|
||||
|
||||
@@ -118,7 +117,7 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testGetCurrentAccompanyingPeriod()
|
||||
{
|
||||
$d = new DateTime('yesterday');
|
||||
$d = new \DateTime('yesterday');
|
||||
$p = new Person();
|
||||
$p->addAccompanyingPeriod(new AccompanyingPeriod($d));
|
||||
|
||||
@@ -128,8 +127,8 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertTrue($period->isOpen());
|
||||
$this->assertEquals($d, $period->getOpeningDate());
|
||||
|
||||
//close and test
|
||||
$period->setClosingDate(new DateTime('tomorrow'));
|
||||
// close and test
|
||||
$period->setClosingDate(new \DateTime('tomorrow'));
|
||||
|
||||
$shouldBeNull = $p->getCurrentAccompanyingPeriod();
|
||||
$this->assertNull($shouldBeNull);
|
||||
@@ -145,15 +144,15 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
->setShareHousehold(false);
|
||||
|
||||
$membership1 = (new HouseholdMember())
|
||||
->setStartDate(new DateTimeImmutable('10 years ago'))
|
||||
->setEndDate(new DateTimeImmutable('5 years ago'))
|
||||
->setStartDate(new \DateTimeImmutable('10 years ago'))
|
||||
->setEndDate(new \DateTimeImmutable('5 years ago'))
|
||||
->setPerson($person)
|
||||
->setPosition($positionShare);
|
||||
$household->addMember($membership1);
|
||||
|
||||
$membership2 = (new HouseholdMember())
|
||||
->setStartDate(new DateTimeImmutable('4 years ago'))
|
||||
->setEndDate(new DateTimeImmutable('2 years ago'))
|
||||
->setStartDate(new \DateTimeImmutable('4 years ago'))
|
||||
->setEndDate(new \DateTimeImmutable('2 years ago'))
|
||||
->setPerson($person)
|
||||
->setPosition($positionNotShare);
|
||||
$household->addMember($membership2);
|
||||
@@ -163,10 +162,10 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$this->assertFalse($person->isSharingHousehold());
|
||||
$this->assertTrue($person->isSharingHousehold(
|
||||
new DateTimeImmutable('6 years ago')
|
||||
new \DateTimeImmutable('6 years ago')
|
||||
));
|
||||
$this->assertFalse($person->isSharingHousehold(
|
||||
new DateTimeImmutable('3 years ago')
|
||||
new \DateTimeImmutable('3 years ago')
|
||||
));
|
||||
}
|
||||
|
||||
@@ -177,15 +176,15 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testNotOpenAFileReOpenedLater()
|
||||
{
|
||||
$d = new DateTime('2013/2/1');
|
||||
$d = new \DateTime('2013/2/1');
|
||||
$p = new Person();
|
||||
$p->addAccompanyingPeriod(new AccompanyingPeriod($d));
|
||||
|
||||
$e = new DateTime('2013/3/1');
|
||||
$e = new \DateTime('2013/3/1');
|
||||
$period = $p->getCurrentAccompanyingPeriod()->setClosingDate($e);
|
||||
$p->close($period);
|
||||
|
||||
$f = new DateTime('2013/1/1');
|
||||
$f = new \DateTime('2013/1/1');
|
||||
$p->open(new AccompanyingPeriod($f));
|
||||
|
||||
$r = $p->checkAccompanyingPeriodsAreNotCollapsing();
|
||||
|
@@ -16,6 +16,7 @@ use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class SocialActionTest extends TestCase
|
||||
|
@@ -17,6 +17,7 @@ use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class SocialIssueTest extends TestCase
|
||||
|
@@ -16,12 +16,11 @@ use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Event\Person\PersonAddressMoveEvent;
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class PersonAddressMoveEventTest extends TestCase
|
||||
@@ -31,17 +30,17 @@ final class PersonAddressMoveEventTest extends TestCase
|
||||
$person = new Person();
|
||||
|
||||
$household = (new Household())->addAddress(
|
||||
($previousAddress = new Address())->setValidFrom(new DateTime('1 year ago'))
|
||||
($previousAddress = new Address())->setValidFrom(new \DateTime('1 year ago'))
|
||||
);
|
||||
$household->addAddress(
|
||||
($nextAddress = new Address())->setValidFrom(new DateTime('1 month ago'))
|
||||
($nextAddress = new Address())->setValidFrom(new \DateTime('1 month ago'))
|
||||
);
|
||||
$member = new HouseholdMember();
|
||||
$member
|
||||
->setPerson($person)
|
||||
->setHousehold($household)
|
||||
->setStartDate(new DateTimeImmutable('1 year ago'))
|
||||
->setEndDate(new DateTimeImmutable('tomorrow'));
|
||||
->setStartDate(new \DateTimeImmutable('1 year ago'))
|
||||
->setEndDate(new \DateTimeImmutable('tomorrow'));
|
||||
|
||||
$event = new PersonAddressMoveEvent($person);
|
||||
$event
|
||||
@@ -50,8 +49,8 @@ final class PersonAddressMoveEventTest extends TestCase
|
||||
|
||||
$this->assertSame($previousAddress, $event->getPreviousAddress());
|
||||
$this->assertSame($nextAddress, $event->getNextAddress());
|
||||
$this->assertEquals((new DateTime('1 month ago'))->format('Y-m-d'), $nextAddress->getValidFrom()->format('Y-m-d'));
|
||||
$this->assertEquals((new DateTime('1 month ago'))->format('Y-m-d'), $event->getMoveDate()->format('Y-m-d'));
|
||||
$this->assertEquals((new \DateTime('1 month ago'))->format('Y-m-d'), $nextAddress->getValidFrom()->format('Y-m-d'));
|
||||
$this->assertEquals((new \DateTime('1 month ago'))->format('Y-m-d'), $event->getMoveDate()->format('Y-m-d'));
|
||||
}
|
||||
|
||||
public function testPersonChangeHousehold()
|
||||
@@ -59,23 +58,23 @@ final class PersonAddressMoveEventTest extends TestCase
|
||||
$person = new Person();
|
||||
|
||||
$previousHousehold = (new Household())->addAddress(
|
||||
($previousAddress = new Address())->setValidFrom(new DateTime('1 year ago'))
|
||||
($previousAddress = new Address())->setValidFrom(new \DateTime('1 year ago'))
|
||||
);
|
||||
$previousMembership = new HouseholdMember();
|
||||
$previousMembership
|
||||
->setPerson($person)
|
||||
->setHousehold($previousHousehold)
|
||||
->setStartDate(new DateTimeImmutable('1 year ago'))
|
||||
->setEndDate(new DateTimeImmutable('tomorrow'));
|
||||
->setStartDate(new \DateTimeImmutable('1 year ago'))
|
||||
->setEndDate(new \DateTimeImmutable('tomorrow'));
|
||||
|
||||
$nextHousehold = (new Household())->addAddress(
|
||||
($nextAddress = new Address())->setValidFrom(new DateTime('tomorrow'))
|
||||
($nextAddress = new Address())->setValidFrom(new \DateTime('tomorrow'))
|
||||
);
|
||||
$nextMembership = new HouseholdMember();
|
||||
$nextMembership
|
||||
->setPerson($person)
|
||||
->setHousehold($nextHousehold)
|
||||
->setStartDate(new DateTimeImmutable('tomorrow'));
|
||||
->setStartDate(new \DateTimeImmutable('tomorrow'));
|
||||
|
||||
$event = new PersonAddressMoveEvent($person);
|
||||
$event
|
||||
@@ -87,7 +86,7 @@ final class PersonAddressMoveEventTest extends TestCase
|
||||
$this->assertSame($nextAddress, $event->getNextAddress());
|
||||
$this->assertTrue($event->personChangeAddress());
|
||||
$this->assertFalse($event->personLeaveWithoutHousehold());
|
||||
$this->assertEquals(new DateTimeImmutable('tomorrow'), $event->getMoveDate());
|
||||
$this->assertEquals(new \DateTimeImmutable('tomorrow'), $event->getMoveDate());
|
||||
}
|
||||
|
||||
public function testPersonLeaveHousehold()
|
||||
@@ -95,14 +94,14 @@ final class PersonAddressMoveEventTest extends TestCase
|
||||
$person = new Person();
|
||||
|
||||
$previousHousehold = (new Household())->addAddress(
|
||||
($previousAddress = new Address())->setValidFrom(new DateTime('1 year ago'))
|
||||
($previousAddress = new Address())->setValidFrom(new \DateTime('1 year ago'))
|
||||
);
|
||||
$previousMembership = new HouseholdMember();
|
||||
$previousMembership
|
||||
->setPerson($person)
|
||||
->setHousehold($previousHousehold)
|
||||
->setStartDate(new DateTimeImmutable('1 year ago'))
|
||||
->setEndDate(new DateTimeImmutable('tomorrow'));
|
||||
->setStartDate(new \DateTimeImmutable('1 year ago'))
|
||||
->setEndDate(new \DateTimeImmutable('tomorrow'));
|
||||
|
||||
$event = new PersonAddressMoveEvent($person);
|
||||
$event
|
||||
@@ -113,6 +112,6 @@ final class PersonAddressMoveEventTest extends TestCase
|
||||
$this->assertNull($event->getNextAddress());
|
||||
$this->assertTrue($event->personChangeAddress());
|
||||
$this->assertTrue($event->personLeaveWithoutHousehold());
|
||||
$this->assertEquals(new DateTimeImmutable('tomorrow'), $event->getMoveDate());
|
||||
$this->assertEquals(new \DateTimeImmutable('tomorrow'), $event->getMoveDate());
|
||||
}
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@ use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class PersonCreateEventTest extends TestCase
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AdministrativeLocationAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -52,7 +53,7 @@ final class AdministrativeLocationAggregatorTest extends AbstractAggregatorTest
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->from(AccompanyingPeriod::class, 'acp'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ClosingMotiveAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -52,7 +53,7 @@ final class ClosingMotiveAggregatorTest extends AbstractAggregatorTest
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->from(AccompanyingPeriod::class, 'acp'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ConfidentialAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class DurationAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class EmergencyAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class EvaluationAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -16,11 +16,11 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\GeographicalUnitStatAggregator;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class GeographicalUnitStatAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -46,7 +46,7 @@ final class GeographicalUnitStatAggregatorTest extends AbstractAggregatorTest
|
||||
$levels = $repository->findAll();
|
||||
|
||||
return [
|
||||
['date_calc' => new RollingDate(RollingDate::T_TODAY), 'level' => $levels]
|
||||
['date_calc' => new RollingDate(RollingDate::T_TODAY), 'level' => $levels],
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class IntensityAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class OriginAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -15,11 +15,11 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ReferrerAggregator;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ReferrerAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -41,7 +41,7 @@ final class ReferrerAggregatorTest extends AbstractAggregatorTest
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
['date_calc' => new RollingDate(RollingDate::T_TODAY)]
|
||||
['date_calc' => new RollingDate(RollingDate::T_TODAY)],
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -19,13 +19,13 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ReferrerScopeAggregator;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Prophecy\Argument;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ReferrerScopeAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -43,7 +43,7 @@ final class ReferrerScopeAggregatorTest extends AbstractAggregatorTest
|
||||
);
|
||||
|
||||
$dateConverter = $this->prophesize(RollingDateConverterInterface::class);
|
||||
$dateConverter->convert(Argument::type(RollingDate::class))->willReturn(new DateTimeImmutable());
|
||||
$dateConverter->convert(Argument::type(RollingDate::class))->willReturn(new \DateTimeImmutable());
|
||||
|
||||
return new ReferrerScopeAggregator(
|
||||
$scopeRepository->reveal(),
|
||||
@@ -56,7 +56,7 @@ final class ReferrerScopeAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
return [
|
||||
[
|
||||
'date_calc' => new RollingDate(RollingDate::T_TODAY)
|
||||
'date_calc' => new RollingDate(RollingDate::T_TODAY),
|
||||
],
|
||||
];
|
||||
}
|
||||
@@ -70,7 +70,7 @@ final class ReferrerScopeAggregatorTest extends AbstractAggregatorTest
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->from(AccompanyingPeriod::class, 'acp'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class RequestorAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ScopeAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -56,7 +57,7 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest
|
||||
->join('acp.scopes', 'acpscope'),
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->from(AccompanyingPeriod::class, 'acp'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class SocialActionAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class SocialIssueAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -15,11 +15,11 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\StepAggregator;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class StepAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -42,7 +42,7 @@ final class StepAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
return [
|
||||
[
|
||||
'on_date' => new RollingDate(RollingDate::T_TODAY)
|
||||
'on_date' => new RollingDate(RollingDate::T_TODAY),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class UserJobAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -59,7 +60,7 @@ final class UserJobAggregatorTest extends AbstractAggregatorTest
|
||||
->join('acp.job', 'acpjob'),
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->from(AccompanyingPeriod::class, 'acp'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class EvaluationTypeAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -15,11 +15,11 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Aggregator\HouseholdAggregators\ChildrenNumberAggregator;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ChildrenNumberAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -42,7 +42,7 @@ final class ChildrenNumberAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
return [
|
||||
[
|
||||
'on_date' => new RollingDate(RollingDate::T_TODAY)
|
||||
'on_date' => new RollingDate(RollingDate::T_TODAY),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@@ -15,11 +15,11 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Aggregator\HouseholdAggregators\CompositionAggregator;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class CompositionAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -42,7 +42,7 @@ final class CompositionAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
return [
|
||||
[
|
||||
'on_date' => new RollingDate(RollingDate::T_TODAY)
|
||||
'on_date' => new RollingDate(RollingDate::T_TODAY),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@@ -15,11 +15,11 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Aggregator\PersonAggregators\AgeAggregator;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AgeAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -42,7 +42,7 @@ final class AgeAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
return [
|
||||
[
|
||||
'date_age_calculation' => new RollingDate(RollingDate::T_TODAY)
|
||||
'date_age_calculation' => new RollingDate(RollingDate::T_TODAY),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class CountryOfBirthAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class GenderAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -16,12 +16,12 @@ use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Aggregator\PersonAggregators\HouseholdPositionAggregator;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class HouseholdPositionAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -44,7 +44,7 @@ final class HouseholdPositionAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
return [
|
||||
[
|
||||
'date_position' => new RollingDate(RollingDate::T_TODAY)
|
||||
'date_position' => new RollingDate(RollingDate::T_TODAY),
|
||||
],
|
||||
];
|
||||
}
|
||||
@@ -62,7 +62,7 @@ final class HouseholdPositionAggregatorTest extends AbstractAggregatorTest
|
||||
->join(HouseholdMember::class, 'householdmember', Expr\Join::WITH, 'householdmember.person = person'),
|
||||
$em->createQueryBuilder()
|
||||
->select('count(person.id)')
|
||||
->from(Person::class, 'person')
|
||||
->from(Person::class, 'person'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class MaritalStatusAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -56,7 +57,7 @@ final class MaritalStatusAggregatorTest extends AbstractAggregatorTest
|
||||
->join('person.maritalStatus', 'personmarital'),
|
||||
$em->createQueryBuilder()
|
||||
->select('count(person.id)')
|
||||
->from(Person::class, 'person')
|
||||
->from(Person::class, 'person'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class NationalityAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActionTypeAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class GoalAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class GoalResultAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -60,7 +61,7 @@ final class GoalResultAggregatorTest extends AbstractAggregatorTest
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.works', 'acpw')
|
||||
->join('acpw.goals', 'goal')
|
||||
->join('acpw.goals', 'goal'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators;
|
||||
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\JobAggregator;
|
||||
@@ -19,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class JobAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -54,7 +54,7 @@ final class JobAggregatorTest extends AbstractAggregatorTest
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.works', 'acpw')
|
||||
->join('acp.works', 'acpw'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ReferrerAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -42,8 +43,8 @@ final class ReferrerAggregatorTest extends AbstractAggregatorTest
|
||||
return [
|
||||
[], // there are previous saved export which does not contains any data
|
||||
[
|
||||
'referrer_at' => new RollingDate(RollingDate::T_TODAY)
|
||||
]
|
||||
'referrer_at' => new RollingDate(RollingDate::T_TODAY),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ResultAggregatorTest extends AbstractAggregatorTest
|
||||
|
@@ -11,7 +11,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators;
|
||||
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ScopeAggregator;
|
||||
@@ -19,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ScopeAggregatorTest extends AbstractAggregatorTest
|
||||
@@ -54,7 +54,7 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acp.id)')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.works', 'acpw')
|
||||
->join('acp.works', 'acpw'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ use Chill\PersonBundle\Export\Export\CountAccompanyingCourse;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class CountAccompanyingCourseTest extends AbstractExportTest
|
||||
|
@@ -17,6 +17,7 @@ use Chill\PersonBundle\Export\Export\CountAccompanyingPeriodWork;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class CountAccompanyingPeriodWorkTest extends AbstractExportTest
|
||||
|
@@ -18,13 +18,11 @@ use Chill\PersonBundle\Export\Export\CountPerson;
|
||||
* Test CountPerson export.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class CountPersonTest extends AbstractExportTest
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
private ?object $export = null;
|
||||
|
||||
protected function setUp(): void
|
||||
|
@@ -12,7 +12,6 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Export;
|
||||
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Export\Formatter\SpreadsheetListFormatter;
|
||||
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\PersonBundle\Export\Export\ListAccompanyingPeriod;
|
||||
@@ -21,6 +20,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
class ListAccompanyingPeriodTest extends KernelTestCase
|
||||
@@ -42,7 +42,7 @@ class ListAccompanyingPeriodTest extends KernelTestCase
|
||||
{
|
||||
$centers = $this->centerRepository->findAll();
|
||||
|
||||
$query = $this->listAccompanyingPeriod->initiateQuery([], array_map(fn (Center $c) => ['center' => $c ], $centers), $exportOpts = ['calc_date' => new RollingDate(RollingDate::T_TODAY)]);
|
||||
$query = $this->listAccompanyingPeriod->initiateQuery([], array_map(fn (Center $c) => ['center' => $c], $centers), $exportOpts = ['calc_date' => new RollingDate(RollingDate::T_TODAY)]);
|
||||
|
||||
$query->setMaxResults(1);
|
||||
|
||||
|
@@ -20,6 +20,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
class ListAccompanyingPeriodWorkTest extends KernelTestCase
|
||||
|
@@ -20,6 +20,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
class ListEvaluationTest extends KernelTestCase
|
||||
|
@@ -11,16 +11,15 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Export;
|
||||
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||
use Chill\PersonBundle\Export\Export\ListPerson;
|
||||
use DateTime;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
|
||||
/**
|
||||
* Test the export "ListPerson".
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ListPersonTest extends AbstractExportTest
|
||||
@@ -58,7 +57,7 @@ final class ListPersonTest extends AbstractExportTest
|
||||
['fields' => ['id', 'nationality']],
|
||||
['fields' => ['id', 'countryOfBirth']],
|
||||
] as $base) {
|
||||
yield [...$base, 'address_date' => new \DateTimeImmutable('today') ];
|
||||
yield [...$base, 'address_date' => new \DateTimeImmutable('today')];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -14,10 +14,10 @@ namespace Export\Export;
|
||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Export\Export\StatAccompanyingCourseDuration;
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class StatAccompanyingCourseDurationTest extends AbstractExportTest
|
||||
@@ -39,7 +39,7 @@ final class StatAccompanyingCourseDurationTest extends AbstractExportTest
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
['closingdate' => DateTime::createFromFormat('Y-m-d', '2022-06-30')],
|
||||
['closingdate' => \DateTime::createFromFormat('Y-m-d', '2022-06-30')],
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -15,11 +15,11 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ActiveOnDateFilter;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActiveOnDateFilterTest extends AbstractFilterTest
|
||||
|
@@ -15,11 +15,11 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ActiveOneDayBetweenDatesFilter;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ActiveOneDayBetweenDatesFilterTest extends AbstractFilterTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AdministrativeLocationFilterTest extends AbstractFilterTest
|
||||
|
@@ -19,6 +19,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ClosingMotiveFilterTest extends AbstractFilterTest
|
||||
|
@@ -17,6 +17,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ConfidentialFilterTest extends AbstractFilterTest
|
||||
|
@@ -17,6 +17,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class EmergencyFilterTest extends AbstractFilterTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class EvaluationFilterTest extends AbstractFilterTest
|
||||
|
@@ -11,17 +11,16 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
use Chill\MainBundle\Entity\GeographicalUnit;
|
||||
use Chill\MainBundle\Repository\GeographicalUnitRepositoryInterface;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\GeographicalUnitStatFilter;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class GeographicalUnitStatFilterTest extends AbstractFilterTest
|
||||
@@ -50,7 +49,7 @@ final class GeographicalUnitStatFilterTest extends AbstractFilterTest
|
||||
return [
|
||||
[
|
||||
'date_calc' => new RollingDate(RollingDate::T_TODAY),
|
||||
'units' => $units
|
||||
'units' => $units,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class IntensityFilterTest extends AbstractFilterTest
|
||||
|
@@ -15,11 +15,11 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\OpenBetweenDatesFilter;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class OpenBetweenDatesFilterTest extends AbstractFilterTest
|
||||
|
@@ -19,6 +19,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class OriginFilterTest extends AbstractFilterTest
|
||||
|
@@ -15,13 +15,12 @@ use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||
use Chill\PersonBundle\Export\Export\CountAccompanyingPeriodWork;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ReferrerFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ReferrerFilterTest extends AbstractFilterTest
|
||||
@@ -82,6 +81,5 @@ final class ReferrerFilterTest extends AbstractFilterTest
|
||||
$qb->select('COUNT(DISTINCT acpw.id) as export_result');
|
||||
|
||||
yield $qb;
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class RequestorFilterTest extends AbstractFilterTest
|
||||
|
@@ -19,6 +19,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class SocialActionFilterTest extends AbstractFilterTest
|
||||
|
@@ -20,6 +20,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class SocialIssueFilterTest extends AbstractFilterTest
|
||||
|
@@ -19,6 +19,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class StepFilterTest extends AbstractFilterTest
|
||||
@@ -46,7 +47,7 @@ final class StepFilterTest extends AbstractFilterTest
|
||||
['accepted_steps_multi' => [AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_SHORT]],
|
||||
['accepted_steps_multi' => [AccompanyingPeriod::STEP_CLOSED]],
|
||||
] as $d) {
|
||||
yield ['calc_date' => new RollingDate(RollingDate::T_TODAY), ...$d] ;
|
||||
yield ['calc_date' => new RollingDate(RollingDate::T_TODAY), ...$d];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -21,6 +21,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class UserJobFilterTest extends AbstractFilterTest
|
||||
@@ -43,13 +44,13 @@ final class UserJobFilterTest extends AbstractFilterTest
|
||||
{
|
||||
self::bootKernel();
|
||||
$jobs = self::$container->get(EntityManagerInterface::class)
|
||||
->createQuery('SELECT j FROM ' . UserJob::class . ' j')
|
||||
->createQuery('SELECT j FROM '.UserJob::class.' j')
|
||||
->setMaxResults(1)
|
||||
->getResult();
|
||||
|
||||
yield [
|
||||
'jobs' => new ArrayCollection($jobs),
|
||||
'date_calc' => new RollingDate(RollingDate::T_TODAY)
|
||||
'date_calc' => new RollingDate(RollingDate::T_TODAY),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -21,6 +21,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class UserScopeFilterTest extends AbstractFilterTest
|
||||
@@ -43,7 +44,7 @@ final class UserScopeFilterTest extends AbstractFilterTest
|
||||
{
|
||||
self::bootKernel();
|
||||
$scopes = self::$container->get(EntityManagerInterface::class)
|
||||
->createQuery('SELECT s FROM ' . Scope::class . ' s')
|
||||
->createQuery('SELECT s FROM '.Scope::class.' s')
|
||||
->setMaxResults(1)
|
||||
->getResult();
|
||||
|
||||
@@ -51,7 +52,7 @@ final class UserScopeFilterTest extends AbstractFilterTest
|
||||
[
|
||||
'date_calc' => new RollingDate(RollingDate::T_TODAY),
|
||||
'scopes' => new ArrayCollection($scopes),
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -19,6 +19,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class EvaluationTypeFilterTest extends AbstractFilterTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class MaxDateFilterTest extends AbstractFilterTest
|
||||
|
@@ -16,11 +16,11 @@ use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdCompositionType;
|
||||
use Chill\PersonBundle\Export\Filter\HouseholdFilters\CompositionFilter;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class CompositionFilterTest extends AbstractFilterTest
|
||||
@@ -77,7 +77,7 @@ final class CompositionFilterTest extends AbstractFilterTest
|
||||
->join('acppart.accompanyingPeriod', 'acp')
|
||||
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
|
||||
->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)')
|
||||
->setParameter('count_household_at_date', new DateTimeImmutable('today'));
|
||||
->setParameter('count_household_at_date', new \DateTimeImmutable('today'));
|
||||
|
||||
$qb
|
||||
->select('COUNT(DISTINCT household.id) AS household_export_result')
|
||||
|
@@ -15,11 +15,11 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Filter\PersonFilters\AgeFilter;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AgeFilterTest extends AbstractFilterTest
|
||||
|
@@ -15,11 +15,11 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Filter\PersonFilters\BirthdateFilter;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class BirthdateFilterTest extends AbstractFilterTest
|
||||
|
@@ -15,11 +15,11 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Filter\PersonFilters\DeadOrAliveFilter;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class DeadOrAliveFilterTest extends AbstractFilterTest
|
||||
|
@@ -15,11 +15,11 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Filter\PersonFilters\DeathdateFilter;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class DeathdateFilterTest extends AbstractFilterTest
|
||||
|
@@ -18,6 +18,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class GenderFilterTest extends AbstractFilterTest
|
||||
@@ -61,7 +62,7 @@ final class GenderFilterTest extends AbstractFilterTest
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('person.firstName')
|
||||
->from(Person::class, 'person')
|
||||
->from(Person::class, 'person'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user