This method must return one of the following constants:
ACCESS_GRANTED, ACCESS_DENIED, or ACCESS_ABSTAIN.
public vote ( Symfony\Component\Security\Core\Authentication\Token\TokenInterface $token, object $object, array $attributes ) : integer | ||
$token | Symfony\Component\Security\Core\Authentication\Token\TokenInterface | A TokenInterface instance |
$object | object | The object to secure |
$attributes | array | An array of attributes associated with the method being invoked |
return | integer | either ACCESS_GRANTED, ACCESS_ABSTAIN, or ACCESS_DENIED |
/** * @dataProvider voteProvider */ public function testVote(Attribute $attribute, $repositoryCanUser, $expectedResult) { $voter = new CoreVoter($this->repository); if ($repositoryCanUser !== null) { $this->repository->expects($this->once())->method('hasAccess')->with($attribute->module, $attribute->function)->will($this->returnValue($repositoryCanUser)); } else { $this->repository->expects($this->never())->method('hasAccess'); } $this->assertSame($expectedResult, $voter->vote($this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface'), new \stdClass(), array($attribute))); }