mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
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:
parent
88197569ad
commit
f6934e3237
1 changed files with 1 additions and 7 deletions
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue