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
*/
function _initDb() {
$testDbAvailable = false;
if (class_exists('DATABASE_CONFIG')) {
$dbConfig =& new DATABASE_CONFIG();
$testDbAvailable = isset($dbConfig->test);
}
$testDbAvailable = in_array('test', array_keys(ConnectionManager::enumConnectionObjects()));
if ($testDbAvailable) {
// Try for test DB
restore_error_handler();
@$db =& ConnectionManager::getDataSource('test');
set_error_handler('simpleTestErrorHandler');
$testDbAvailable = $db->isConnected();
}