From e669a81e0a7b5ca423db292dc32bb4042e978d2c Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Fri, 27 May 2011 02:28:38 -0430 Subject: [PATCH] Reverting change in ConnectionManager, sourceList() will only return the instantiated datasources Fixing remaining tests failing due to contamination of loaded plugin is app --- lib/Cake/Model/ConnectionManager.php | 4 +++- lib/Cake/Test/Case/Controller/ScaffoldTest.php | 3 ++- lib/Cake/Test/Case/Model/ConnectionManagerTest.php | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Model/ConnectionManager.php b/lib/Cake/Model/ConnectionManager.php index c5e7f89c2d6..148df62e801 100644 --- a/lib/Cake/Model/ConnectionManager.php +++ b/lib/Cake/Model/ConnectionManager.php @@ -106,6 +106,8 @@ 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 */ @@ -113,7 +115,7 @@ public static function sourceList() { if (empty(self::$_init)) { self::init(); } - return array_keys((array)self::$config); + return array_keys(self::$_dataSources); } /** diff --git a/lib/Cake/Test/Case/Controller/ScaffoldTest.php b/lib/Cake/Test/Case/Controller/ScaffoldTest.php index 5ba9d2e9376..223bcd5710f 100644 --- a/lib/Cake/Test/Case/Controller/ScaffoldTest.php +++ b/lib/Cake/Test/Case/Controller/ScaffoldTest.php @@ -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'); @@ -826,6 +826,7 @@ function testScaffoldFlashMessages() { * @return void */ function testHabtmFieldAdditionWithScaffoldForm() { + CakePlugin::unload(); $params = array( 'plugin' => null, 'pass' => array(1), diff --git a/lib/Cake/Test/Case/Model/ConnectionManagerTest.php b/lib/Cake/Test/Case/Model/ConnectionManagerTest.php index 65c7fbf57ed..3f0658c4419 100644 --- a/lib/Cake/Test/Case/Model/ConnectionManagerTest.php +++ b/lib/Cake/Test/Case/Model/ConnectionManagerTest.php @@ -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)));