Revert "CakeFixtureManager: Truncate tables only if not dropped."

This commit is contained in:
Mark Story 2016-09-13 11:00:32 -04:00 committed by GitHub
parent d0041f155d
commit 35c6f2c771

View file

@ -218,7 +218,7 @@ class CakeFixtureManager {
if (empty($test->fixtures)) { if (empty($test->fixtures)) {
return; return;
} }
$fixtures = array_unique($test->fixtures); $fixtures = $test->fixtures;
if (empty($fixtures) || !$test->autoFixtures) { if (empty($fixtures) || !$test->autoFixtures) {
return; return;
} }
@ -229,9 +229,7 @@ class CakeFixtureManager {
$db = ConnectionManager::getDataSource($fixture->useDbConfig); $db = ConnectionManager::getDataSource($fixture->useDbConfig);
$db->begin(); $db->begin();
$this->_setupTable($fixture, $db, $test->dropTables); $this->_setupTable($fixture, $db, $test->dropTables);
if (!$test->dropTables) {
$fixture->truncate($db); $fixture->truncate($db);
}
$fixture->insert($db); $fixture->insert($db);
$db->commit(); $db->commit();
} }
@ -276,9 +274,7 @@ class CakeFixtureManager {
$db = ConnectionManager::getDataSource($fixture->useDbConfig); $db = ConnectionManager::getDataSource($fixture->useDbConfig);
} }
$this->_setupTable($fixture, $db, $dropTables); $this->_setupTable($fixture, $db, $dropTables);
if (!$dropTables) {
$fixture->truncate($db); $fixture->truncate($db);
}
$fixture->insert($db); $fixture->insert($db);
} else { } else {
throw new UnexpectedValueException(__d('cake_dev', 'Referenced fixture class %s not found', $name)); throw new UnexpectedValueException(__d('cake_dev', 'Referenced fixture class %s not found', $name));