mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-28 01:25:00 +00:00
Use dedicated FilterListAccompanyingPeriodHelper to filter confidential course in different lists
This commit is contained in:
@@ -1,5 +1,14 @@
|
||||
<?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\Helper;
|
||||
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
@@ -13,7 +22,6 @@ use Chill\PersonBundle\Export\Helper\FilterListAccompanyingPeriodHelper;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\Argument;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
@@ -21,6 +29,11 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class FilterListAccompanyingPeriodHelperTest extends KernelTestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
@@ -40,7 +53,6 @@ final class FilterListAccompanyingPeriodHelperTest extends KernelTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @dataProvider dataProviderTestAddFilterAccompanyingPeriod
|
||||
*/
|
||||
public function testAddFilterAccompanyingPeriod(QueryBuilder $qb, ParameterBagInterface $parameterBag): void
|
||||
@@ -64,11 +76,11 @@ final class FilterListAccompanyingPeriodHelperTest extends KernelTestCase
|
||||
->willReturn($scopesConfidentials);
|
||||
|
||||
$filter = new FilterListAccompanyingPeriodHelper(
|
||||
$security->reveal(),
|
||||
$this->centerRepository,
|
||||
$authorizationHelper->reveal(),
|
||||
$parameterBag
|
||||
);
|
||||
$security->reveal(),
|
||||
$this->centerRepository,
|
||||
$authorizationHelper->reveal(),
|
||||
$parameterBag
|
||||
);
|
||||
|
||||
$filter->addFilterAccompanyingPeriods($qb, [], $this->getACL(), []);
|
||||
|
||||
@@ -89,19 +101,19 @@ final class FilterListAccompanyingPeriodHelperTest extends KernelTestCase
|
||||
|
||||
yield [
|
||||
$qb,
|
||||
new ParameterBag(['chill_main' => ['acl' => ['filter_stats_by_center' => true]]])
|
||||
new ParameterBag(['chill_main' => ['acl' => ['filter_stats_by_center' => true]]]),
|
||||
];
|
||||
|
||||
yield [
|
||||
$qb,
|
||||
new ParameterBag(['chill_main' => ['acl' => ['filter_stats_by_center' => false]]])
|
||||
new ParameterBag(['chill_main' => ['acl' => ['filter_stats_by_center' => false]]]),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{center: Center, circles: list<Scope>}> The ACL, structured as an array.
|
||||
* @return list<array{center: Center, circles: list<Scope>}> the ACL, structured as an array
|
||||
*
|
||||
* @throws \RuntimeException When no center or circle is found.
|
||||
* @throws \RuntimeException when no center or circle is found
|
||||
*/
|
||||
private function getACL(): array
|
||||
{
|
||||
|
Reference in New Issue
Block a user