Symfony\Bundle\FrameworkBundle\Tests\Controller\TestController::isGranted PHP Method

isGranted() public method

public isGranted ( $attributes, $object = null )
    public function isGranted($attributes, $object = null)
    {
        return parent::isGranted($attributes, $object);
    }

Usage Example

Ejemplo n.º 1
0
 public function testIsGranted()
 {
     $authorizationChecker = $this->getMock('Symfony\\Component\\Security\\Core\\Authorization\\AuthorizationCheckerInterface');
     $authorizationChecker->expects($this->once())->method('isGranted')->willReturn(true);
     $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);
     $this->assertTrue($controller->isGranted('foo'));
 }