Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixing cross database tests by making sure the fixture was created fo…

…r the right database.
  • Loading branch information...
commit 33d00380ed7e38cb0c586f830e31f0d938acbf11 1 parent 423fa81
Renan Gonçalves renan authored
3  lib/Cake/Test/Case/Model/ModelIntegrationTest.php
View
@@ -399,7 +399,8 @@ function testCrossDatabaseJoins() {
$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');
10 lib/Cake/TestSuite/Fixture/CakeFixtureManager.php
View
@@ -149,12 +149,12 @@ protected function _loadFixtures($fixtures) {
* @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 @@ protected function _setupTable($fixture, $db = null, $drop = true) {
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;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.