From 2c85de05b80c26c08aee33ad960b542a085be003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 2 Jul 2025 12:22:49 +0200 Subject: [PATCH] Fix test --- .../Security/Authorization/SavedExportVoter.php | 5 ++++- .../Tests/Security/Authorization/SavedExportVoterTest.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/SavedExportVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/SavedExportVoter.php index 1e34fa1fa..ec749f725 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/SavedExportVoter.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/SavedExportVoter.php @@ -38,7 +38,10 @@ final class SavedExportVoter extends Voter 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 { diff --git a/src/Bundle/ChillMainBundle/Tests/Security/Authorization/SavedExportVoterTest.php b/src/Bundle/ChillMainBundle/Tests/Security/Authorization/SavedExportVoterTest.php index efa2312cd..f2eefa055 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/Authorization/SavedExportVoterTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/Authorization/SavedExportVoterTest.php @@ -21,6 +21,7 @@ use PHPUnit\Framework\TestCase; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface; use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; /** @@ -42,7 +43,9 @@ class SavedExportVoterTest extends TestCase $exportManager->getExport('dummy_export')->willReturn($export->reveal()); $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']); self::assertEquals($expectedResult, $voter->vote($token, $savedExport, [$attribute]));