$this->
expectException(AccessDeniedException::
class);
$authorizationChecker =
$this->
createMock(AuthorizationCheckerInterface::
class);
$authorizationChecker->
expects($this->
once())->
method('isGranted'
)->
willReturn(false
);
$container =
new Container();
$container->
set('security.authorization_checker',
$authorizationChecker);
$controller =
$this->
createController();
$controller->
setContainer($container);
$controller->
denyAccessUnlessGranted('foo'
);
} /**
* @dataProvider provideDenyAccessUnlessGrantedSetsAttributesAsArray
*/
public function testdenyAccessUnlessGrantedSetsAttributesAsArray($attribute,
$exceptionAttributes) { $authorizationChecker =
$this->
createMock(AuthorizationCheckerInterface::
class);
$authorizationChecker->
method('isGranted'
)->
willReturn(false
);
$container =
new Container();