Merge pull request #11811 from Khigashiguchi/fix/issue-11810

[2.x]In getMockForModel, place useDbConfig test_xxx
This commit is contained in:
Mark Story 2018-03-10 13:55:35 +00:00 committed by GitHub
commit 5d7f3a67c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -445,7 +445,8 @@ class CakeTestCaseTest extends CakeTestCase {
), App::RESET);
CakePlugin::load('TestPlugin');
ConnectionManager::create('test_secondary', array(
'datasource' => 'Database/TestLocalDriver'
'datasource' => 'Database/TestLocalDriver',
'prefix' => ''
));
$post = $this->getMockForModel('SecondaryPost', array('save'));
$this->assertEquals('test_secondary', $post->useDbConfig);

View file

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