Skip to content

Commit

Permalink
Including a plugin short route for prefixes as well. There were faili…
Browse files Browse the repository at this point in the history
…ng Dispatcher tests relying on this.
  • Loading branch information
markstory committed Apr 11, 2010
1 parent f6525e0 commit e1253f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cake/libs/router.php
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion cake/tests/cases/libs/router.test.php
Expand Up @@ -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();
Expand Down

0 comments on commit e1253f0

Please sign in to comment.