Skip to content
Permalink
Browse files

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

  • Loading branch information...
markstory committed Sep 13, 2016
1 parent d0041f1 commit 35c6f2c7711509268e312bb2dca5ec09d1bc24cd
Showing with 4 additions and 8 deletions.
  1. +4 −8 lib/Cake/TestSuite/Fixture/CakeFixtureManager.php
@@ -98,7 +98,7 @@ protected function _initDb() {
/**
* Parse the fixture path included in test cases, to get the fixture class name, and the
* real fixture path including sub-directories
*
*
* @param string $fixturePath the fixture path to parse
* @return array containing fixture class name and optional additional path
*/
@@ -218,7 +218,7 @@ public function load(CakeTestCase $test) {
if (empty($test->fixtures)) {
return;
}
$fixtures = array_unique($test->fixtures);
$fixtures = $test->fixtures;
if (empty($fixtures) || !$test->autoFixtures) {
return;
}
@@ -229,9 +229,7 @@ public function load(CakeTestCase $test) {
$db = ConnectionManager::getDataSource($fixture->useDbConfig);
$db->begin();
$this->_setupTable($fixture, $db, $test->dropTables);
if (!$test->dropTables) {
$fixture->truncate($db);
}
$fixture->truncate($db);
$fixture->insert($db);
$db->commit();
}
@@ -276,9 +274,7 @@ public function loadSingle($name, $db = null, $dropTables = true) {
$db = ConnectionManager::getDataSource($fixture->useDbConfig);
}
$this->_setupTable($fixture, $db, $dropTables);
if (!$dropTables) {
$fixture->truncate($db);
}
$fixture->truncate($db);
$fixture->insert($db);
} else {
throw new UnexpectedValueException(__d('cake_dev', 'Referenced fixture class %s not found', $name));

0 comments on commit 35c6f2c

Please sign in to comment.
You can’t perform that action at this time.