mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #11811 from Khigashiguchi/fix/issue-11810
[2.x]In getMockForModel, place useDbConfig test_xxx
This commit is contained in:
commit
5d7f3a67c5
2 changed files with 4 additions and 2 deletions
|
@ -445,7 +445,8 @@ class CakeTestCaseTest extends CakeTestCase {
|
||||||
), App::RESET);
|
), App::RESET);
|
||||||
CakePlugin::load('TestPlugin');
|
CakePlugin::load('TestPlugin');
|
||||||
ConnectionManager::create('test_secondary', array(
|
ConnectionManager::create('test_secondary', array(
|
||||||
'datasource' => 'Database/TestLocalDriver'
|
'datasource' => 'Database/TestLocalDriver',
|
||||||
|
'prefix' => ''
|
||||||
));
|
));
|
||||||
$post = $this->getMockForModel('SecondaryPost', array('save'));
|
$post = $this->getMockForModel('SecondaryPost', array('save'));
|
||||||
$this->assertEquals('test_secondary', $post->useDbConfig);
|
$this->assertEquals('test_secondary', $post->useDbConfig);
|
||||||
|
|
|
@ -866,7 +866,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
||||||
$availableDs = array_keys(ConnectionManager::enumConnectionObjects());
|
$availableDs = array_keys(ConnectionManager::enumConnectionObjects());
|
||||||
|
|
||||||
if ($mock->useDbConfig !== 'test' && in_array('test_' . $mock->useDbConfig, $availableDs)) {
|
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 {
|
} else {
|
||||||
$mock->useDbConfig = 'test';
|
$mock->useDbConfig = 'test';
|
||||||
$mock->setDataSource('test');
|
$mock->setDataSource('test');
|
||||||
|
|
Loading…
Reference in a new issue