Skip to content

Commit

Permalink
Reverting change in ConnectionManager, sourceList() will only return …
Browse files Browse the repository at this point in the history
…the instantiated datasources

Fixing remaining tests failing due to contamination of loaded plugin is app
  • Loading branch information
lorenzo committed May 27, 2011
1 parent aca592a commit e669a81
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/Cake/Model/ConnectionManager.php
Expand Up @@ -106,14 +106,16 @@ public static function getDataSource($name) {

/**
* Gets the list of available DataSource connections
* This will only return the datasources instantiated by this manager
* It differs from enumConnectionObjects, since the latter will return all configured connections
*
* @return array List of available connections
*/
public static function sourceList() {
if (empty(self::$_init)) {
self::init();
}
return array_keys((array)self::$config);
return array_keys(self::$_dataSources);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion lib/Cake/Test/Case/Controller/ScaffoldTest.php
Expand Up @@ -366,7 +366,7 @@ function testGetViewFilename() {
'action' => 'admin_add',
'admin' => true
));
$Controller->plugin = 'test_plugin';
$Controller->plugin = 'TestPlugin';

$ScaffoldView = new TestScaffoldView($Controller);
$result = $ScaffoldView->testGetFilename('admin_add');
Expand Down Expand Up @@ -826,6 +826,7 @@ function testScaffoldFlashMessages() {
* @return void
*/
function testHabtmFieldAdditionWithScaffoldForm() {
CakePlugin::unload();
$params = array(
'plugin' => null,
'pass' => array(1),
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Test/Case/Model/ConnectionManagerTest.php
Expand Up @@ -185,6 +185,7 @@ function testGetPluginDataSourceAndLocalDriver() {
* @return void
*/
function testSourceList() {
ConnectionManager::getDataSource('test');
$sources = ConnectionManager::sourceList();
$this->assertTrue(count($sources) >= 1);
$this->assertTrue(in_array('test', array_keys($sources)));
Expand Down

0 comments on commit e669a81

Please sign in to comment.