Permalink
Browse files

Including a plugin short route for prefixes as well. There were faili…

…ng Dispatcher tests relying on this.
  • Loading branch information...
markstory committed Apr 11, 2010
1 parent f6525e0 commit e1253f0bb5162e86f586f2ae4f8473154d8035da
Showing with 3 additions and 2 deletions.
  1. +2 −1 cake/libs/router.php
  2. +1 −1 cake/tests/cases/libs/router.test.php
View
@@ -574,14 +574,15 @@ function __connectDefaultRoutes() {
}
$pluginPattern = implode('|', $plugins);
$match = array('plugin' => $pluginPattern);
+ $shortParams = array('routeClass' => 'PluginShortRoute', 'plugin' => $pluginPattern);
foreach ($this->__prefixes as $prefix) {
$params = array('prefix' => $prefix, $prefix => true);
$indexParams = $params + array('action' => 'index');
+ $this->connect("/{$prefix}/:plugin", $indexParams, $shortParams);
$this->connect("/{$prefix}/:plugin/:controller", $indexParams, $match);
$this->connect("/{$prefix}/:plugin/:controller/:action/*", $params, $match);
}
- $shortParams = array('routeClass' => 'PluginShortRoute', 'plugin' => $pluginPattern);
$this->connect('/:plugin', array('action' => 'index'), $shortParams);
$this->connect('/:plugin/:controller', array('action' => 'index'), $match);
$this->connect('/:plugin/:controller/:action/*', array(), $match);
@@ -1125,7 +1125,7 @@ function testPrefixRoutingAndPlugins() {
Router::parse('/');
$result = Router::url(array('plugin' => 'test_plugin', 'controller' => 'test_plugin', 'action' => 'index'));
- $expected = '/admin/test_plugin/test_plugin';
+ $expected = '/admin/test_plugin';
$this->assertEqual($result, $expected);
Router::reload();

0 comments on commit e1253f0

Please sign in to comment.