mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
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.
This commit is contained in:
parent
95802176bb
commit
2814ddc2d5
2 changed files with 6 additions and 11 deletions
|
@ -403,16 +403,7 @@ class Dispatcher extends Object {
|
||||||
$controller = false;
|
$controller = false;
|
||||||
$ctrlClass = $this->__loadController($params);
|
$ctrlClass = $this->__loadController($params);
|
||||||
if (!$ctrlClass) {
|
if (!$ctrlClass) {
|
||||||
if (!isset($params['plugin'])) {
|
return $controller;
|
||||||
$params = $this->_restructureParams($params);
|
|
||||||
} else {
|
|
||||||
$params = $this->_restructureParams($params, true);
|
|
||||||
}
|
|
||||||
$ctrlClass = $this->__loadController($params);
|
|
||||||
if (!$ctrlClass) {
|
|
||||||
$this->params = $original;
|
|
||||||
return $controller;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$name = $ctrlClass;
|
$name = $ctrlClass;
|
||||||
$ctrlClass .= 'Controller';
|
$ctrlClass .= 'Controller';
|
||||||
|
|
|
@ -1584,9 +1584,13 @@ class DispatcherTest extends CakeTestCase {
|
||||||
function testAutomaticPluginDispatchWithShortAccess() {
|
function testAutomaticPluginDispatchWithShortAccess() {
|
||||||
$_POST = array();
|
$_POST = array();
|
||||||
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
|
$_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::reload();
|
||||||
Router::connect('/my_plugin/:controller/:action/*', array('plugin' => 'my_plugin'));
|
|
||||||
|
|
||||||
$Dispatcher =& new TestDispatcher();
|
$Dispatcher =& new TestDispatcher();
|
||||||
$Dispatcher->base = false;
|
$Dispatcher->base = false;
|
||||||
|
|
Loading…
Reference in a new issue