We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit 0ed8142e authored by Colin Mollenhour's avatar Colin Mollenhour

Delete from tables in reverse order to avoid foreign key constraint errors.

parent 43ea8433
......@@ -389,7 +389,7 @@ class EcomDev_PHPUnit_Model_Fixture
->resolveFilePath($className, EcomDev_PHPUnit_Model_Yaml_Loader::TYPE_FIXTURE, $fixture);
if (!$filePath) {
throw new RuntimeException('Unable to load fixture for test');
throw new RuntimeException('Unable to load fixture for test: '.$fixture);
}
$this->loadYaml($filePath);
......
......@@ -66,11 +66,12 @@ class EcomDev_PHPUnit_Model_Fixture_Processor_Tables
}
$this->getResource()->beginTransaction();
foreach ($data as $tableEntity => $tableData) {
foreach (array_reverse(array_keys($data)) as $tableEntity) {
if (!in_array($tableEntity, $ignoreCleanUp)) {
$this->getResource()->cleanTable($tableEntity);
}
}
foreach ($data as $tableEntity => $tableData) {
if (!empty($tableData)) {
$this->getResource()->loadTableData($tableEntity, $tableData);
}
......@@ -102,9 +103,10 @@ class EcomDev_PHPUnit_Model_Fixture_Processor_Tables
}
$this->getResource()->beginTransaction();
foreach (array_keys($data) as $tableEntity) {
foreach (array_reverse(array_keys($data)) as $tableEntity) {
$this->getResource()->cleanTable($tableEntity);
}
foreach (array_keys($data) as $tableEntity) {
if (isset($restoreTableData[$tableEntity])) {
$this->getResource()->loadTableData($tableEntity, $restoreTableData[$tableEntity]);
}
......@@ -114,4 +116,4 @@ class EcomDev_PHPUnit_Model_Fixture_Processor_Tables
$fixture->setStorageData(self::STORAGE_KEY, null);
return $this;
}
}
\ No newline at end of file
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment