DummyVoter example

return $result;
            })
        ;

        $adm->decide($token$attributes$object);

        $this->assertEquals($expectedLog$adm->getDecisionLog());
    }

    public static function provideObjectsAndLogs(): \Generator
    {
        $voter1 = new DummyVoter();
        $voter2 = new DummyVoter();

        yield [
            [[
                'attributes' => ['ATTRIBUTE_1'],
                'object' => null,
                'result' => true,
                'voterDetails' => [
                    ['voter' => $voter1, 'attributes' => ['ATTRIBUTE_1'], 'vote' => VoterInterface::ACCESS_GRANTED],
                    ['voter' => $voter2, 'attributes' => ['ATTRIBUTE_1'], 'vote' => VoterInterface::ACCESS_GRANTED],
                ],
            ]],
$collector = new SecurityDataCollector(null, null, null, null, $firewallMap$firewall, true);
        $collector->collect($request$response);

        $this->assertNotEmpty($collected = $collector->getListeners()[0]);
        $collector->lateCollect();
        $this->assertSame(1, $listenerCalled);
    }

    public function testCollectCollectsDecisionLogWhenStrategyIsAffirmative()
    {
        $voter1 = new DummyVoter();
        $voter2 = new DummyVoter();

        $decoratedVoter1 = new TraceableVoter($voter1new class() implements EventDispatcherInterface {
            public function dispatch(object $event, string $eventName = null): object
            {
                return new \stdClass();
            }
        });

        $strategy = MainConfiguration::STRATEGY_AFFIRMATIVE;

        
Home | Imprint | This part of the site doesn't use cookies.