mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #5976 from kulltc/master
Make sure default datasource is not used for mock
This commit is contained in:
commit
54edb1cfa6
2 changed files with 5 additions and 5 deletions
|
@ -414,7 +414,7 @@ class CakeTestCaseTest extends CakeTestCase {
|
|||
)
|
||||
), App::RESET);
|
||||
$Post = $this->getMockForModel('Post');
|
||||
|
||||
$this->assertEquals('test', $Post->useDbConfig);
|
||||
$this->assertInstanceOf('Post', $Post);
|
||||
$this->assertNull($Post->save(array()));
|
||||
$this->assertNull($Post->find('all'));
|
||||
|
|
|
@ -732,12 +732,12 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
$mock = $this->getMock($name, $methods, array($config));
|
||||
|
||||
$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)) {
|
||||
$mock->setDataSource('test_' . $mock->useDbConfig);
|
||||
} else {
|
||||
$mock->useDbConfig = 'test';
|
||||
$mock->setDataSource('test');
|
||||
}
|
||||
|
||||
ClassRegistry::removeObject($name);
|
||||
|
|
Loading…
Reference in a new issue