|
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;
|
@@ -219,12 +220,17 @@ public function testGetListeners()
|
219 | 220 | $this->assertSame(1, $listenerCalled);
|
220 | 221 | }
|
221 | 222 |
|
222 |
| - public function providerCollectDecisionLog(): \Generator |
| 223 | + public static function providerCollectDecisionLog(): \Generator |
223 | 224 | {
|
224 |
| - $voter1 = $this->getMockBuilder(VoterInterface::class)->getMockForAbstractClass(); |
225 |
| - $voter2 = $this->getMockBuilder(VoterInterface::class)->getMockForAbstractClass(); |
226 |
| - |
227 |
| - $eventDispatcher = $this->getMockBuilder(EventDispatcherInterface::class)->getMockForAbstractClass(); |
| 225 | + $voter1 = new DummyVoter(); |
| 226 | + $voter2 = new DummyVoter(); |
| 227 | + |
| 228 | + $eventDispatcher = new class() implements EventDispatcherInterface { |
| 229 | + public function dispatch(object $event, string $eventName = null): object |
| 230 | + { |
| 231 | + return new \stdClass(); |
| 232 | + } |
| 233 | + }; |
228 | 234 | $decoratedVoter1 = new TraceableVoter($voter1, $eventDispatcher);
|
229 | 235 |
|
230 | 236 | yield [
|
@@ -349,7 +355,7 @@ public function testCollectDecisionLog(string $strategy, array $decisionLog, arr
|
349 | 355 | $this->assertSame($dataCollector->getVoterStrategy(), $strategy, 'Wrong value returned by getVoterStrategy');
|
350 | 356 | }
|
351 | 357 |
|
352 |
| - public function provideRoles() |
| 358 | + public static function provideRoles() |
353 | 359 | {
|
354 | 360 | return [
|
355 | 361 | // Basic roles
|
@@ -380,3 +386,10 @@ private function getRoleHierarchy()
|
380 | 386 | ]);
|
381 | 387 | }
|
382 | 388 | }
|
| 389 | + |
| 390 | +class DummyVoter implements VoterInterface |
| 391 | +{ |
| 392 | + public function vote(TokenInterface $token, $subject, array $attributes) |
| 393 | + { |
| 394 | + } |
| 395 | +} |
0 commit comments