mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing cross database tests by making sure the fixture was created for the right database.
This commit is contained in:
parent
423fa8127e
commit
33d00380ed
2 changed files with 7 additions and 6 deletions
|
@ -399,7 +399,8 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
$this->assertEqual($TestModel->find('all'), $expected);
|
||||
|
||||
$db2 = ConnectionManager::getDataSource('test2');
|
||||
$this->loadFixtures('User', 'Comment');
|
||||
$this->fixtureManager->loadSingle('User', $db2);
|
||||
$this->fixtureManager->loadSingle('Comment', $db2);
|
||||
$this->assertEqual($TestModel->find('count'), 3);
|
||||
|
||||
$TestModel->User->setDataSource('test2');
|
||||
|
|
|
@ -149,12 +149,12 @@ class CakeFixtureManager {
|
|||
* @return void
|
||||
*/
|
||||
protected function _setupTable($fixture, $db = null, $drop = true) {
|
||||
if (!empty($fixture->created)) {
|
||||
return;
|
||||
}
|
||||
if (!$db) {
|
||||
$db = $this->_db;
|
||||
}
|
||||
if (!empty($fixture->created) && $fixture->created == $db->configKeyName) {
|
||||
return;
|
||||
}
|
||||
|
||||
$cacheSources = $db->cacheSources;
|
||||
$db->cacheSources = false;
|
||||
|
@ -165,10 +165,10 @@ class CakeFixtureManager {
|
|||
if ($drop && in_array($table, $sources)) {
|
||||
$fixture->drop($db);
|
||||
$fixture->create($db);
|
||||
$fixture->created = true;
|
||||
$fixture->created = $db->configKeyName;
|
||||
} elseif (!in_array($table, $sources)) {
|
||||
$fixture->create($db);
|
||||
$fixture->created = true;
|
||||
$fixture->created = $db->configKeyName;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue