Skip to content

Commit 2814ddc

Browse files
committed
Modifying Dispatcher tests to modify private variables (which is bad, but there is no way to change which plugins Router uses to create patterns). This allows the removal of two calls to _restructureParams.
1 parent 9580217 commit 2814ddc

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

cake/dispatcher.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -403,16 +403,7 @@ function &__getController() {
403403
$controller = false;
404404
$ctrlClass = $this->__loadController($params);
405405
if (!$ctrlClass) {
406-
if (!isset($params['plugin'])) {
407-
$params = $this->_restructureParams($params);
408-
} else {
409-
$params = $this->_restructureParams($params, true);
410-
}
411-
$ctrlClass = $this->__loadController($params);
412-
if (!$ctrlClass) {
413-
$this->params = $original;
414-
return $controller;
415-
}
406+
return $controller;
416407
}
417408
$name = $ctrlClass;
418409
$ctrlClass .= 'Controller';

cake/tests/cases/dispatcher.test.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1584,9 +1584,13 @@ function testAutomaticPluginControllerDispatch() {
15841584
function testAutomaticPluginDispatchWithShortAccess() {
15851585
$_POST = array();
15861586
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
1587+
$plugins = App::objects('plugin');
1588+
$plugins[] = 'MyPlugin';
1589+
1590+
$app = App::getInstance();
1591+
$app->__objects['plugin'] = $plugins;
15871592

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

15911595
$Dispatcher =& new TestDispatcher();
15921596
$Dispatcher->base = false;

0 commit comments

Comments
 (0)