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

isCsrfTokenValid() public method

public isCsrfTokenValid ( $id, $token )
    public function isCsrfTokenValid($id, $token)
    {
        return parent::isCsrfTokenValid($id, $token);
    }

Usage Example

 public function testIsCsrfTokenValid()
 {
     $tokenManager = $this->getMock('Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface');
     $tokenManager->expects($this->once())->method('isTokenValid')->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($tokenManager));
     $controller = new TestController();
     $controller->setContainer($container);
     $this->assertTrue($controller->isCsrfTokenValid('foo', 'bar'));
 }