fix tests implementing AbstractAggregatorTest

This commit is contained in:
2023-09-01 15:07:37 +02:00
parent a197a6b418
commit 37c1dfb0ba
53 changed files with 215 additions and 212 deletions

View File

@@ -45,9 +45,7 @@ final class AdministrativeLocationAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
@@ -55,7 +53,6 @@ final class AdministrativeLocationAggregatorTest extends AbstractAggregatorTest
$em->createQueryBuilder()
->select('count(acp.id)')
->from(AccompanyingPeriod::class, 'acp')
->join('acp.administrativeLocation', 'acploc'),
];
}
}

View File

@@ -45,9 +45,7 @@ final class ClosingMotiveAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
@@ -55,7 +53,6 @@ final class ClosingMotiveAggregatorTest extends AbstractAggregatorTest
$em->createQueryBuilder()
->select('count(acp.id)')
->from(AccompanyingPeriod::class, 'acp')
->join('acp.closingMotive', 'acpmotive'),
];
}
}

View File

@@ -45,9 +45,7 @@ final class ConfidentialAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -47,9 +47,7 @@ final class DurationAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -45,9 +45,7 @@ final class EmergencyAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -45,9 +45,7 @@ final class EvaluationAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -11,6 +11,8 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
use Chill\MainBundle\Repository\GeographicalUnitLayerLayerRepository;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\GeographicalUnitStatAggregator;
@@ -39,9 +41,12 @@ final class GeographicalUnitStatAggregatorTest extends AbstractAggregatorTest
public function getFormData(): array
{
// TODO: add geographical unit stat into fixtures and provide a level
self::bootKernel();
$repository = self::$container->get(GeographicalUnitLayerLayerRepository::class);
$levels = $repository->findAll();
return [
['date_calc' => new DateTimeImmutable('today'), 'level' => null],
['date_calc' => new RollingDate(RollingDate::T_TODAY), 'level' => $levels]
];
}

View File

@@ -45,9 +45,7 @@ final class IntensityAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -45,9 +45,7 @@ final class OriginAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ReferrerAggregator;
@@ -40,15 +41,13 @@ final class ReferrerAggregatorTest extends AbstractAggregatorTest
public function getFormData(): array
{
return [
['date_calc' => new DateTimeImmutable('now')],
['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);

View File

@@ -56,16 +56,14 @@ final class ReferrerScopeAggregatorTest extends AbstractAggregatorTest
{
return [
[
'date_calc' => new DateTimeImmutable('now'),
'date_calc' => new RollingDate(RollingDate::T_TODAY)
],
];
}
public function getQueryBuilders()
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -45,9 +45,7 @@ final class RequestorAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -45,9 +45,7 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
@@ -56,6 +54,9 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest
->select('count(acp.id)')
->from(AccompanyingPeriod::class, 'acp')
->join('acp.scopes', 'acpscope'),
$em->createQueryBuilder()
->select('count(acp.id)')
->from(AccompanyingPeriod::class, 'acp')
];
}
}

View File

@@ -45,9 +45,7 @@ final class SocialActionAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -45,9 +45,7 @@ final class SocialIssueAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregators;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\StepAggregator;
@@ -41,16 +42,14 @@ final class StepAggregatorTest extends AbstractAggregatorTest
{
return [
[
'on_date' => DateTime::createFromFormat('Y-m-d', '2022-01-01'),
'on_date' => new RollingDate(RollingDate::T_TODAY)
],
];
}
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -45,9 +45,7 @@ final class UserJobAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
@@ -56,6 +54,9 @@ final class UserJobAggregatorTest extends AbstractAggregatorTest
->select('count(acp.id)')
->from(AccompanyingPeriod::class, 'acp')
->join('acp.job', 'acpjob'),
$em->createQueryBuilder()
->select('count(acp.id)')
->from(AccompanyingPeriod::class, 'acp')
];
}
}

View File

@@ -45,9 +45,7 @@ final class EvaluationTypeAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Tests\Export\Aggregator\HouseholdAggregators;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Export\Aggregator\HouseholdAggregators\ChildrenNumberAggregator;
@@ -41,16 +42,14 @@ final class ChildrenNumberAggregatorTest extends AbstractAggregatorTest
{
return [
[
'on_date' => DateTime::createFromFormat('Y-m-d', '2022-07-01'),
'on_date' => new RollingDate(RollingDate::T_TODAY)
],
];
}
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Tests\Export\Aggregator\HouseholdAggregators;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Export\Aggregator\HouseholdAggregators\CompositionAggregator;
@@ -41,16 +42,14 @@ final class CompositionAggregatorTest extends AbstractAggregatorTest
{
return [
[
'on_date' => DateTime::createFromFormat('Y-m-d', '2022-07-01'),
'on_date' => new RollingDate(RollingDate::T_TODAY)
],
];
}
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -11,9 +11,12 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Tests\Export\Aggregator\PersonAggregators;
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
@@ -39,24 +42,22 @@ final class AgeAggregatorTest extends AbstractAggregatorTest
{
return [
[
'date_age_calculation' => DateTime::createFromFormat('Y-m-d', '2016-06-16'),
'date_age_calculation' => 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('count(person.id)')
->from('ChillPersonBundle:Person', 'person'),
->from(Person::class, 'person'),
];
}
}

