No truncate when drop table.

This commit is contained in:
akiyan 2014-06-05 13:37:22 +09:00
parent 9c65337c9f
commit 6d2402fbf6

View file

@ -229,7 +229,9 @@ 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();
} }
@ -274,7 +276,9 @@ 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));