Skip to content
This repository was archived by the owner on May 27, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/code/community/EcomDev/PHPUnit/Model/Fixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ protected function _loadFixtureFiles(array $fixtures, $classOrInstance)
->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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ public function apply(array $data, $key, EcomDev_PHPUnit_Model_Fixture_Interface
}

$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);
}
Expand Down Expand Up @@ -102,9 +103,10 @@ public function discard(array $data, $key, EcomDev_PHPUnit_Model_Fixture_Interfa
}
$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]);
}
Expand All @@ -114,4 +116,4 @@ public function discard(array $data, $key, EcomDev_PHPUnit_Model_Fixture_Interfa
$fixture->setStorageData(self::STORAGE_KEY, null);
return $this;
}
}
}
5 changes: 3 additions & 2 deletions app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture extends Mage_Core_Model_Mysql4_Abstra
protected function _construct()
{
$this->_setResource('ecomdev_phpunit');
$this->_resourceModel = NULL;
}

/**
Expand Down Expand Up @@ -129,6 +130,6 @@ protected function _getTableRecordValue($value)
return serialize($value['serialized']);
}

throw new InvalidArgumentException('Unrecognized type for DB column');
throw new InvalidArgumentException('Unrecognized type for DB column: '.print_r($value, 1));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ public function runRequiredIndexers()
if (empty($this->_options['doNotIndexAll'])) {
$indexer = Mage::getSingleton('index/indexer');
foreach ($this->getRequiredIndexers() as $indexerCode) {
if (empty($this->_options['doNotIndex'])
|| !in_array($indexerCode, $this->_options['doNotIndex'])) {
$indexer->getProcessByCode($indexerCode)
->reindexAll();
if (empty($this->_options['doNotIndex']) || !in_array($indexerCode, $this->_options['doNotIndex'])) {
$process = $indexer->getProcessByCode($indexerCode);
if ($process) {
$process->reindexAll();
}
}
}
}
Expand Down