Merge branch '242-export-add-filter-course-having-temporary-location' into 'master'

Add HasTemporaryLocationFilter test and update filter parameters

Closes #242

See merge request Chill-Projet/chill-bundles!645
This commit is contained in:
Julien Fastré 2024-02-07 13:35:52 +00:00
commit 0c9010f065
2 changed files with 68 additions and 1 deletions

View File

@ -70,7 +70,7 @@ class HasTemporaryLocationFilter implements FilterInterface
},
])
->add('calc_date', PickRollingDateType::class, [
'label' => 'export.filter.course.having_temporarily.Calculation date',
'label' => 'export.filter.course.having_temporarily.Calculation date', 'having_temporarily' => true,
]);
}

View File

@ -0,0 +1,67 @@
<?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\AccompanyingCourseFilters;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Chill\MainBundle\Test\Export\AbstractFilterTest;
use Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\HasTemporaryLocationFilter;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
*
* @coversNothing
*/
class HasTemporaryLocationFilterTest extends AbstractFilterTest
{
private RollingDateConverterInterface $rollingDateConverter;
protected function setUp(): void
{
self::bootKernel();
$this->rollingDateConverter = self::$container->get(RollingDateConverterInterface::class);
}
public function getFilter()
{
return new HasTemporaryLocationFilter($this->rollingDateConverter);
}
public function getFormData()
{
return [
[
'having_temporarily' => true,
'calc_date' => new RollingDate(RollingDate::T_TODAY),
],
[
'having_temporarily' => false,
'calc_date' => new RollingDate(RollingDate::T_TODAY),
],
];
}
public function getQueryBuilders()
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
return [
$em->createQueryBuilder()
->from('ChillPersonBundle:AccompanyingPeriod', 'acp')
->select('acp.id'),
];
}
}