mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
tests added for filters and some aggregators
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ReferrerAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
private ReferrerAggregator $aggregator;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->aggregator = self::$container->get('chill.person.export.aggregator_referrer');
|
||||
}
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
public function getFormData()
|
||||
{
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders()
|
||||
{
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container
|
||||
->get('doctrine.orm.entity_manager');
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(acpw.id)')
|
||||
->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'),
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Export\Export;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
|
||||
|
||||
final class CountSocialWorkActionsTest extends AbstractExportTest
|
||||
{
|
||||
private CountSocialWorkActions $export;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->export = self::$container->get('chill.person.export.count_social_work_actions');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getExport()
|
||||
{
|
||||
return $this->export;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [[]];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getModifiersCombination()
|
||||
{
|
||||
return [[Declarations::SOCIAL_WORK_ACTION_TYPE]];
|
||||
}
|
||||
}
|
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Export\Filter\UserJobFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
class JobFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private JobFilter $filter;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
// add a fake request with a default locale (used in translatable string)
|
||||
$request = $this->prophesize();
|
||||
|
||||
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||
$request->getLocale()->willReturn('fr');
|
||||
|
||||
$this->filter = self::$container->get('chill.person.export.filter_job');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('acpw.id')
|
||||
->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'),
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Export\Filter\UserScopeFilter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
class ScopeFilterTest extends AbstractFilterTest
|
||||
{
|
||||
private ScopeFilter $filter;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
// add a fake request with a default locale (used in translatable string)
|
||||
$request = $this->prophesize();
|
||||
|
||||
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||
$request->getLocale()->willReturn('fr');
|
||||
|
||||
$this->filter = self::$container->get('chill.person.export.filter_scope');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getFormData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getQueryBuilders(): array
|
||||
{
|
||||
|
||||
if (null === self::$kernel) {
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('acpw.id')
|
||||
->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'),
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user