$token =
$this->
getMockBuilder(TokenInterface::
class)->
getMockForAbstractClass();
$voter ->
expects($this->
once()) ->
method('vote'
) ->
with($token, 'anysubject',
['attr1'
]) ->
willReturn(VoterInterface::ACCESS_DENIED
);
$eventDispatcher ->
expects($this->
once()) ->
method('dispatch'
) ->
with(new VoteEvent($voter, 'anysubject',
['attr1'
], VoterInterface::ACCESS_DENIED
), 'debug.security.authorization.vote'
);
$sut =
new TraceableVoter($voter,
$eventDispatcher);
$result =
$sut->
vote($token, 'anysubject',
['attr1'
]);
$this->
assertSame(VoterInterface::ACCESS_DENIED,
$result);
} public function testSupportsAttributeOnCacheable() { $voter =
$this->
getMockBuilder(CacheableVoterInterface::
class)->
getMockForAbstractClass();
$eventDispatcher =
$this->
getMockBuilder(EventDispatcherInterface::
class)->
getMockForAbstractClass();