public function denyAccessUnlessGranted($attributes, $object = null, $message = 'Access Denied.') { parent::denyAccessUnlessGranted($attributes, $object, $message); }
/** * @expectedException \Symfony\Component\Security\Core\Exception\AccessDeniedException */ public function testdenyAccessUnlessGranted() { $authorizationChecker = $this->getMock('Symfony\\Component\\Security\\Core\\Authorization\\AuthorizationCheckerInterface'); $authorizationChecker->expects($this->once())->method('isGranted')->willReturn(false); $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface'); $container->expects($this->at(0))->method('has')->will($this->returnValue(true)); $container->expects($this->at(1))->method('get')->will($this->returnValue($authorizationChecker)); $controller = new TestController(); $controller->setContainer($container); $controller->denyAccessUnlessGranted('foo'); }