[export] add a filter and aggregator on accompanying period work: group/filter by handling third party

This commit is contained in:
2023-10-18 13:32:26 +02:00
parent f799fe0649
commit a4edb34668
9 changed files with 397 additions and 125 deletions

View File

@@ -0,0 +1,60 @@
<?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\SocialWorkAggregators;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\HandlingThirdPartyAggregator;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class HandlingThirdPartyAggregatorTest extends AbstractAggregatorTest
{
private static HandlingThirdPartyAggregator $handlingThirdPartyAggregator;
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
self::bootKernel();
self::$handlingThirdPartyAggregator = self::$container->get(HandlingThirdPartyAggregator::class);
}
public function getAggregator()
{
return self::$handlingThirdPartyAggregator;
}
public function getFormData()
{
return [
[],
];
}
public function getQueryBuilders()
{
self::bootKernel();
$em = self::$container
->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()
->select('count(acpw.id)')
->from(AccompanyingPeriodWork::class, 'acpw'),
];
}
}

View File

@@ -0,0 +1,71 @@
<?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\Filter\SocialWorkFilters;
use Chill\MainBundle\Test\Export\AbstractFilterTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\HandlingThirdPartyFilter;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class HandlingThirdPartyFilterTest extends AbstractFilterTest
{
private ThirdPartyRender $thirdPartyRender;
protected function setUp(): void
{
parent::setUp();
self::bootKernel();
$this->thirdPartyRender = self::$container->get(ThirdPartyRender::class);
}
public function getFilter()
{
return new HandlingThirdPartyFilter($this->thirdPartyRender);
}
public function getFormData()
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$thirdParties = $em->createQuery('SELECT tp FROM '.ThirdParty::class.' tp')
->setMaxResults(2)
->getResult();
return [
[
'handling_3parties' => $thirdParties,
],
];
}
public function getQueryBuilders()
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()
->select('acpw.id')
->from(AccompanyingPeriodWork::class, 'acpw'),
];
}
}