Skip to content

Commit

Permalink
Adding App::setObjects() as a temporary way to modify App's cache of …
Browse files Browse the repository at this point in the history
…plugins. This allows the DispatcherTest to successfully run.
  • Loading branch information
markstory committed Apr 24, 2010
1 parent 0a8aafe commit 4d4d9e7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
13 changes: 13 additions & 0 deletions cake/libs/configure.php
Expand Up @@ -786,6 +786,19 @@ public static function objects($type, $path = null, $cache = true) {
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.
*
Expand Down
7 changes: 2 additions & 5 deletions cake/tests/cases/dispatcher.test.php
Expand Up @@ -1464,8 +1464,7 @@ public function testAutomaticPluginControllerDispatch() {
$plugins[] = 'MyPlugin';
$plugins[] = 'ArticlesTest';

$app = App::getInstance();
$app->__objects['plugin'] = $plugins;
App::setObjects('plugin', $plugins);

Router::reload();
$Dispatcher =& new TestDispatcher();
Expand Down Expand Up @@ -1560,9 +1559,7 @@ public function testAutomaticPluginDispatchWithShortAccess() {
$plugins = App::objects('plugin');
$plugins[] = 'MyPlugin';

$app = App::getInstance();
$app->__objects['plugin'] = $plugins;

App::setObjects('plugin', $plugins);
Router::reload();

$Dispatcher =& new TestDispatcher();
Expand Down

0 comments on commit 4d4d9e7

Please sign in to comment.