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:
Mark Story 2010-04-23 22:04:16 -04:00
parent 0a8aafe3c8
commit 4d4d9e78f8
2 changed files with 15 additions and 5 deletions

View file

@ -786,6 +786,19 @@ class App extends Object {
return $_this->__objects[$name]; 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. * Finds classes based on $name or specific file(s) to search.
* *

View file

@ -1464,8 +1464,7 @@ class DispatcherTest extends CakeTestCase {
$plugins[] = 'MyPlugin'; $plugins[] = 'MyPlugin';
$plugins[] = 'ArticlesTest'; $plugins[] = 'ArticlesTest';
$app = App::getInstance(); App::setObjects('plugin', $plugins);
$app->__objects['plugin'] = $plugins;
Router::reload(); Router::reload();
$Dispatcher =& new TestDispatcher(); $Dispatcher =& new TestDispatcher();
@ -1560,9 +1559,7 @@ class DispatcherTest extends CakeTestCase {
$plugins = App::objects('plugin'); $plugins = App::objects('plugin');
$plugins[] = 'MyPlugin'; $plugins[] = 'MyPlugin';
$app = App::getInstance(); App::setObjects('plugin', $plugins);
$app->__objects['plugin'] = $plugins;
Router::reload(); Router::reload();
$Dispatcher =& new TestDispatcher(); $Dispatcher =& new TestDispatcher();