Start and end transactions on the fixtures datasource.

Fixes #3490
This commit is contained in:
mark_story 2013-01-05 14:50:09 -05:00
parent 6d743971e9
commit ac1f64abc9

View file

@ -204,19 +204,16 @@ class CakeFixtureManager {
return; return;
} }
$nested = $test->db->useNestedTransactions;
$test->db->useNestedTransactions = false;
$test->db->begin();
foreach ($fixtures as $f) { foreach ($fixtures as $f) {
if (!empty($this->_loaded[$f])) { if (!empty($this->_loaded[$f])) {
$fixture = $this->_loaded[$f]; $fixture = $this->_loaded[$f];
$db = ConnectionManager::getDataSource($fixture->useDbConfig); $db = ConnectionManager::getDataSource($fixture->useDbConfig);
$db->begin();
$this->_setupTable($fixture, $db, $test->dropTables); $this->_setupTable($fixture, $db, $test->dropTables);
$fixture->insert($db); $fixture->insert($db);
$db->commit();
} }
} }
$test->db->commit();
$test->db->useNestedTransactions = $nested;
} }
/** /**