Create test for the participationBetweenDatesFilter

This commit is contained in:
Julie Lenaerts 2023-12-18 17:04:42 +01:00
parent d2a31de1be
commit f103b228e4

View File

@ -0,0 +1,58 @@
<?php
namespace 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\WithParticipationBetweenDatesFilter;
use Doctrine\ORM\EntityManagerInterface;
final class WithParticipationBetweenDatesFilterTest extends AbstractFilterTest
{
private WithParticipationBetweenDatesFilter $filter;
protected function setUp(): void
{
self::bootKernel();
$this->filter = self::$container->get(WithParticipationBetweenDatesFilter::class);
}
/**
* @inheritDoc
*/
public function getFilter()
{
return $this->filter;
}
/**
* @inheritDoc
*/
public function getFormData()
{
return [
[
'date_after' => new RollingDate(RollingDate::T_YEAR_CURRENT_START),
'date_before' => new RollingDate(RollingDate::T_TODAY),
],
];
}
/**
* @inheritDoc
*/
public function getQueryBuilders()
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()
->select('person.id')
->from(Person::class, 'person'),
];
}
}