Commit ac9eb457 authored by Kristof Ringleff's avatar Kristof Ringleff

allow changing existing scopes

parent 5b0db121
...@@ -801,9 +801,9 @@ class EcomDev_PHPUnit_Model_Fixture ...@@ -801,9 +801,9 @@ class EcomDev_PHPUnit_Model_Fixture
return false; return false;
} }
$scopeModel = Mage::getModel(self::$_scopeModelByType[$type]); $scopeModel = Mage::getModel(self::$_scopeModelByType[$type])->load($row[$type . '_id']);
$scopeModel->setData($row); $isNew = !$scopeModel->getId();
if ($isNew) {
// Change property for saving new objects with specified ids // Change property for saving new objects with specified ids
EcomDev_Utils_Reflection::setRestrictedPropertyValues( EcomDev_Utils_Reflection::setRestrictedPropertyValues(
$scopeModel->getResource(), $scopeModel->getResource(),
...@@ -811,9 +811,11 @@ class EcomDev_PHPUnit_Model_Fixture ...@@ -811,9 +811,11 @@ class EcomDev_PHPUnit_Model_Fixture
'_isPkAutoIncrement' => false '_isPkAutoIncrement' => false
) )
); );
$scopeModel->isObjectNew(true); $scopeModel->isObjectNew(true);
}
$scopeModel->setData($row);
$scopeModel->save(); $scopeModel->save();
if ($isNew) {
// Revert changed property // Revert changed property
EcomDev_Utils_Reflection::setRestrictedPropertyValues( EcomDev_Utils_Reflection::setRestrictedPropertyValues(
$scopeModel->getResource(), $scopeModel->getResource(),
...@@ -821,6 +823,7 @@ class EcomDev_PHPUnit_Model_Fixture ...@@ -821,6 +823,7 @@ class EcomDev_PHPUnit_Model_Fixture
'_isPkAutoIncrement' => true '_isPkAutoIncrement' => true
) )
); );
}
return $scopeModel; return $scopeModel;
} }
......
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