merged branch vicb/routing_cleanup (PR #3647)
Commits
-------
a8e17fe
[Routing] Cleanup
Discussion
----------
[Routing] Cleanup
removing the obsolete `segment_separators` option
This commit is contained in:
commit
69fc07a21c
@ -37,7 +37,7 @@ class RouteTest extends \PHPUnit_Framework_TestCase
|
||||
return array(
|
||||
array('value', '/Blog', 'getPattern'),
|
||||
array('requirements', array('_method' => 'GET'), 'getRequirements'),
|
||||
array('options', array('segment_separators' => array('/')), 'getOptions'),
|
||||
array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'),
|
||||
array('name', 'blog_index', 'getName'),
|
||||
array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults')
|
||||
);
|
||||
|
@ -7,7 +7,7 @@
|
||||
<route id="blog_show" pattern="/blog/{slug}">
|
||||
<default key="_controller">MyBundle:Blog:show</default>
|
||||
<requirement key="_method">GET</requirement>
|
||||
<option key="segment_separators">/</option>
|
||||
<option key="compiler_class">RouteCompiler</option>
|
||||
<foo key="bar">baz</foo>
|
||||
</route>
|
||||
</routes>
|
||||
|
@ -3,8 +3,11 @@ use Symfony\Component\Routing\RouteCollection;
|
||||
use Symfony\Component\Routing\Route;
|
||||
|
||||
$collection = new RouteCollection();
|
||||
$collection->add('blog_show', new Route('/blog/{slug}', array(
|
||||
'_controller' => 'MyBlogBundle:Blog:show',
|
||||
)));
|
||||
$collection->add('blog_show', new Route(
|
||||
'/blog/{slug}',
|
||||
array('_controller' => 'MyBlogBundle:Blog:show'),
|
||||
array(),
|
||||
array('compiler_class' => 'RouteCompiler')
|
||||
));
|
||||
|
||||
return $collection;
|
||||
|
@ -7,6 +7,6 @@
|
||||
<route id="blog_show" pattern="/blog/{slug}">
|
||||
<default key="_controller">MyBundle:Blog:show</default>
|
||||
<requirement key="_method">GET</requirement>
|
||||
<option key="segment_separators">/</option>
|
||||
<option key="compiler_class">RouteCompiler</option>
|
||||
</route>
|
||||
</routes>
|
||||
|
@ -1,4 +1,6 @@
|
||||
blog_show:
|
||||
pattern: /blog/{slug}
|
||||
defaults: { _controller: MyBlogBundle:Blog:show }
|
||||
options:
|
||||
compiler_class: RouteCompiler
|
||||
|
||||
|
@ -39,6 +39,8 @@ 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('RouteCompiler', $route->getOption('compiler_class'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,8 @@ class XmlFileLoaderTest 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('RouteCompiler', $route->getOption('compiler_class'));
|
||||
}
|
||||
|
||||
public function testLoadWithImport()
|
||||
|
@ -76,6 +76,8 @@ class YamlFileLoaderTest 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('RouteCompiler', $route->getOption('compiler_class'));
|
||||
}
|
||||
|
||||
public function testLoadWithResource()
|
||||
|
Reference in New Issue
Block a user