Skip to content

Commit

Permalink
Make fixtures disable source caching.
Browse files Browse the repository at this point in the history
Disabling source caching when using fixtures fixes
issues with test suites.  Testsuites could previously have
test order errors caused by differences in cached and un-cached sources listings.
Fixes #1942
  • Loading branch information
markstory committed Oct 12, 2011
1 parent c4eb19a commit b261024
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/Cake/TestSuite/Fixture/CakeFixtureManager.php
Expand Up @@ -84,6 +84,7 @@ protected function _initDb() {
return;
}
$db = ConnectionManager::getDataSource('test');
$db->cacheSources = false;
$this->_db = $db;
ClassRegistry::config(array('ds' => 'test'));
$this->_initialized = true;
Expand Down Expand Up @@ -141,7 +142,7 @@ protected function _loadFixtures($fixtures) {
}

/**
* Runs the drop and create commands on the fixtures if necessary
* Runs the drop and create commands on the fixtures if necessary.
*
* @param CakeTestFixture $fixture the fixture object to create
* @param DataSource $db the datasource instance to use
Expand All @@ -156,10 +157,7 @@ protected function _setupTable($fixture, $db = null, $drop = true) {
return;
}

$cacheSources = $db->cacheSources;
$db->cacheSources = false;
$sources = $db->listSources();
$db->cacheSources = $cacheSources;
$table = $db->config['prefix'] . $fixture->table;

if ($drop && in_array($table, $sources)) {
Expand Down

0 comments on commit b261024

Please sign in to comment.