TraceableAccessDecisionManager example

class TraceableAccessDecisionManagerTest extends TestCase
{
    /** * @dataProvider provideObjectsAndLogs */
    public function testDecideLog(array $expectedLog, array $attributes$object, array $voterVotes, bool $result)
    {
        $token = $this->createMock(TokenInterface::class);
        $admMock = $this->createMock(AccessDecisionManagerInterface::class);

        $adm = new TraceableAccessDecisionManager($admMock);

        $admMock
            ->expects($this->once())
            ->method('decide')
            ->with($token$attributes$object)
            ->willReturnCallback(function D$token$attributes$object) use ($voterVotes$adm$result) {
                foreach ($voterVotes as $voterVote) {
                    [$voter$vote] = $voterVote;
                    $adm->addVoterVote($voter$attributes$vote);
                }

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