|
24 | 24 | use Symfony\Component\HttpKernel\HttpKernelInterface; |
25 | 25 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; |
26 | 26 | use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken; |
| 27 | +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; |
27 | 28 | use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; |
28 | 29 | use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager; |
29 | 30 | use Symfony\Component\Security\Core\Authorization\Voter\TraceableVoter; |
@@ -222,12 +223,17 @@ public function testGetListeners() |
222 | 223 | $this->assertSame(1, $listenerCalled); |
223 | 224 | } |
224 | 225 |
|
225 | | - public function providerCollectDecisionLog(): \Generator |
| 226 | + public static function providerCollectDecisionLog(): \Generator |
226 | 227 | { |
227 | | - $voter1 = $this->getMockBuilder(VoterInterface::class)->getMockForAbstractClass(); |
228 | | - $voter2 = $this->getMockBuilder(VoterInterface::class)->getMockForAbstractClass(); |
229 | | - |
230 | | - $eventDispatcher = $this->getMockBuilder(EventDispatcherInterface::class)->getMockForAbstractClass(); |
| 228 | + $voter1 = new DummyVoter(); |
| 229 | + $voter2 = new DummyVoter(); |
| 230 | + |
| 231 | + $eventDispatcher = new class() implements EventDispatcherInterface { |
| 232 | + public function dispatch(object $event, string $eventName = null): object |
| 233 | + { |
| 234 | + return new \stdClass(); |
| 235 | + } |
| 236 | + }; |
231 | 237 | $decoratedVoter1 = new TraceableVoter($voter1, $eventDispatcher); |
232 | 238 |
|
233 | 239 | yield [ |
@@ -352,7 +358,7 @@ public function testCollectDecisionLog(string $strategy, array $decisionLog, arr |
352 | 358 | $this->assertSame($dataCollector->getVoterStrategy(), $strategy, 'Wrong value returned by getVoterStrategy'); |
353 | 359 | } |
354 | 360 |
|
355 | | - public function provideRoles() |
| 361 | + public static function provideRoles() |
356 | 362 | { |
357 | 363 | return [ |
358 | 364 | // Basic roles |
@@ -383,3 +389,10 @@ private function getRoleHierarchy() |
383 | 389 | ]); |
384 | 390 | } |
385 | 391 | } |
| 392 | + |
| 393 | +class DummyVoter implements VoterInterface |
| 394 | +{ |
| 395 | + public function vote(TokenInterface $token, $subject, array $attributes) |
| 396 | + { |
| 397 | + } |
| 398 | +} |
0 commit comments