Merge pull request #2799 from sam-at-github/master

Fixed prefixed action prefix reverse routing match. One liner.
This commit is contained in:
Mark Story 2014-02-09 16:02:44 -05:00
commit 6b3a062927
2 changed files with 6 additions and 1 deletions

View file

@ -490,7 +490,7 @@ class CakeRoute {
$prefixed = $params['prefix'] . '_'; $prefixed = $params['prefix'] . '_';
} }
if (isset($prefixed, $params['action']) && strpos($params['action'], $prefixed) === 0) { if (isset($prefixed, $params['action']) && strpos($params['action'], $prefixed) === 0) {
$params['action'] = substr($params['action'], strlen($prefixed) * -1); $params['action'] = substr($params['action'], strlen($prefixed));
unset($params['prefix']); unset($params['prefix']);
} }

View file

@ -308,6 +308,11 @@ class CakeRouteTest extends CakeTestCase {
$result = $route->match($url); $result = $route->match($url);
$expected = '/admin/subscriptions/edit_admin_e/1'; $expected = '/admin/subscriptions/edit_admin_e/1';
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
$url = array('controller' => 'subscribe', 'admin' => true, 'action' => 'admin_edit', 1);
$result = $route->match($url);
$expected = '/admin/subscriptions/edit/1';
$this->assertEquals($expected, $result);
} }
/** /**