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,17 +403,8 @@ class Dispatcher extends Object {
|
|||
$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;
|
||||
}
|
||||
}
|
||||
$name = $ctrlClass;
|
||||
$ctrlClass .= 'Controller';
|
||||
if (class_exists($ctrlClass)) {
|
||||
|
|
|
@ -1584,9 +1584,13 @@ class DispatcherTest extends CakeTestCase {
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue