[Routing] added some unit tests for the PHP loader
This commit is contained in:
parent
68da6ad292
commit
153fcf2596
@ -6,8 +6,9 @@ $collection = new RouteCollection();
|
||||
$collection->add('blog_show', new Route(
|
||||
'/blog/{slug}',
|
||||
array('_controller' => 'MyBlogBundle:Blog:show'),
|
||||
array(),
|
||||
array('compiler_class' => 'RouteCompiler')
|
||||
array('_method' => 'GET'),
|
||||
array('compiler_class' => 'RouteCompiler'),
|
||||
'{locale}.example.com'
|
||||
));
|
||||
|
||||
return $collection;
|
||||
|
@ -47,6 +47,10 @@ class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(1, count($routes), 'One route is loaded');
|
||||
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
||||
$route = $routes['blog_show'];
|
||||
$this->assertEquals('/blog/{slug}', $route->getPattern());
|
||||
$this->assertEquals('MyBlogBundle:Blog:show', $route->getDefault('_controller'));
|
||||
$this->assertEquals('GET', $route->getRequirement('_method'));
|
||||
$this->assertEquals('{locale}.example.com', $route->getHostnamePattern());
|
||||
$this->assertEquals('RouteCompiler', $route->getOption('compiler_class'));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user