mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Adding App::setObjects() as a temporary way to modify App's cache of plugins. This allows the DispatcherTest to successfully run.
This commit is contained in:
parent
0a8aafe3c8
commit
4d4d9e78f8
2 changed files with 15 additions and 5 deletions
|
@ -786,6 +786,19 @@ class App extends Object {
|
|||
return $_this->__objects[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows you to modify the object listings that App maintains inside of it
|
||||
* Useful for testing
|
||||
*
|
||||
* @param string $type Type of object listing you are changing
|
||||
* @param array $values The values $type should be set to.
|
||||
* @return void
|
||||
*/
|
||||
public static function setObjects($type, $values) {
|
||||
$_this = App::getInstance();
|
||||
$_this->__objects[$type] = $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds classes based on $name or specific file(s) to search.
|
||||
*
|
||||
|
|
|
@ -1464,8 +1464,7 @@ class DispatcherTest extends CakeTestCase {
|
|||
$plugins[] = 'MyPlugin';
|
||||
$plugins[] = 'ArticlesTest';
|
||||
|
||||
$app = App::getInstance();
|
||||
$app->__objects['plugin'] = $plugins;
|
||||
App::setObjects('plugin', $plugins);
|
||||
|
||||
Router::reload();
|
||||
$Dispatcher =& new TestDispatcher();
|
||||
|
@ -1560,9 +1559,7 @@ class DispatcherTest extends CakeTestCase {
|
|||
$plugins = App::objects('plugin');
|
||||
$plugins[] = 'MyPlugin';
|
||||
|
||||
$app = App::getInstance();
|
||||
$app->__objects['plugin'] = $plugins;
|
||||
|
||||
App::setObjects('plugin', $plugins);
|
||||
Router::reload();
|
||||
|
||||
$Dispatcher =& new TestDispatcher();
|
||||
|
|
Loading…
Add table
Reference in a new issue