replaced usage of the deprecated pattern routing key (replaced with path)
This commit is contained in:
parent
3446cb219a
commit
73aa7d128b
@ -1,23 +1,23 @@
|
|||||||
session_welcome:
|
session_welcome:
|
||||||
pattern: /session
|
path: /session
|
||||||
defaults: { _controller: TestBundle:Session:welcome }
|
defaults: { _controller: TestBundle:Session:welcome }
|
||||||
|
|
||||||
session_welcome_name:
|
session_welcome_name:
|
||||||
pattern: /session/{name}
|
path: /session/{name}
|
||||||
defaults: { _controller: TestBundle:Session:welcome }
|
defaults: { _controller: TestBundle:Session:welcome }
|
||||||
|
|
||||||
session_logout:
|
session_logout:
|
||||||
pattern: /session_logout
|
path: /session_logout
|
||||||
defaults: { _controller: TestBundle:Session:logout}
|
defaults: { _controller: TestBundle:Session:logout}
|
||||||
|
|
||||||
session_setflash:
|
session_setflash:
|
||||||
pattern: /session_setflash/{message}
|
path: /session_setflash/{message}
|
||||||
defaults: { _controller: TestBundle:Session:setFlash}
|
defaults: { _controller: TestBundle:Session:setFlash}
|
||||||
|
|
||||||
session_showflash:
|
session_showflash:
|
||||||
pattern: /session_showflash
|
path: /session_showflash
|
||||||
defaults: { _controller: TestBundle:Session:showFlash}
|
defaults: { _controller: TestBundle:Session:showFlash}
|
||||||
|
|
||||||
profiler:
|
profiler:
|
||||||
pattern: /profiler
|
path: /profiler
|
||||||
defaults: { _controller: TestBundle:Profiler:index }
|
defaults: { _controller: TestBundle:Profiler:index }
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
form_login:
|
form_login:
|
||||||
pattern: /login
|
path: /login
|
||||||
defaults: { _controller: CsrfFormLoginBundle:Login:login }
|
defaults: { _controller: CsrfFormLoginBundle:Login:login }
|
||||||
|
|
||||||
form_login_check:
|
form_login_check:
|
||||||
pattern: /login_check
|
path: /login_check
|
||||||
defaults: { _controller: CsrfFormLoginBundle:Login:loginCheck }
|
defaults: { _controller: CsrfFormLoginBundle:Login:loginCheck }
|
||||||
|
|
||||||
form_login_homepage:
|
form_login_homepage:
|
||||||
pattern: /
|
path: /
|
||||||
defaults: { _controller: CsrfFormLoginBundle:Login:afterLogin }
|
defaults: { _controller: CsrfFormLoginBundle:Login:afterLogin }
|
||||||
|
|
||||||
form_login_custom_target_path:
|
form_login_custom_target_path:
|
||||||
pattern: /foo
|
path: /foo
|
||||||
defaults: { _controller: CsrfFormLoginBundle:Login:afterLogin }
|
defaults: { _controller: CsrfFormLoginBundle:Login:afterLogin }
|
||||||
|
|
||||||
form_login_default_target_path:
|
form_login_default_target_path:
|
||||||
pattern: /profile
|
path: /profile
|
||||||
defaults: { _controller: CsrfFormLoginBundle:Login:afterLogin }
|
defaults: { _controller: CsrfFormLoginBundle:Login:afterLogin }
|
||||||
|
|
||||||
form_login_redirect_to_protected_resource_after_login:
|
form_login_redirect_to_protected_resource_after_login:
|
||||||
pattern: /protected-resource
|
path: /protected-resource
|
||||||
defaults: { _controller: CsrfFormLoginBundle:Login:afterLogin }
|
defaults: { _controller: CsrfFormLoginBundle:Login:afterLogin }
|
||||||
|
|
||||||
form_logout:
|
form_logout:
|
||||||
pattern: /logout_path
|
path: /logout_path
|
||||||
|
|
||||||
form_secure_action:
|
form_secure_action:
|
||||||
pattern: /secure-but-not-covered-by-access-control
|
path: /secure-but-not-covered-by-access-control
|
||||||
defaults: { _controller: CsrfFormLoginBundle:Login:secure }
|
defaults: { _controller: CsrfFormLoginBundle:Login:secure }
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
localized_login_path:
|
localized_login_path:
|
||||||
pattern: /{_locale}/login
|
path: /{_locale}/login
|
||||||
defaults: { _controller: FormLoginBundle:Localized:login }
|
defaults: { _controller: FormLoginBundle:Localized:login }
|
||||||
requirements: { _locale: "^[a-z]{2}$" }
|
requirements: { _locale: "^[a-z]{2}$" }
|
||||||
|
|
||||||
localized_check_path:
|
localized_check_path:
|
||||||
pattern: /{_locale}/login_check
|
path: /{_locale}/login_check
|
||||||
defaults: { _controller: FormLoginBundle:Localized:loginCheck }
|
defaults: { _controller: FormLoginBundle:Localized:loginCheck }
|
||||||
requirements: { _locale: "^[a-z]{2}$" }
|
requirements: { _locale: "^[a-z]{2}$" }
|
||||||
|
|
||||||
localized_default_target_path:
|
localized_default_target_path:
|
||||||
pattern: /{_locale}/profile
|
path: /{_locale}/profile
|
||||||
defaults: { _controller: FormLoginBundle:Localized:profile }
|
defaults: { _controller: FormLoginBundle:Localized:profile }
|
||||||
requirements: { _locale: "^[a-z]{2}$" }
|
requirements: { _locale: "^[a-z]{2}$" }
|
||||||
|
|
||||||
localized_logout_path:
|
localized_logout_path:
|
||||||
pattern: /{_locale}/logout
|
path: /{_locale}/logout
|
||||||
defaults: { _controller: FormLoginBundle:Localized:logout }
|
defaults: { _controller: FormLoginBundle:Localized:logout }
|
||||||
requirements: { _locale: "^[a-z]{2}$" }
|
requirements: { _locale: "^[a-z]{2}$" }
|
||||||
|
|
||||||
localized_logout_target_path:
|
localized_logout_target_path:
|
||||||
pattern: /{_locale}/
|
path: /{_locale}/
|
||||||
defaults: { _controller: FormLoginBundle:Localized:homepage }
|
defaults: { _controller: FormLoginBundle:Localized:homepage }
|
||||||
requirements: { _locale: "^[a-z]{2}$" }
|
requirements: { _locale: "^[a-z]{2}$" }
|
||||||
|
|
||||||
localized_secure_path:
|
localized_secure_path:
|
||||||
pattern: /{_locale}/secure/
|
path: /{_locale}/secure/
|
||||||
defaults: { _controller: FormLoginBundle:Localized:secure }
|
defaults: { _controller: FormLoginBundle:Localized:secure }
|
||||||
requirements: { _locale: "^[a-z]{2}$" }
|
requirements: { _locale: "^[a-z]{2}$" }
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
form_login:
|
form_login:
|
||||||
pattern: /login
|
path: /login
|
||||||
defaults: { _controller: FormLoginBundle:Login:login }
|
defaults: { _controller: FormLoginBundle:Login:login }
|
||||||
|
|
||||||
form_login_check:
|
form_login_check:
|
||||||
pattern: /login_check
|
path: /login_check
|
||||||
defaults: { _controller: FormLoginBundle:Login:loginCheck }
|
defaults: { _controller: FormLoginBundle:Login:loginCheck }
|
||||||
|
|
||||||
form_login_homepage:
|
form_login_homepage:
|
||||||
pattern: /
|
path: /
|
||||||
defaults: { _controller: FormLoginBundle:Login:afterLogin }
|
defaults: { _controller: FormLoginBundle:Login:afterLogin }
|
||||||
|
|
||||||
form_login_custom_target_path:
|
form_login_custom_target_path:
|
||||||
pattern: /foo
|
path: /foo
|
||||||
defaults: { _controller: FormLoginBundle:Login:afterLogin }
|
defaults: { _controller: FormLoginBundle:Login:afterLogin }
|
||||||
|
|
||||||
form_login_default_target_path:
|
form_login_default_target_path:
|
||||||
pattern: /profile
|
path: /profile
|
||||||
defaults: { _controller: FormLoginBundle:Login:afterLogin }
|
defaults: { _controller: FormLoginBundle:Login:afterLogin }
|
||||||
|
|
||||||
form_login_redirect_to_protected_resource_after_login:
|
form_login_redirect_to_protected_resource_after_login:
|
||||||
pattern: /protected_resource
|
path: /protected_resource
|
||||||
defaults: { _controller: FormLoginBundle:Login:afterLogin }
|
defaults: { _controller: FormLoginBundle:Login:afterLogin }
|
||||||
|
|
||||||
highly_protected_resource:
|
highly_protected_resource:
|
||||||
pattern: /highly_protected_resource
|
path: /highly_protected_resource
|
||||||
|
|
||||||
form_logout:
|
form_logout:
|
||||||
pattern: /logout_path
|
path: /logout_path
|
||||||
|
|
||||||
form_secure_action:
|
form_secure_action:
|
||||||
pattern: /secure-but-not-covered-by-access-control
|
path: /secure-but-not-covered-by-access-control
|
||||||
defaults: { _controller: FormLoginBundle:Login:secure }
|
defaults: { _controller: FormLoginBundle:Login:secure }
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
blog_show:
|
blog_show:
|
||||||
resource: validpattern.yml
|
resource: validpattern.yml
|
||||||
pattern: /test
|
path: /test
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
blog_show:
|
blog_show:
|
||||||
pattern: /blog/{slug}
|
path: /blog/{slug}
|
||||||
type: custom
|
type: custom
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
"#$péß^a|":
|
"#$péß^a|":
|
||||||
pattern: "true"
|
path: "true"
|
||||||
|
@ -6,9 +6,18 @@ $collection = new RouteCollection();
|
|||||||
$collection->add('blog_show', new Route(
|
$collection->add('blog_show', new Route(
|
||||||
'/blog/{slug}',
|
'/blog/{slug}',
|
||||||
array('_controller' => 'MyBlogBundle:Blog:show'),
|
array('_controller' => 'MyBlogBundle:Blog:show'),
|
||||||
array('_method' => 'GET', 'locale' => '\w+'),
|
array('_method' => 'GET', 'locale' => '\w+', '_scheme' => 'https'),
|
||||||
array('compiler_class' => 'RouteCompiler'),
|
array('compiler_class' => 'RouteCompiler'),
|
||||||
'{locale}.example.com'
|
'{locale}.example.com'
|
||||||
));
|
));
|
||||||
|
$collection->add('blog_show_legacy', new Route(
|
||||||
|
'/blog/{slug}',
|
||||||
|
array('_controller' => 'MyBlogBundle:Blog:show'),
|
||||||
|
array('locale' => '\w+'),
|
||||||
|
array('compiler_class' => 'RouteCompiler'),
|
||||||
|
'{locale}.example.com',
|
||||||
|
array('https'),
|
||||||
|
array('GET')
|
||||||
|
));
|
||||||
|
|
||||||
return $collection;
|
return $collection;
|
||||||
|
@ -4,9 +4,16 @@
|
|||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||||
|
|
||||||
<route id="blog_show" pattern="/blog/{slug}" host="{locale}.example.com">
|
<route id="blog_show" path="/blog/{slug}" host="{locale}.example.com" methods="GET" schemes="https">
|
||||||
|
<default key="_controller">MyBundle:Blog:show</default>
|
||||||
|
<requirement key="locale">\w+</requirement>
|
||||||
|
<option key="compiler_class">RouteCompiler</option>
|
||||||
|
</route>
|
||||||
|
|
||||||
|
<route id="blog_show_legacy" pattern="/blog/{slug}" host="{locale}.example.com">
|
||||||
<default key="_controller">MyBundle:Blog:show</default>
|
<default key="_controller">MyBundle:Blog:show</default>
|
||||||
<requirement key="_method">GET</requirement>
|
<requirement key="_method">GET</requirement>
|
||||||
|
<requirement key="_scheme">https</requirement>
|
||||||
<requirement key="locale">\w+</requirement>
|
<requirement key="locale">\w+</requirement>
|
||||||
<option key="compiler_class">RouteCompiler</option>
|
<option key="compiler_class">RouteCompiler</option>
|
||||||
</route>
|
</route>
|
||||||
|
@ -1,7 +1,17 @@
|
|||||||
blog_show:
|
blog_show:
|
||||||
pattern: /blog/{slug}
|
path: /blog/{slug}
|
||||||
defaults: { _controller: MyBlogBundle:Blog:show }
|
defaults: { _controller: MyBlogBundle:Blog:show }
|
||||||
host : "{locale}.example.com"
|
host: "{locale}.example.com"
|
||||||
requirements: { '_method': 'GET', 'locale': '\w+' }
|
requirements: { 'locale': '\w+' }
|
||||||
|
methods: ['GET']
|
||||||
|
schemes: ['https']
|
||||||
|
options:
|
||||||
|
compiler_class: RouteCompiler
|
||||||
|
|
||||||
|
blog_show_legacy:
|
||||||
|
pattern: /blog/{slug}
|
||||||
|
defaults: { _controller: MyBlogBundle:Blog:show }
|
||||||
|
host: "{locale}.example.com"
|
||||||
|
requirements: { '_method': 'GET', 'locale': '\w+', _scheme: 'https' }
|
||||||
options:
|
options:
|
||||||
compiler_class: RouteCompiler
|
compiler_class: RouteCompiler
|
||||||
|
@ -40,13 +40,16 @@ class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$routeCollection = $loader->load('validpattern.php');
|
$routeCollection = $loader->load('validpattern.php');
|
||||||
$routes = $routeCollection->all();
|
$routes = $routeCollection->all();
|
||||||
|
|
||||||
$this->assertEquals(1, count($routes), 'One route is loaded');
|
$this->assertCount(2, $routes, 'Two routes are loaded');
|
||||||
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
||||||
$route = $routes['blog_show'];
|
|
||||||
$this->assertEquals('/blog/{slug}', $route->getPath());
|
foreach ($routes as $route) {
|
||||||
$this->assertEquals('MyBlogBundle:Blog:show', $route->getDefault('_controller'));
|
$this->assertEquals('/blog/{slug}', $route->getPath());
|
||||||
$this->assertEquals('GET', $route->getRequirement('_method'));
|
$this->assertEquals('MyBlogBundle:Blog:show', $route->getDefault('_controller'));
|
||||||
$this->assertEquals('{locale}.example.com', $route->getHost());
|
$this->assertEquals('GET', $route->getRequirement('_method'));
|
||||||
$this->assertEquals('RouteCompiler', $route->getOption('compiler_class'));
|
$this->assertEquals('https', $route->getRequirement('_scheme'));
|
||||||
|
$this->assertEquals('{locale}.example.com', $route->getHost());
|
||||||
|
$this->assertEquals('RouteCompiler', $route->getOption('compiler_class'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,12 +41,13 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$routeCollection = $loader->load('validpattern.xml');
|
$routeCollection = $loader->load('validpattern.xml');
|
||||||
$routes = $routeCollection->all();
|
$routes = $routeCollection->all();
|
||||||
|
|
||||||
$this->assertEquals(1, count($routes), 'One route is loaded');
|
$this->assertCount(2, $routes, 'Two routes are loaded');
|
||||||
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
||||||
$route = $routes['blog_show'];
|
$route = $routes['blog_show'];
|
||||||
$this->assertEquals('/blog/{slug}', $route->getPath());
|
$this->assertEquals('/blog/{slug}', $route->getPath());
|
||||||
$this->assertEquals('MyBundle:Blog:show', $route->getDefault('_controller'));
|
$this->assertEquals('MyBundle:Blog:show', $route->getDefault('_controller'));
|
||||||
$this->assertEquals('GET', $route->getRequirement('_method'));
|
$this->assertEquals('GET', $route->getRequirement('_method'));
|
||||||
|
$this->assertEquals('https', $route->getRequirement('_scheme'));
|
||||||
$this->assertEquals('\w+', $route->getRequirement('locale'));
|
$this->assertEquals('\w+', $route->getRequirement('locale'));
|
||||||
$this->assertEquals('{locale}.example.com', $route->getHost());
|
$this->assertEquals('{locale}.example.com', $route->getHost());
|
||||||
$this->assertEquals('RouteCompiler', $route->getOption('compiler_class'));
|
$this->assertEquals('RouteCompiler', $route->getOption('compiler_class'));
|
||||||
@ -57,7 +58,8 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
|
$loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
|
||||||
$routeCollection = $loader->load('namespaceprefix.xml');
|
$routeCollection = $loader->load('namespaceprefix.xml');
|
||||||
|
|
||||||
$this->assertCount(1, $routeCollection, 'One route is loaded');
|
$this->assertCount(1, $routeCollection->all(), 'One route is loaded');
|
||||||
|
|
||||||
$route = $routeCollection->get('blog_show');
|
$route = $routeCollection->get('blog_show');
|
||||||
$this->assertEquals('/blog/{slug}', $route->getPath());
|
$this->assertEquals('/blog/{slug}', $route->getPath());
|
||||||
$this->assertEquals('MyBundle:Blog:show', $route->getDefault('_controller'));
|
$this->assertEquals('MyBundle:Blog:show', $route->getDefault('_controller'));
|
||||||
@ -73,14 +75,17 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$routeCollection = $loader->load('validresource.xml');
|
$routeCollection = $loader->load('validresource.xml');
|
||||||
$routes = $routeCollection->all();
|
$routes = $routeCollection->all();
|
||||||
|
|
||||||
$this->assertEquals(1, count($routes), 'One route is loaded');
|
$this->assertCount(2, $routes, 'Two routes are loaded');
|
||||||
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
||||||
$this->assertEquals('/{foo}/blog/{slug}', $routes['blog_show']->getPath());
|
|
||||||
$this->assertEquals('MyBundle:Blog:show', $routes['blog_show']->getDefault('_controller'));
|
foreach ($routes as $route) {
|
||||||
$this->assertEquals('123', $routes['blog_show']->getDefault('foo'));
|
$this->assertEquals('/{foo}/blog/{slug}', $routes['blog_show']->getPath());
|
||||||
$this->assertEquals('\d+', $routes['blog_show']->getRequirement('foo'));
|
$this->assertEquals('MyBundle:Blog:show', $routes['blog_show']->getDefault('_controller'));
|
||||||
$this->assertEquals('bar', $routes['blog_show']->getOption('foo'));
|
$this->assertEquals('123', $routes['blog_show']->getDefault('foo'));
|
||||||
$this->assertEquals('{locale}.example.com', $routes['blog_show']->getHost());
|
$this->assertEquals('\d+', $routes['blog_show']->getRequirement('foo'));
|
||||||
|
$this->assertEquals('bar', $routes['blog_show']->getOption('foo'));
|
||||||
|
$this->assertEquals('{locale}.example.com', $routes['blog_show']->getHost());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,15 +79,18 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$routeCollection = $loader->load('validpattern.yml');
|
$routeCollection = $loader->load('validpattern.yml');
|
||||||
$routes = $routeCollection->all();
|
$routes = $routeCollection->all();
|
||||||
|
|
||||||
$this->assertEquals(1, count($routes), 'One route is loaded');
|
$this->assertCount(2, $routes, 'Two routes are loaded');
|
||||||
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
||||||
$route = $routes['blog_show'];
|
|
||||||
$this->assertEquals('/blog/{slug}', $route->getPath());
|
foreach ($routes as $route) {
|
||||||
$this->assertEquals('MyBlogBundle:Blog:show', $route->getDefault('_controller'));
|
$this->assertEquals('/blog/{slug}', $route->getPath());
|
||||||
$this->assertEquals('GET', $route->getRequirement('_method'));
|
$this->assertEquals('MyBlogBundle:Blog:show', $route->getDefault('_controller'));
|
||||||
$this->assertEquals('\w+', $route->getRequirement('locale'));
|
$this->assertEquals('GET', $route->getRequirement('_method'));
|
||||||
$this->assertEquals('{locale}.example.com', $route->getHost());
|
$this->assertEquals('https', $route->getRequirement('_scheme'));
|
||||||
$this->assertEquals('RouteCompiler', $route->getOption('compiler_class'));
|
$this->assertEquals('\w+', $route->getRequirement('locale'));
|
||||||
|
$this->assertEquals('{locale}.example.com', $route->getHost());
|
||||||
|
$this->assertEquals('RouteCompiler', $route->getOption('compiler_class'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLoadWithResource()
|
public function testLoadWithResource()
|
||||||
@ -96,7 +99,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$routeCollection = $loader->load('validresource.yml');
|
$routeCollection = $loader->load('validresource.yml');
|
||||||
$routes = $routeCollection->all();
|
$routes = $routeCollection->all();
|
||||||
|
|
||||||
$this->assertEquals(1, count($routes), 'One route is loaded');
|
$this->assertCount(2, $routes, 'Two routes are loaded');
|
||||||
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
||||||
$this->assertEquals('/{foo}/blog/{slug}', $routes['blog_show']->getPath());
|
$this->assertEquals('/{foo}/blog/{slug}', $routes['blog_show']->getPath());
|
||||||
$this->assertEquals('MyBlogBundle:Blog:show', $routes['blog_show']->getDefault('_controller'));
|
$this->assertEquals('MyBlogBundle:Blog:show', $routes['blog_show']->getDefault('_controller'));
|
||||||
|
Reference in New Issue
Block a user