Commit dfc7d4dd authored by Fabien Potencier's avatar Fabien Potencier

removed usage of deprecated _method and _scheme routing configurations

parent 806287a6
......@@ -106,10 +106,9 @@ class Controller
public function generateRouteName($prefix)
{
$requirements = $this->route->getRequirements();
$method = isset($requirements['_method']) ? $requirements['_method'] : '';
$methods = implode('_', $this->route->getMethods());
$routeName = $prefix.$method.$this->route->getPath();
$routeName = $prefix.$methods.$this->route->getPath();
$routeName = str_replace(array('/', ':', '|', '-'), '_', $routeName);
$routeName = preg_replace('/[^a-z0-9A-Z_.]+/', '', $routeName);
......
......@@ -129,11 +129,11 @@ class ControllerCollectionTest extends \PHPUnit_Framework_TestCase
$controllers->requireHttp();
$controller = $controllers->match('/{id}/{name}/{extra}', function () {})->requireHttps();
$this->assertEquals('https', $controller->getRoute()->getRequirement('_scheme'));
$this->assertEquals(array('https'), $controller->getRoute()->getSchemes());
$controllers->requireHttp();
$this->assertEquals('http', $controller->getRoute()->getRequirement('_scheme'));
$this->assertEquals(array('http'), $controller->getRoute()->getSchemes());
}
public function testBefore()
......
......@@ -91,8 +91,8 @@ class ControllerTest extends \PHPUnit_Framework_TestCase
public function provideRouteAndExpectedRouteName()
{
return array(
array(new Route('/Invalid%Symbols#Stripped', array(), array('_method' => 'POST')), 'POST_InvalidSymbolsStripped'),
array(new Route('/post/{id}', array(), array('_method' => 'GET')), 'GET_post_id'),
array(new Route('/Invalid%Symbols#Stripped', array(), array(), array(), '', array(), array('POST')), 'POST_InvalidSymbolsStripped'),
array(new Route('/post/{id}', array(), array(), array(), '', array(), array('GET')), 'GET_post_id'),
array(new Route('/colon:pipe|dashes-escaped'), '_colon_pipe_dashes_escaped'),
array(new Route('/underscores_and.periods'), '_underscores_and.periods'),
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment