$voter =
new ExpressionVoter($this->
createExpressionLanguage($expressionLanguageExpectsEvaluate),
$this->
createTrustResolver(),
$this->
createAuthorizationChecker());
$this->
assertSame($expected,
$voter->
vote($this->
getTokenWithRoleNames($roles,
$tokenExpectsGetRoles), null,
$attributes));
} public static function getVoteTests() { return [ [[],
[], VoterInterface::ACCESS_ABSTAIN, false, false
],
[[],
['FOO'
], VoterInterface::ACCESS_ABSTAIN, false, false
],
[[],
[self::
createExpression()], VoterInterface::ACCESS_DENIED, true, false
],
[['ROLE_FOO'
],
[self::
createExpression(), self::
createExpression()], VoterInterface::ACCESS_GRANTED
],
[['ROLE_BAR', 'ROLE_FOO'
],
[self::
createExpression()], VoterInterface::ACCESS_GRANTED
],
];
} protected function getTokenWithRoleNames(array
$roles,
$tokenExpectsGetRoles = true
) { $token =
$this->
createMock(AbstractToken::
class);
if ($tokenExpectsGetRoles) {