Skip to content

Commit 2c66c1a

Browse files
Merge branch '5.4' into 6.2
* 5.4: [Serializer] Fix CsvEncoder decode on empty data [Tests] Migrate data providers to static ones stop using assertObjectHasAttribute()/assertObjectHasNotAttribute() [Dotenv] Fix phpdoc Dotenv [Config] Fix phpdoc nullable Fix some typos
2 parents a405888 + 26aa837 commit 2c66c1a

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

Tests/DataCollector/SecurityDataCollectorTest.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Symfony\Component\HttpKernel\HttpKernelInterface;
2525
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
2626
use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken;
27+
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2728
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
2829
use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager;
2930
use Symfony\Component\Security\Core\Authorization\Voter\TraceableVoter;
@@ -219,12 +220,17 @@ public function testGetListeners()
219220
$this->assertSame(1, $listenerCalled);
220221
}
221222

222-
public function providerCollectDecisionLog(): \Generator
223+
public static function providerCollectDecisionLog(): \Generator
223224
{
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+
};
228234
$decoratedVoter1 = new TraceableVoter($voter1, $eventDispatcher);
229235

230236
yield [
@@ -349,7 +355,7 @@ public function testCollectDecisionLog(string $strategy, array $decisionLog, arr
349355
$this->assertSame($dataCollector->getVoterStrategy(), $strategy, 'Wrong value returned by getVoterStrategy');
350356
}
351357

352-
public function provideRoles()
358+
public static function provideRoles()
353359
{
354360
return [
355361
// Basic roles
@@ -380,3 +386,10 @@ private function getRoleHierarchy()
380386
]);
381387
}
382388
}
389+
390+
class DummyVoter implements VoterInterface
391+
{
392+
public function vote(TokenInterface $token, $subject, array $attributes)
393+
{
394+
}
395+
}

0 commit comments

Comments
 (0)