Permalink
Browse files

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.
  • Loading branch information...
1 parent 9580217 commit 2814ddc2d553e9a66a7cc45babdf41661d3c3ef2 @markstory markstory committed Apr 4, 2010
Showing with 6 additions and 11 deletions.
  1. +1 −10 cake/dispatcher.php
  2. +5 −1 cake/tests/cases/dispatcher.test.php
View
11 cake/dispatcher.php
@@ -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';
View
6 cake/tests/cases/dispatcher.test.php
@@ -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;

0 comments on commit 2814ddc

Please sign in to comment.