Symfony\Bundle\FrameworkBundle\Tests\Controller\ControllerNameParserTest::testBuild PHP Method

testBuild() public method

public testBuild ( )
    public function testBuild()
    {
        $parser = $this->createParser();
        $this->assertEquals('FoooooBundle:Default:index', $parser->build('TestBundle\\FooBundle\\Controller\\DefaultController::indexAction'), '->parse() converts a class::method string to a short a:b:c notation string');
        $this->assertEquals('FoooooBundle:Sub\\Default:index', $parser->build('TestBundle\\FooBundle\\Controller\\Sub\\DefaultController::indexAction'), '->parse() converts a class::method string to a short a:b:c notation string');
        try {
            $parser->build('TestBundle\\FooBundle\\Controller\\DefaultController::index');
            $this->fail('->parse() throws an \\InvalidArgumentException if the controller is not an aController::cAction string');
        } catch (\Exception $e) {
            $this->assertInstanceOf('\\InvalidArgumentException', $e, '->parse() throws an \\InvalidArgumentException if the controller is not an aController::cAction string');
        }
        try {
            $parser->build('TestBundle\\FooBundle\\Controller\\Default::indexAction');
            $this->fail('->parse() throws an \\InvalidArgumentException if the controller is not an aController::cAction string');
        } catch (\Exception $e) {
            $this->assertInstanceOf('\\InvalidArgumentException', $e, '->parse() throws an \\InvalidArgumentException if the controller is not an aController::cAction string');
        }
        try {
            $parser->build('Foo\\Controller\\DefaultController::indexAction');
            $this->fail('->parse() throws an \\InvalidArgumentException if the controller is not an aController::cAction string');
        } catch (\Exception $e) {
            $this->assertInstanceOf('\\InvalidArgumentException', $e, '->parse() throws an \\InvalidArgumentException if the controller is not an aController::cAction string');
        }
    }