diff --git a/src/Routing/Route/Route.php b/src/Routing/Route/Route.php index 2c02c418905..6b34aaae368 100644 --- a/src/Routing/Route/Route.php +++ b/src/Routing/Route/Route.php @@ -90,8 +90,6 @@ class Route { * * ### Options * - * - `_name` - By using $options['_name'] a specific name can be - * given to a route. Otherwise a route name will be generated. * - `_ext` - Defines the extensions used for this route. * - `pass` - Copies the listed parameters into params['pass']. * @@ -103,9 +101,6 @@ public function __construct($template, $defaults = [], array $options = []) { $this->template = $template; $this->defaults = (array)$defaults; $this->options = $options; - if (isset($this->options['_name'])) { - $this->_name = $this->options['_name']; - } if (isset($this->defaults['[method]'])) { $this->defaults['_method'] = $this->defaults['[method]']; unset($this->defaults['[method]']); diff --git a/tests/TestCase/Routing/Route/RouteTest.php b/tests/TestCase/Routing/Route/RouteTest.php index 511edc95e6b..c588e5cfe15 100644 --- a/tests/TestCase/Routing/Route/RouteTest.php +++ b/tests/TestCase/Routing/Route/RouteTest.php @@ -888,7 +888,7 @@ public function testParseTrailingUTF8() { */ public function testGetName() { $route = new Route('/foo/bar', array(), array('_name' => 'testing')); - $this->assertEquals('testing', $route->getName()); + $this->assertEquals('', $route->getName()); $route = new Route('/:controller/:action'); $this->assertEquals('_controller:_action', $route->getName()); diff --git a/tests/TestCase/Routing/RouteCollectionTest.php b/tests/TestCase/Routing/RouteCollectionTest.php index ab1593948e2..311c77ae49a 100644 --- a/tests/TestCase/Routing/RouteCollectionTest.php +++ b/tests/TestCase/Routing/RouteCollectionTest.php @@ -183,6 +183,9 @@ public function testMatchNamed() { $result = $this->collection->match(['_name' => 'article:view', 'id' => '2'], $context); $this->assertEquals('/b/2', $result); + + $result = $this->collection->match(['plugin' => null, 'controller' => 'Articles', 'action' => 'view', 'id' => '2'], $context); + $this->assertEquals('b/2', $result); } /**