mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-01 15:19:46 +00:00
Make fixtures disable source caching.
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
This commit is contained in:
parent
c4eb19ab91
commit
b261024111
1 changed files with 2 additions and 4 deletions
|
@ -84,6 +84,7 @@ class CakeFixtureManager {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$db = ConnectionManager::getDataSource('test');
|
$db = ConnectionManager::getDataSource('test');
|
||||||
|
$db->cacheSources = false;
|
||||||
$this->_db = $db;
|
$this->_db = $db;
|
||||||
ClassRegistry::config(array('ds' => 'test'));
|
ClassRegistry::config(array('ds' => 'test'));
|
||||||
$this->_initialized = true;
|
$this->_initialized = true;
|
||||||
|
@ -141,7 +142,7 @@ class CakeFixtureManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 CakeTestFixture $fixture the fixture object to create
|
||||||
* @param DataSource $db the datasource instance to use
|
* @param DataSource $db the datasource instance to use
|
||||||
|
@ -156,10 +157,7 @@ class CakeFixtureManager {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cacheSources = $db->cacheSources;
|
|
||||||
$db->cacheSources = false;
|
|
||||||
$sources = $db->listSources();
|
$sources = $db->listSources();
|
||||||
$db->cacheSources = $cacheSources;
|
|
||||||
$table = $db->config['prefix'] . $fixture->table;
|
$table = $db->config['prefix'] . $fixture->table;
|
||||||
|
|
||||||
if ($drop && in_array($table, $sources)) {
|
if ($drop && in_array($table, $sources)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue