Fixing test database checking in CakeTestCase

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7303 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-07-01 16:42:44 +00:00
parent 88197569ad
commit f6934e3237

View file

@ -633,19 +633,13 @@ class CakeTestCase extends UnitTestCase {
* @access protected * @access protected
*/ */
function _initDb() { function _initDb() {
$testDbAvailable = false; $testDbAvailable = in_array('test', array_keys(ConnectionManager::enumConnectionObjects()));
if (class_exists('DATABASE_CONFIG')) {
$dbConfig =& new DATABASE_CONFIG();
$testDbAvailable = isset($dbConfig->test);
}
if ($testDbAvailable) { if ($testDbAvailable) {
// Try for test DB // Try for test DB
restore_error_handler(); restore_error_handler();
@$db =& ConnectionManager::getDataSource('test'); @$db =& ConnectionManager::getDataSource('test');
set_error_handler('simpleTestErrorHandler'); set_error_handler('simpleTestErrorHandler');
$testDbAvailable = $db->isConnected(); $testDbAvailable = $db->isConnected();
} }