Merge branch '199-missing-exports' into 'master'

Add missing filters and grouping

Closes #189, #200, and #199

See merge request Chill-Projet/chill-bundles!609
This commit is contained in:
2023-11-14 20:24:21 +00:00
35 changed files with 1398 additions and 47 deletions

View File

@@ -0,0 +1,61 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Tests\Export\Aggregator\PersonAggregators;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Export\Aggregator\PersonAggregators\PostalCodeAggregator;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class PostalCodeAggregatorTest extends AbstractAggregatorTest
{
private RollingDateConverterInterface $rollingDateConverter;
protected function setUp(): void
{
self::bootKernel();
$this->rollingDateConverter = self::$container->get(RollingDateConverterInterface::class);
}
public function getAggregator()
{
return new PostalCodeAggregator($this->rollingDateConverter);
}
public function getFormData()
{
return [
['calc_date' => new RollingDate(RollingDate::T_TODAY)],
];
}
public function getQueryBuilders()
{
self::bootKernel();
$em = self::$container
->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()
->select('count(person.id)')
->from(Person::class, 'person'),
];
}
}

View File

@@ -13,7 +13,7 @@ namespace Export\Export;
use Chill\MainBundle\Test\Export\AbstractExportTest;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Export\Export\CountAccompanyingPeriodWork;
use Chill\PersonBundle\Export\Export\CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod;
use Doctrine\ORM\EntityManagerInterface;
/**
@@ -21,23 +21,19 @@ use Doctrine\ORM\EntityManagerInterface;
*
* @coversNothing
*/
final class CountAccompanyingPeriodWorkTest extends AbstractExportTest
final class CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest extends AbstractExportTest
{
private CountAccompanyingPeriodWork $export;
protected function setUp(): void
{
self::bootKernel();
$this->export = self::$container->get(CountAccompanyingPeriodWork::class);
}
public function getExport()
{
$em = self::$container->get(EntityManagerInterface::class);
yield new CountAccompanyingPeriodWork($em, $this->getParameters(true));
yield new CountAccompanyingPeriodWork($em, $this->getParameters(false));
yield new CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod($em, $this->getParameters(true));
yield new CountAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod($em, $this->getParameters(false));
}
public function getFormData(): array

View File

@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Tests\Export\Export;
use Chill\MainBundle\Test\Export\AbstractExportTest;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Export\Export\CountAccompanyingPeriodWorkAssociatePersonOnWork;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
final class CountAccompanyingPeriodWorkAssociatePersonOnWorkTest extends AbstractExportTest
{
protected function setUp(): void
{
self::bootKernel();
}
public function getExport()
{
$em = self::$container->get(EntityManagerInterface::class);
yield new CountAccompanyingPeriodWorkAssociatePersonOnWork($em, $this->getParameters(true));
yield new CountAccompanyingPeriodWorkAssociatePersonOnwork($em, $this->getParameters(false));
}
public function getFormData(): array
{
return [[]];
}
public function getModifiersCombination()
{
return [[Declarations::SOCIAL_WORK_ACTION_TYPE]];
}
}

View File

@@ -0,0 +1,58 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Tests\Export\Export;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Chill\MainBundle\Test\Export\AbstractExportTest;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Export\Export\CountHouseholdInPeriod;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class CountHouseholdInPeriodTest extends AbstractExportTest
{
protected function setUp(): void
{
self::bootKernel();
}
public function getExport()
{
$em = self::$container->get(EntityManagerInterface::class);
$rollingDate = self::$container->get(RollingDateConverterInterface::class);
yield new CountHouseholdInPeriod($em, $rollingDate, $this->getParameters(true));
yield new CountHouseholdInPeriod($em, $rollingDate, $this->getParameters(false));
}
public function getFormData()
{
return [
['calc_date' => new RollingDate(RollingDate::T_TODAY)],
];
}
public function getModifiersCombination()
{
return [
[
Declarations::HOUSEHOLD_TYPE,
Declarations::ACP_TYPE,
Declarations::PERSON_TYPE,
]];
}
}

View File

@@ -0,0 +1,103 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Tests\Export\Export;
use Chill\MainBundle\Export\Helper\AggregateStringHelper;
use Chill\MainBundle\Export\Helper\DateTimeHelper;
use Chill\MainBundle\Export\Helper\TranslatableStringExportLabelHelper;
use Chill\MainBundle\Export\Helper\UserHelper;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Chill\MainBundle\Test\Export\AbstractExportTest;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Export\Export\ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod;
use Chill\PersonBundle\Export\Helper\LabelPersonHelper;
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
use Chill\ThirdPartyBundle\Export\Helper\LabelThirdPartyHelper;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriodTest extends AbstractExportTest
{
protected function setUp(): void
{
parent::setUp();
self::bootKernel();
}
public function getExport()
{
$entityManager = self::$container->get(EntityManagerInterface::class);
$dateTimeHelper = self::$container->get(DateTimeHelper::class);
$userHelper = self::$container->get(UserHelper::class);
$personHelper = self::$container->get(LabelPersonHelper::class);
$thirdPartyHelper = self::$container->get(LabelThirdPartyHelper::class);
$translatableStringExportLabelHelper = self::$container->get(TranslatableStringExportLabelHelper::class);
$socialIssueRender = self::$container->get(SocialIssueRender::class);
$socialIssueRepository = self::$container->get(SocialIssueRepository::class);
$socialActionRender = self::$container->get(SocialActionRender::class);
$rollingDateConverter = self::$container->get(RollingDateConverterInterface::class);
$aggregateStringHelper = self::$container->get(AggregateStringHelper::class);
$socialActionRepository = self::$container->get(SocialActionRepository::class);
yield new ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod(
$entityManager,
$dateTimeHelper,
$userHelper,
$personHelper,
$thirdPartyHelper,
$translatableStringExportLabelHelper,
$socialIssueRender,
$socialIssueRepository,
$socialActionRender,
$rollingDateConverter,
$aggregateStringHelper,
$socialActionRepository,
$this->getParameters(true),
);
yield new ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod(
$entityManager,
$dateTimeHelper,
$userHelper,
$personHelper,
$thirdPartyHelper,
$translatableStringExportLabelHelper,
$socialIssueRender,
$socialIssueRepository,
$socialActionRender,
$rollingDateConverter,
$aggregateStringHelper,
$socialActionRepository,
$this->getParameters(false),
);
}
public function getFormData()
{
return [
['calc_date' => new RollingDate(RollingDate::T_TODAY)],
];
}
public function getModifiersCombination()
{
return [[Declarations::ACP_TYPE]];
}
}

View File

@@ -19,7 +19,7 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Chill\MainBundle\Test\Export\AbstractExportTest;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Export\Export\ListAccompanyingPeriodWork;
use Chill\PersonBundle\Export\Export\ListAccompanyingPeriodWorkAssociatePersonOnWork;
use Chill\PersonBundle\Export\Helper\LabelPersonHelper;
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
@@ -33,7 +33,7 @@ use Doctrine\ORM\EntityManagerInterface;
*
* @coversNothing
*/
class ListAccompanyingPeriodWorkTest extends AbstractExportTest
class ListAccompanyingPeriodWorkAssociatePersonOnWorkTest extends AbstractExportTest
{
protected function setUp(): void
{
@@ -56,7 +56,7 @@ class ListAccompanyingPeriodWorkTest extends AbstractExportTest
$aggregateStringHelper = self::$container->get(AggregateStringHelper::class);
$socialActionRepository = self::$container->get(SocialActionRepository::class);
yield new ListAccompanyingPeriodWork(
yield new ListAccompanyingPeriodWorkAssociatePersonOnWork(
$entityManager,
$dateTimeHelper,
$userHelper,
@@ -72,7 +72,7 @@ class ListAccompanyingPeriodWorkTest extends AbstractExportTest
$this->getParameters(true),
);
yield new ListAccompanyingPeriodWork(
yield new ListAccompanyingPeriodWorkAssociatePersonOnWork(
$entityManager,
$dateTimeHelper,
$userHelper,