synchronize the fixtures in different formats and fix default for numeric requirement
This commit is contained in:
parent
6cd34570d7
commit
9ffe3de642
@ -6,7 +6,7 @@ $collection = new RouteCollection();
|
||||
$collection->add('blog_show', new Route(
|
||||
'/blog/{slug}',
|
||||
array('_controller' => 'MyBlogBundle:Blog:show'),
|
||||
array('_method' => 'GET'),
|
||||
array('_method' => 'GET', 'locale' => '\w+'),
|
||||
array('compiler_class' => 'RouteCompiler'),
|
||||
'{locale}.example.com'
|
||||
));
|
||||
|
@ -7,6 +7,7 @@
|
||||
<route id="blog_show" pattern="/blog/{slug}" hostname-pattern="{locale}.example.com">
|
||||
<default key="_controller">MyBundle:Blog:show</default>
|
||||
<requirement key="_method">GET</requirement>
|
||||
<requirement key="locale">\w+</requirement>
|
||||
<option key="compiler_class">RouteCompiler</option>
|
||||
</route>
|
||||
</routes>
|
||||
|
@ -2,6 +2,6 @@ blog_show:
|
||||
pattern: /blog/{slug}
|
||||
defaults: { _controller: MyBlogBundle:Blog:show }
|
||||
hostname_pattern: "{locale}.example.com"
|
||||
requirements: { 'locale': '\d+' }
|
||||
requirements: { '_method': 'GET', 'locale': '\w+' }
|
||||
options:
|
||||
compiler_class: RouteCompiler
|
||||
|
@ -5,7 +5,7 @@
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<import resource="validpattern.xml" prefix="/{foo}" hostname-pattern="{locale}.example.com">
|
||||
<default key="foo">foo</default>
|
||||
<default key="foo">123</default>
|
||||
<requirement key="foo">\d+</requirement>
|
||||
<option key="foo">bar</option>
|
||||
</import>
|
||||
|
@ -1,7 +1,7 @@
|
||||
blog_show:
|
||||
resource: validpattern.yml
|
||||
prefix: /{foo}
|
||||
defaults: { 'foo': 'foo' }
|
||||
defaults: { 'foo': '123' }
|
||||
requirements: { 'foo': '\d+' }
|
||||
options: { 'foo': 'bar' }
|
||||
hostname_pattern: "{locale}.example.com"
|
||||
|
@ -51,6 +51,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('/blog/{slug}', $route->getPattern());
|
||||
$this->assertEquals('MyBundle:Blog:show', $route->getDefault('_controller'));
|
||||
$this->assertEquals('GET', $route->getRequirement('_method'));
|
||||
$this->assertEquals('\w+', $route->getRequirement('locale'));
|
||||
$this->assertEquals('{locale}.example.com', $route->getHostnamePattern());
|
||||
$this->assertEquals('RouteCompiler', $route->getOption('compiler_class'));
|
||||
}
|
||||
@ -65,7 +66,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
||||
$this->assertEquals('/{foo}/blog/{slug}', $routes['blog_show']->getPattern());
|
||||
$this->assertEquals('MyBundle:Blog:show', $routes['blog_show']->getDefault('_controller'));
|
||||
$this->assertEquals('foo', $routes['blog_show']->getDefault('foo'));
|
||||
$this->assertEquals('123', $routes['blog_show']->getDefault('foo'));
|
||||
$this->assertEquals('\d+', $routes['blog_show']->getRequirement('foo'));
|
||||
$this->assertEquals('bar', $routes['blog_show']->getOption('foo'));
|
||||
$this->assertEquals('{locale}.example.com', $routes['blog_show']->getHostnamePattern());
|
||||
|
@ -90,7 +90,8 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
$route = $routes['blog_show'];
|
||||
$this->assertEquals('/blog/{slug}', $route->getPattern());
|
||||
$this->assertEquals('MyBlogBundle:Blog:show', $route->getDefault('_controller'));
|
||||
$this->assertEquals('\d+', $route->getRequirement('locale'));
|
||||
$this->assertEquals('GET', $route->getRequirement('_method'));
|
||||
$this->assertEquals('\w+', $route->getRequirement('locale'));
|
||||
$this->assertEquals('{locale}.example.com', $route->getHostnamePattern());
|
||||
$this->assertEquals('RouteCompiler', $route->getOption('compiler_class'));
|
||||
}
|
||||
@ -105,7 +106,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
||||
$this->assertEquals('/{foo}/blog/{slug}', $routes['blog_show']->getPattern());
|
||||
$this->assertEquals('MyBlogBundle:Blog:show', $routes['blog_show']->getDefault('_controller'));
|
||||
$this->assertEquals('foo', $routes['blog_show']->getDefault('foo'));
|
||||
$this->assertEquals('123', $routes['blog_show']->getDefault('foo'));
|
||||
$this->assertEquals('\d+', $routes['blog_show']->getRequirement('foo'));
|
||||
$this->assertEquals('bar', $routes['blog_show']->getOption('foo'));
|
||||
$this->assertEquals('{locale}.example.com', $routes['blog_show']->getHostnamePattern());
|
||||
|
Reference in New Issue
Block a user