Skip to content

Commit

Permalink
Modifying Dispatcher tests to modify private variables (which is bad,…
Browse files Browse the repository at this point in the history
… but there is no way to change which plugins Router uses to create patterns). This allows the removal of two calls to _restructureParams.
  • Loading branch information
markstory committed Apr 4, 2010
1 parent 9580217 commit 2814ddc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
11 changes: 1 addition & 10 deletions cake/dispatcher.php
Expand Up @@ -403,16 +403,7 @@ function &__getController() {
$controller = false;
$ctrlClass = $this->__loadController($params);
if (!$ctrlClass) {
if (!isset($params['plugin'])) {
$params = $this->_restructureParams($params);
} else {
$params = $this->_restructureParams($params, true);
}
$ctrlClass = $this->__loadController($params);
if (!$ctrlClass) {
$this->params = $original;
return $controller;
}
return $controller;
}
$name = $ctrlClass;
$ctrlClass .= 'Controller';
Expand Down
6 changes: 5 additions & 1 deletion cake/tests/cases/dispatcher.test.php
Expand Up @@ -1584,9 +1584,13 @@ function testAutomaticPluginControllerDispatch() {
function testAutomaticPluginDispatchWithShortAccess() {
$_POST = array();
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
$plugins = App::objects('plugin');
$plugins[] = 'MyPlugin';

$app = App::getInstance();
$app->__objects['plugin'] = $plugins;

Router::reload();
Router::connect('/my_plugin/:controller/:action/*', array('plugin' => 'my_plugin'));

$Dispatcher =& new TestDispatcher();
$Dispatcher->base = false;
Expand Down

0 comments on commit 2814ddc

Please sign in to comment.