mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-03 07:26:12 +00:00
Fix test
This commit is contained in:
parent
e336d67fa7
commit
2c85de05b8
@ -38,7 +38,10 @@ final class SavedExportVoter extends Voter
|
|||||||
self::DUPLICATE,
|
self::DUPLICATE,
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct(private readonly ExportManager $exportManager, private readonly AccessDecisionManagerInterface $accessDecisionManager) {}
|
public function __construct(
|
||||||
|
private readonly ExportManager $exportManager,
|
||||||
|
private readonly AccessDecisionManagerInterface $accessDecisionManager,
|
||||||
|
) {}
|
||||||
|
|
||||||
protected function supports($attribute, $subject): bool
|
protected function supports($attribute, $subject): bool
|
||||||
{
|
{
|
||||||
|
@ -21,6 +21,7 @@ use PHPUnit\Framework\TestCase;
|
|||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
||||||
|
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
|
||||||
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,7 +43,9 @@ class SavedExportVoterTest extends TestCase
|
|||||||
$exportManager->getExport('dummy_export')->willReturn($export->reveal());
|
$exportManager->getExport('dummy_export')->willReturn($export->reveal());
|
||||||
$exportManager->isGrantedForElement(Argument::any())->willReturn($isGranted);
|
$exportManager->isGrantedForElement(Argument::any())->willReturn($isGranted);
|
||||||
|
|
||||||
$voter = new SavedExportVoter($exportManager->reveal());
|
$accessDecisionManager = $this->prophesize(AccessDecisionManagerInterface::class);
|
||||||
|
|
||||||
|
$voter = new SavedExportVoter($exportManager->reveal(), $accessDecisionManager->reveal());
|
||||||
$token = new UsernamePasswordToken($user, 'default', ['ROLE_USER']);
|
$token = new UsernamePasswordToken($user, 'default', ['ROLE_USER']);
|
||||||
|
|
||||||
self::assertEquals($expectedResult, $voter->vote($token, $savedExport, [$attribute]));
|
self::assertEquals($expectedResult, $voter->vote($token, $savedExport, [$attribute]));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user