mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
fix tests implementing AbstractFilterTest
This commit is contained in:
@@ -79,7 +79,7 @@ class ReferrerFilter implements FilterInterface
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return ['date_calc' => new RollingDate(RollingDate::T_TODAY)];
|
||||
return ['date_calc' => new RollingDate(RollingDate::T_TODAY), 'accepted_referrers' => []];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
|
@@ -11,7 +11,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
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;
|
||||
@@ -40,22 +42,20 @@ final class ActiveOnDateFilterTest extends AbstractFilterTest
|
||||
{
|
||||
return [
|
||||
[
|
||||
'on_date' => DateTime::createFromFormat('Y-m-d', '2022-05-01'),
|
||||
'on_date' => new RollingDate(RollingDate::T_FIXED_DATE, \DateTimeImmutable::createFromFormat('Y-m-d', '2022-05-01')),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->from('ChillPersonBundle:AccompanyingPeriod', 'acp')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->select('acp.id'),
|
||||
];
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
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;
|
||||
@@ -40,24 +42,22 @@ final class ActiveOneDayBetweenDatesFilterTest extends AbstractFilterTest
|
||||
{
|
||||
return [
|
||||
[
|
||||
'date_from' => DateTime::createFromFormat('Y-m-d', '2022-05-01'),
|
||||
'date_to' => DateTime::createFromFormat('Y-m-d', '2022-06-01'),
|
||||
'date_from' => new RollingDate(RollingDate::T_FIXED_DATE, \DateTimeImmutable::createFromFormat('Y-m-d', '2022-05-01')),
|
||||
'date_to' => new RollingDate(RollingDate::T_FIXED_DATE, \DateTimeImmutable::createFromFormat('Y-m-d', '2022-06-01')),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->from('ChillPersonBundle:AccompanyingPeriod', 'acp')
|
||||
->select('acp.id'),
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->select('count(distinct acp)'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -38,12 +38,14 @@ final class AdministrativeLocationFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$array = $em->createQueryBuilder()
|
||||
->from(Location::class, 'l')
|
||||
->select('l')
|
||||
->getQuery()
|
||||
->setMaxResults(1)
|
||||
->getResult();
|
||||
|
||||
$data = [];
|
||||
@@ -57,9 +59,7 @@ final class AdministrativeLocationFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ClosingMotiveFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -38,6 +39,7 @@ final class ClosingMotiveFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$array = $em->createQueryBuilder()
|
||||
@@ -57,16 +59,14 @@ final class ClosingMotiveFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('acp.id')
|
||||
->from('ChillPersonBundle:AccompanyingPeriod', 'acp'),
|
||||
->from(AccompanyingPeriod::class, 'acp'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -45,9 +45,7 @@ final class ConfidentialFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
|
@@ -38,16 +38,14 @@ final class EmergencyFilterTest extends AbstractFilterTest
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [
|
||||
['accepted_emergencies' => true],
|
||||
['accepted_emergencies' => false],
|
||||
['accepted_emergency' => true],
|
||||
['accepted_emergency' => false],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
|
@@ -38,12 +38,14 @@ final class EvaluationFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$array = $em->createQueryBuilder()
|
||||
->from(Evaluation::class, 'ev')
|
||||
->select('ev')
|
||||
->getQuery()
|
||||
->setMaxResults(1)
|
||||
->getResult();
|
||||
|
||||
$data = [];
|
||||
@@ -57,9 +59,7 @@ final class EvaluationFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
|
@@ -11,7 +11,11 @@ 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;
|
||||
@@ -38,25 +42,28 @@ final class GeographicalUnitStatFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
$repo = self::$container->get(GeographicalUnitRepositoryInterface::class);
|
||||
|
||||
$units = $repo->findAll();
|
||||
|
||||
return [
|
||||
[
|
||||
'date' => DateTime::createFromFormat('Y-m-d', '2022-05-01'),
|
||||
'accepted_loctype' => 'center',
|
||||
'date_calc' => new RollingDate(RollingDate::T_TODAY),
|
||||
'units' => $units
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->from('ChillPersonBundle:AccompanyingPeriod', 'acp')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->select('acp.id'),
|
||||
];
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\IntensityFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
@@ -45,16 +46,14 @@ final class IntensityFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('acp.id')
|
||||
->from('ChillPersonBundle:AccompanyingPeriod', 'acp'),
|
||||
->from(AccompanyingPeriod::class, 'acp'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
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;
|
||||
@@ -40,23 +42,21 @@ final class OpenBetweenDatesFilterTest extends AbstractFilterTest
|
||||
{
|
||||
return [
|
||||
[
|
||||
'date_from' => DateTime::createFromFormat('Y-m-d', '2022-05-01'),
|
||||
'date_to' => DateTime::createFromFormat('Y-m-d', '2022-06-01'),
|
||||
'date_from' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
|
||||
'date_to' => new RollingDate(RollingDate::T_TODAY),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->from('ChillPersonBundle:AccompanyingPeriod', 'acp')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->select('acp.id'),
|
||||
];
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\OriginFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -38,12 +39,14 @@ final class OriginFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$array = $em->createQueryBuilder()
|
||||
->from(Origin::class, 'o')
|
||||
->select('o')
|
||||
->getQuery()
|
||||
->setMaxResults(1)
|
||||
->getResult();
|
||||
|
||||
$data = [];
|
||||
@@ -57,16 +60,14 @@ final class OriginFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('acp.id')
|
||||
->from('ChillPersonBundle:AccompanyingPeriod', 'acp'),
|
||||
->from(AccompanyingPeriod::class, 'acp'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,11 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
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;
|
||||
|
||||
@@ -38,42 +42,46 @@ final class ReferrerFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
self:self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$array = $em->createQueryBuilder()
|
||||
->from(User::class, 'u')
|
||||
->select('u')
|
||||
->getQuery()
|
||||
->setMaxResults(1)
|
||||
->getResult();
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach ($array as $u) {
|
||||
$data[] = ['accepted_referrers' => $u];
|
||||
$data[] = ['accepted_referrers' => $u, 'date_calc' => new RollingDate(RollingDate::T_TODAY)];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
public function getQueryBuilders(): iterable
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->from('ChillPersonBundle:AccompanyingPeriod', 'acp')
|
||||
->select('acp.id'),
|
||||
$em->createQueryBuilder()
|
||||
->from('ChillPersonBundle:AccompanyingPeriod\AccompanyingPeriodWork', 'acpw')
|
||||
->select('acpw.id'),
|
||||
$em->createQueryBuilder()
|
||||
->from('ChillPersonBundle:AccompanyingPeriod\AccompanyingPeriodWork', 'acpw')
|
||||
->join('acpw.referrers', 'acpwuser')
|
||||
->select('acpwuser.id'),
|
||||
];
|
||||
yield $em->createQueryBuilder()
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->select('acp.id');
|
||||
|
||||
$qb = $em->createQueryBuilder();
|
||||
$qb
|
||||
->from(AccompanyingPeriod\AccompanyingPeriodWork::class, 'acpw')
|
||||
->join('acpw.accompanyingPeriod', 'acp')
|
||||
->join('acp.participations', 'acppart')
|
||||
->join('acppart.person', 'person')
|
||||
;
|
||||
|
||||
$qb->select('COUNT(DISTINCT acpw.id) as export_result');
|
||||
|
||||
yield $qb;
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\RequestorFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
@@ -47,15 +48,13 @@ final class RequestorFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->from('ChillPersonBundle:AccompanyingPeriod', 'acp')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->select('acp.id'),
|
||||
];
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\SocialActionFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -36,36 +37,30 @@ final class SocialActionFilterTest extends AbstractFilterTest
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
public function getFormData(): iterable
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$array = $em->createQueryBuilder()
|
||||
->from(SocialAction::class, 'sa')
|
||||
->select('sa')
|
||||
->getQuery()
|
||||
->setMaxResults(1)
|
||||
->getResult();
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach ($array as $a) {
|
||||
$data[] = ['accepted_socialactions' => $a];
|
||||
}
|
||||
|
||||
return $data;
|
||||
yield ['accepted_socialactions' => $array];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->from('ChillPersonBundle:AccompanyingPeriod', 'acp')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->select('acp.id'),
|
||||
];
|
||||
}
|
||||
|
@@ -12,8 +12,10 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\SocialIssueFilter;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
@@ -36,37 +38,31 @@ final class SocialIssueFilterTest extends AbstractFilterTest
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
public function getFormData(): iterable
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$array = $em->createQueryBuilder()
|
||||
->from(SocialIssue::class, 'si')
|
||||
->select('si')
|
||||
->getQuery()
|
||||
->setMaxResults(1)
|
||||
->getResult();
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach ($array as $i) {
|
||||
$data[] = ['accepted_socialissues' => $i];
|
||||
}
|
||||
|
||||
return $data;
|
||||
yield ['accepted_socialissues' => new ArrayCollection($array)];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('acp.id')
|
||||
->from('ChillPersonBundle:AccompanyingPeriod', 'acp'),
|
||||
->from(AccompanyingPeriod::class, 'acp'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -11,9 +11,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\StepFilterOnDate;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -27,7 +29,7 @@ final class StepFilterTest extends AbstractFilterTest
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->filter = self::$container->get('chill.person.export.filter_step');
|
||||
$this->filter = self::$container->get(StepFilterOnDate::class);
|
||||
}
|
||||
|
||||
public function getFilter()
|
||||
@@ -35,29 +37,29 @@ final class StepFilterTest extends AbstractFilterTest
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
public function getFormData(): iterable
|
||||
{
|
||||
return [
|
||||
['accepted_steps' => AccompanyingPeriod::STEP_DRAFT],
|
||||
['accepted_steps' => AccompanyingPeriod::STEP_CONFIRMED],
|
||||
['accepted_steps' => AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_LONG],
|
||||
['accepted_steps' => AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_SHORT],
|
||||
['accepted_steps' => AccompanyingPeriod::STEP_CLOSED],
|
||||
];
|
||||
foreach ([
|
||||
['accepted_steps_multi' => [AccompanyingPeriod::STEP_DRAFT]],
|
||||
['accepted_steps_multi' => [AccompanyingPeriod::STEP_CONFIRMED]],
|
||||
['accepted_steps_multi' => [AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_LONG]],
|
||||
['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] ;
|
||||
}
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get('doctrine.orm.entity_manager');
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('acp.id')
|
||||
->from('ChillPersonBundle:AccompanyingPeriod', 'acp'),
|
||||
->from(AccompanyingPeriod::class, 'acp'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -11,15 +11,19 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
use Chill\MainBundle\Entity\UserJob;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\UserJobFilter;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class CurrentUserJobFilterTest extends AbstractFilterTest
|
||||
final class UserJobFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private UserJobFilter $filter;
|
||||
|
||||
@@ -27,7 +31,7 @@ final class CurrentUserJobFilterTest extends AbstractFilterTest
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->filter = self::$container->get('chill.person.export.filter_userjob');
|
||||
$this->filter = self::$container->get(UserJobFilter::class);
|
||||
}
|
||||
|
||||
public function getFilter()
|
||||
@@ -35,23 +39,30 @@ final class CurrentUserJobFilterTest extends AbstractFilterTest
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
public function getFormData(): iterable
|
||||
{
|
||||
return [];
|
||||
self::bootKernel();
|
||||
$jobs = self::$container->get(EntityManagerInterface::class)
|
||||
->createQuery('SELECT j FROM ' . UserJob::class . ' j')
|
||||
->setMaxResults(1)
|
||||
->getResult();
|
||||
|
||||
yield [
|
||||
'jobs' => new ArrayCollection($jobs),
|
||||
'date_calc' => new RollingDate(RollingDate::T_TODAY)
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('acp.id')
|
||||
->from('ChillPersonBundle:AccompanyingPeriod', 'acp'),
|
||||
->from(AccompanyingPeriod::class, 'acp'),
|
||||
];
|
||||
}
|
||||
}
|
@@ -11,15 +11,19 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\AccompanyingCourseFilters;
|
||||
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\UserScopeFilter;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class CurrentUserScopeFilterTest extends AbstractFilterTest
|
||||
final class UserScopeFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private UserScopeFilter $filter;
|
||||
|
||||
@@ -27,7 +31,7 @@ final class CurrentUserScopeFilterTest extends AbstractFilterTest
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->filter = self::$container->get('chill.person.export.filter_userscope');
|
||||
$this->filter = self::$container->get(UserScopeFilter::class);
|
||||
}
|
||||
|
||||
public function getFilter()
|
||||
@@ -37,21 +41,30 @@ final class CurrentUserScopeFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [];
|
||||
self::bootKernel();
|
||||
$scopes = self::$container->get(EntityManagerInterface::class)
|
||||
->createQuery('SELECT s FROM ' . Scope::class . ' s')
|
||||
->setMaxResults(1)
|
||||
->getResult();
|
||||
|
||||
return [
|
||||
[
|
||||
'date_calc' => new RollingDate(RollingDate::T_TODAY),
|
||||
'scopes' => new ArrayCollection($scopes),
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('acp.id')
|
||||
->from('ChillPersonBundle:AccompanyingPeriod', 'acp'),
|
||||
->from(AccompanyingPeriod::class, 'acp'),
|
||||
];
|
||||
}
|
||||
}
|
@@ -39,12 +39,14 @@ final class EvaluationTypeFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$array = $em->createQueryBuilder()
|
||||
->from(Evaluation::class, 'e')
|
||||
->select('e')
|
||||
->getQuery()
|
||||
->setMaxResults(1)
|
||||
->getResult();
|
||||
|
||||
$data = [];
|
||||
@@ -60,18 +62,16 @@ final class EvaluationTypeFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('workeval.id')
|
||||
->select('eval.id')
|
||||
->from(AccompanyingPeriod::class, 'acp')
|
||||
->join('acp.works', 'acpw')
|
||||
->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval'),
|
||||
->join('acpw.accompanyingPeriodWorkEvaluations', 'eval'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -46,9 +46,7 @@ final class MaxDateFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
|
@@ -11,9 +11,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\HouseholdFilters;
|
||||
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdCompositionType;
|
||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||
use Chill\PersonBundle\Export\Filter\HouseholdFilters\CompositionFilter;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -40,12 +42,14 @@ final class CompositionFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$array = $em->createQueryBuilder()
|
||||
->from(HouseholdCompositionType::class, 'r')
|
||||
->select('r')
|
||||
->getQuery()
|
||||
->setMaxResults(1)
|
||||
->getResult();
|
||||
|
||||
$data = [];
|
||||
@@ -53,25 +57,33 @@ final class CompositionFilterTest extends AbstractFilterTest
|
||||
foreach ($array as $r) {
|
||||
$data[] = [
|
||||
'accepted_composition' => $r,
|
||||
'on_date' => DateTime::createFromFormat('Y-m-d', '2022-05-01'),
|
||||
'on_date' => new RollingDate(RollingDate::T_TODAY),
|
||||
];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
public function getQueryBuilders(): iterable
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
$qb = $em->createQueryBuilder();
|
||||
$qb
|
||||
->from(Household::class, 'household')
|
||||
->join('household.members', 'hmember')
|
||||
->join('hmember.person', 'person')
|
||||
->join('person.accompanyingPeriodParticipations', 'acppart')
|
||||
->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'));
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('h.id')
|
||||
->from(Household::class, 'h'),
|
||||
];
|
||||
$qb
|
||||
->select('COUNT(DISTINCT household.id) AS household_export_result')
|
||||
->addSelect('COUNT(DISTINCT acp.id) AS acp_export_result');
|
||||
|
||||
yield $qb;
|
||||
}
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters;
|
||||
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Filter\PersonFilters\AgeFilter;
|
||||
@@ -43,28 +44,21 @@ final class AgeFilterTest extends AbstractFilterTest
|
||||
[
|
||||
'min_age' => '18',
|
||||
'max_age' => '60',
|
||||
'date_calc' => DateTime::createFromFormat('Y-m-d', '2020-05-01'),
|
||||
],
|
||||
[ // ça devrait faire boum !
|
||||
'min_age' => '35',
|
||||
'max_age' => '30',
|
||||
'date_calc' => DateTime::createFromFormat('Y-m-d', '2020-05-01'),
|
||||
'date_calc' => new RollingDate(RollingDate::T_TODAY),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('p.id')
|
||||
->from(Person::class, 'p'),
|
||||
->select('person.id')
|
||||
->from(Person::class, 'person'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -11,9 +11,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters;
|
||||
|
||||
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
|
||||
@@ -39,35 +42,28 @@ final class BirthdateFilterTest extends AbstractFilterTest
|
||||
{
|
||||
return [
|
||||
[
|
||||
'date_from' => DateTime::createFromFormat('Y-m-d', '2000-01-01'),
|
||||
'date_to' => DateTime::createFromFormat('Y-m-d', '2010-01-01'),
|
||||
'date_from' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
|
||||
'date_to' => new RollingDate(RollingDate::T_TODAY),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders()
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container
|
||||
->get('doctrine.orm.entity_manager');
|
||||
->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('p.firstName')
|
||||
->from('ChillPersonBundle:Person', 'p'),
|
||||
->select('person.firstName')
|
||||
->from(Person::class, 'person'),
|
||||
$em->createQueryBuilder()
|
||||
->select('p.firstName')
|
||||
->from('ChillPersonBundle:Person', 'p')
|
||||
->select('count(DISTINCT person)')
|
||||
->from(Person::class, 'person')
|
||||
// add a dummy where clause
|
||||
->where('p.firstname IS NOT NULL'),
|
||||
$em->createQueryBuilder()
|
||||
->select('count(IDENTITY(p))')
|
||||
->from('ChillPersonBundle:Person', 'p')
|
||||
// add a dummy where clause
|
||||
->where('p.firstname IS NOT NULL'),
|
||||
->where('person.firstName IS NOT NULL'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters;
|
||||
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Filter\PersonFilters\DeadOrAliveFilter;
|
||||
@@ -42,27 +43,25 @@ final class DeadOrAliveFilterTest extends AbstractFilterTest
|
||||
return [
|
||||
[
|
||||
'person_state' => 'alive',
|
||||
'date_calc' => DateTime::createFromFormat('Y-m-d', '2021-05-01'),
|
||||
'date_calc' => new RollingDate(RollingDate::T_TODAY),
|
||||
],
|
||||
[
|
||||
'person_state' => 'deceased',
|
||||
'date_calc' => DateTime::createFromFormat('Y-m-d', '2021-05-01'),
|
||||
'date_calc' => new RollingDate(RollingDate::T_TODAY),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('p.id')
|
||||
->from(Person::class, 'p'),
|
||||
->select('person.id')
|
||||
->from(Person::class, 'person'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters;
|
||||
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Filter\PersonFilters\DeathdateFilter;
|
||||
@@ -41,24 +42,22 @@ final class DeathdateFilterTest extends AbstractFilterTest
|
||||
{
|
||||
return [
|
||||
[
|
||||
'date_from' => DateTime::createFromFormat('Y-m-d', '2020-05-01'),
|
||||
'date_to' => DateTime::createFromFormat('Y-m-d', '2022-05-01'),
|
||||
'date_from' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
|
||||
'date_to' => new RollingDate(RollingDate::T_TODAY),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('p.id')
|
||||
->from(Person::class, 'p'),
|
||||
->select('person.id')
|
||||
->from(Person::class, 'person'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Filter\PersonFilters\GenderFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -52,17 +53,15 @@ final class GenderFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getQueryBuilders()
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container
|
||||
->get('doctrine.orm.entity_manager');
|
||||
->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('p.firstName')
|
||||
->from('ChillPersonBundle:Person', 'p'),
|
||||
->select('person.firstName')
|
||||
->from(Person::class, 'person')
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters;
|
||||
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\MaritalStatus;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
@@ -40,12 +41,14 @@ final class MaritalStatusFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$array = $em->createQueryBuilder()
|
||||
->from(MaritalStatus::class, 'm')
|
||||
->select('m')
|
||||
->getQuery()
|
||||
->setMaxResults(1)
|
||||
->getResult();
|
||||
|
||||
$data = [];
|
||||
@@ -53,7 +56,6 @@ final class MaritalStatusFilterTest extends AbstractFilterTest
|
||||
foreach ($array as $m) {
|
||||
$data[] = [
|
||||
'maritalStatus' => $m,
|
||||
'calc_date' => DateTime::createFromFormat('Y-m-d', '2022-05-01'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -62,16 +64,14 @@ final class MaritalStatusFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('p.id')
|
||||
->from(Person::class, 'p'),
|
||||
->select('count(person)')
|
||||
->from(Person::class, 'person'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -39,9 +39,10 @@ final class NationalityFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$countries = $em->getRepository(Country::class)->findAll();
|
||||
$countries = array_slice($em->getRepository(Country::class)->findAll(), 0, 1);
|
||||
|
||||
$data = [];
|
||||
|
||||
@@ -56,16 +57,14 @@ final class NationalityFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('p.id')
|
||||
->from(Person::class, 'p'),
|
||||
->select('count(person)')
|
||||
->from(Person::class, 'person'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters;
|
||||
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\Person\ResidentialAddress;
|
||||
@@ -42,20 +43,22 @@ final class ResidentialAddressAtThirdpartyFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$array = $em->createQueryBuilder()
|
||||
->from(ThirdPartyCategory::class, 'tpc')
|
||||
->select('tpc')
|
||||
->getQuery()
|
||||
->setMaxResults(1)
|
||||
->getResult();
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach ($array as $r) {
|
||||
$data[] = [
|
||||
'thirdparty_cat' => $r,
|
||||
'date_calc' => DateTime::createFromFormat('Y-m-d', '2022-05-01'),
|
||||
'thirdparty_cat' => [$r],
|
||||
'date_calc' => new RollingDate(RollingDate::T_TODAY),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -64,18 +67,15 @@ final class ResidentialAddressAtThirdpartyFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('p.id')
|
||||
->from(Person::class, 'p')
|
||||
->join(ResidentialAddress::class, 'resaddr', Expr\Join::WITH, 'resaddr.person = p')
|
||||
->join('p.center', 'center')
|
||||
->select('person.id')
|
||||
->from(Person::class, 'person')
|
||||
->join(ResidentialAddress::class, 'resaddr', Expr\Join::WITH, 'resaddr.person = person')
|
||||
->join('resaddr.hostThirdParty', 'tparty')
|
||||
->join('tparty.categories', 'tpartycat'),
|
||||
];
|
||||
|
@@ -11,6 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\PersonFilters;
|
||||
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Export\Filter\PersonFilters\ResidentialAddressAtUserFilter;
|
||||
@@ -39,14 +40,14 @@ final class ResidentialAddressAtUserFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [];
|
||||
return [
|
||||
['date_calc' => new RollingDate(RollingDate::T_TODAY)]
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
|
@@ -11,8 +11,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\SocialWorkFilters;
|
||||
|
||||
use Chill\MainBundle\Entity\UserJob;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||
use Chill\PersonBundle\Export\Filter\SocialWorkFilters\JobFilter;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
@@ -37,21 +40,30 @@ final class JobFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [];
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$jobs = $em->createQuery('SELECT j FROM ' . UserJob::class . ' j')
|
||||
->setMaxResults(1)
|
||||
->getResult();
|
||||
|
||||
return [
|
||||
[
|
||||
'job' => new ArrayCollection($jobs)
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('acpw.id')
|
||||
->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'),
|
||||
->from(AccompanyingPeriodWork::class, 'acpw'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -39,9 +39,10 @@ final class ReferrerFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$users = $em->getRepository(User::class)->findAll();
|
||||
$users = array_slice($em->getRepository(User::class)->findAll(), 0, 1);
|
||||
|
||||
$data = [];
|
||||
|
||||
@@ -56,9 +57,7 @@ final class ReferrerFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
|
@@ -11,7 +11,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter\SocialWorkFilters;
|
||||
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||
use Chill\PersonBundle\Export\Filter\SocialWorkFilters\ScopeFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
@@ -37,21 +39,30 @@ final class ScopeFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [];
|
||||
self::bootKernel();
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
$scopes = $em->createQuery('SELECT s FROM ' . Scope::class . ' s')
|
||||
->setMaxResults(1)
|
||||
->getResult();
|
||||
|
||||
return [
|
||||
[
|
||||
'scope' => $scopes
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('acpw.id')
|
||||
->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'),
|
||||
->from(AccompanyingPeriodWork::class, 'acpw'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user