View File

@@ -46,9 +46,7 @@ final class CountryOfBirthAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -12,7 +12,9 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Tests\Export\Aggregator\PersonAggregators;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Export\Aggregator\PersonAggregators\GenderAggregator;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
@@ -43,17 +45,15 @@ final class GenderAggregatorTest extends AbstractAggregatorTest
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('count(person.id)')
->from('ChillPersonBundle:Person', 'person'),
->from(Person::class, 'person'),
];
}
}

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Tests\Export\Aggregator\PersonAggregators;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\Household\HouseholdMember;
use Chill\PersonBundle\Entity\Person;
@@ -43,16 +44,14 @@ final class HouseholdPositionAggregatorTest extends AbstractAggregatorTest
{
return [
[
'date_position' => DateTime::createFromFormat('Y-m-d', '2022-07-01'),
'date_position' => new RollingDate(RollingDate::T_TODAY)
],
];
}
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
@@ -60,8 +59,10 @@ final class HouseholdPositionAggregatorTest extends AbstractAggregatorTest
$em->createQueryBuilder()
->select('count(person.id)')
->from(Person::class, 'person')
->join(HouseholdMember::class, 'householdmember', Expr\Join::WITH, 'householdmember.person = person')
->join('person.center', 'center'),
->join(HouseholdMember::class, 'householdmember', Expr\Join::WITH, 'householdmember.person = person'),
$em->createQueryBuilder()
->select('count(person.id)')
->from(Person::class, 'person')
];
}
}

View File

@@ -45,9 +45,7 @@ final class MaritalStatusAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
@@ -56,6 +54,9 @@ final class MaritalStatusAggregatorTest extends AbstractAggregatorTest
->select('count(person.id)')
->from(Person::class, 'person')
->join('person.maritalStatus', 'personmarital'),
$em->createQueryBuilder()
->select('count(person.id)')
->from(Person::class, 'person')
];
}
}

View File

@@ -12,7 +12,9 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Tests\Export\Aggregator\PersonAggregators;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Export\Aggregator\PersonAggregators\NationalityAggregator;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
@@ -44,17 +46,15 @@ final class NationalityAggregatorTest extends AbstractAggregatorTest
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('count(person.id)')
->from('ChillPersonBundle:Person', 'person'),
->from(Person::class, 'person'),
];
}
}

View File

@@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ActionTypeAggregator;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
@@ -44,12 +45,10 @@ final class ActionTypeAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container
->get('doctrine.orm.entity_manager');
->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\GoalAggregator;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
@@ -44,12 +45,10 @@ final class GoalAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container
->get('doctrine.orm.entity_manager');
->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -45,9 +45,7 @@ final class GoalResultAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
@@ -58,6 +56,11 @@ final class GoalResultAggregatorTest extends AbstractAggregatorTest
->join('acp.works', 'acpw')
->join('acpw.goals', 'goal')
->join('goal.results', 'goalresult'),
$em->createQueryBuilder()
->select('count(acp.id)')
->from(AccompanyingPeriod::class, 'acp')
->join('acp.works', 'acpw')
->join('acpw.goals', 'goal')
];
}
}

View File

@@ -45,9 +45,7 @@ final class JobAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ReferrerAggregator;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
@@ -27,7 +28,7 @@ final class ReferrerAggregatorTest extends AbstractAggregatorTest
{
self::bootKernel();
$this->aggregator = self::$container->get('chill.person.export.aggregator_referrer');
$this->aggregator = self::$container->get(ReferrerAggregator::class);
}
public function getAggregator()
@@ -44,12 +45,10 @@ final class ReferrerAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container
->get('doctrine.orm.entity_manager');
->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Tests\Export\Aggregator\SocialWorkAggregators;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ResultAggregator;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
@@ -44,12 +45,10 @@ final class ResultAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container
->get('doctrine.orm.entity_manager');
->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()

View File

@@ -45,9 +45,7 @@ final class ScopeAggregatorTest extends AbstractAggregatorTest
public function getQueryBuilders(): array
{
if (null === self::$kernel) {
self::bootKernel();
}
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);

View File

@@ -82,8 +82,7 @@ services:
tags:
- { name: chill.export_aggregator, alias: social_work_actions_treatingagent_job_aggregator }
chill.person.export.aggregator_treatingagent:
class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ReferrerAggregator
Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ReferrerAggregator:
autowire: true
autoconfigure: true
tags: