/** * Import attributesets * * @param Aoe_AttributeConfigurator_Model_Config $config Config model * @return void */ public function run($config) { $iterator = Mage::getModel('aoe_attributeconfigurator/config_attributeset_iterator', $config->getAttributeSets()); foreach ($iterator as $_attributeSetConfig) { /** @var Aoe_AttributeConfigurator_Model_Config_Attributeset $_attributeSetConfig */ try { $this->_processAttributeSet($_attributeSetConfig); } catch (Aoe_AttributeConfigurator_Model_Sync_Import_Attributeset_Validation_Exception $e) { $this->_getHelper()->log('Attribute Set validation exception.', $e); } catch (Aoe_AttributeConfigurator_Model_Sync_Import_Attributeset_Creation_Exception $e) { $this->_getHelper()->log('Attribute Set could not be saved.', $e); } catch (Exception $e) { $this->_getHelper()->log('Unexpected Attribute Set Error, skipping.', $e); } } }
/** * Run the attribute update/import * * @param Aoe_AttributeConfigurator_Model_Config $config Config model * @return void * @throws Aoe_AttributeConfigurator_Model_Sync_Import_Exception */ public function run($config) { /** @var Aoe_AttributeConfigurator_Model_Config_Attribute_Iterator $iterator */ $iterator = Mage::getModel('aoe_attributeconfigurator/config_attribute_iterator', $config->getAttributes()); $this->_attributesToSkip = $this->_getConfigHelper()->getSkipAttributeCodes(); foreach ($iterator as $_attributeConfig) { /** @var Aoe_AttributeConfigurator_Model_Config_Attribute $_attributeConfig */ try { $this->_processAttribute($_attributeConfig); } catch (Aoe_AttributeConfigurator_Model_Sync_Import_Attribute_Skipped_Exception $skippedException) { $this->_getHelper()->log($skippedException->getMessage(), null, Zend_Log::INFO); } catch (Aoe_AttributeConfigurator_Model_Sync_Import_Attribute_Exception $attributeException) { $this->_getHelper()->log('-', $attributeException, Zend_Log::WARN); } catch (Exception $e) { $this->_getHelper()->log('error during attribute import', $e, Zend_Log::ERR); } } }
/** * @test * @depends checkClass * @param Aoe_AttributeConfigurator_Model_Config $model Config model * @return void */ public function checkGetAttributes($model) { $this->_mockConfigHelperLoadingXml(); $attributes = $model->getAttributes(); $this->assertInstanceOf('Varien_Simplexml_Element', $attributes); }