Avoid connection to default for mocked models

Fixes #5565
This commit is contained in:
Gerd Katzenbeisser 2015-01-04 16:53:00 +01:00
parent dabf55785f
commit bf3ff8e2ad

View file

@ -733,6 +733,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
$availableDs = array_keys(ConnectionManager::enumConnectionObjects());
if ($mock->useDbConfig === 'default') {
$mock->useDbConfig = null;
$mock->setDataSource('test');
}
if ($mock->useDbConfig !== 'test' && in_array('test_' . $mock->useDbConfig, $availableDs)) {