Browse Source

Merge pull request #10051 from cakephp/issue-10037-fix

Fix missing inflection on prefix value.
Mark Story 9 years ago
parent
commit
8317ee5918
2 changed files with 3 additions and 2 deletions
  1. 2 1
      src/Routing/Router.php
  2. 1 1
      tests/TestCase/Routing/RouterTest.php

+ 2 - 1
src/Routing/Router.php

@@ -990,9 +990,10 @@ class Router
             $callback = $params;
             $params = [];
         }
+        $name = Inflector::underscore($name);
 
         if (empty($params['path'])) {
-            $path = '/' . Inflector::underscore($name);
+            $path = '/' . $name;
         } else {
             $path = $params['path'];
             unset($params['path']);

+ 1 - 1
tests/TestCase/Routing/RouterTest.php

@@ -3108,7 +3108,7 @@ class RouterTest extends TestCase
         Router::prefix('CustomPath', ['path' => '/custom-path'], function ($routes) {
             $this->assertInstanceOf('Cake\Routing\RouteBuilder', $routes);
             $this->assertEquals('/custom-path', $routes->path());
-            $this->assertEquals(['prefix' => 'CustomPath'], $routes->params());
+            $this->assertEquals(['prefix' => 'custom_path'], $routes->params());
         });
     }