/** * Test for Mage_ImportExport_Model_Import_Entity_Eav_CustomerAbstract::validateRow for delete action * * @covers Mage_ImportExport_Model_Import_Entity_Eav_CustomerAbstract::validateRow */ public function testValidateRowForDelete() { // _validateRowForDelete should be called only once $this->_model->expects($this->once())->method('_validateRowForDelete'); // delete action $this->_model->setParameters(array('behavior' => Mage_ImportExport_Model_Import::BEHAVIOR_DELETE)); $this->_clearValidatedRows(); $this->assertAttributeEquals(array(), '_validatedRows', $this->_model); $this->assertTrue($this->_model->validateRow(array(), 2)); $this->assertAttributeEquals(array(2 => true), '_validatedRows', $this->_model); $this->assertAttributeEquals(1, '_processedEntitiesCount', $this->_model); $this->assertTrue($this->_model->validateRow(array(), 2)); // _validateRowForDelete should be called once }
/** * Constructor * * @param array $data */ public function __construct(array $data = array()) { if (isset($data['attribute_collection'])) { $this->_attributeCollection = $data['attribute_collection']; unset($data['attribute_collection']); } else { $this->_attributeCollection = Mage::getResourceModel(static::ATTRIBUTE_COLLECTION_NAME); $this->_attributeCollection->addSystemHiddenFilterWithPasswordHash(); $data['attribute_collection'] = $this->_attributeCollection; } parent::__construct($data); $this->_specialAttributes[] = self::COLUMN_WEBSITE; $this->_specialAttributes[] = self::COLUMN_STORE; $this->_permanentAttributes[] = self::COLUMN_EMAIL; $this->_permanentAttributes[] = self::COLUMN_WEBSITE; $this->_indexValueAttributes[] = 'group_id'; $this->addMessageTemplate(self::ERROR_DUPLICATE_EMAIL_SITE, $this->_helper('Mage_ImportExport_Helper_Data')->__('E-mail is duplicated in import file')); $this->addMessageTemplate(self::ERROR_ROW_IS_ORPHAN, $this->_helper('Mage_ImportExport_Helper_Data')->__('Orphan rows that will be skipped due default row errors')); $this->addMessageTemplate(self::ERROR_INVALID_STORE, $this->_helper('Mage_ImportExport_Helper_Data')->__('Invalid value in Store column (store does not exists?)')); $this->addMessageTemplate(self::ERROR_EMAIL_SITE_NOT_FOUND, $this->_helper('Mage_ImportExport_Helper_Data')->__('E-mail and website combination is not found')); $this->addMessageTemplate(self::ERROR_PASSWORD_LENGTH, $this->_helper('Mage_ImportExport_Helper_Data')->__('Invalid password length')); $this->_initStores(true)->_initAttributes(); $this->_customerModel = Mage::getModel('Mage_Customer_Model_Customer'); /** @var $customerResource Mage_Customer_Model_Resource_Customer */ $customerResource = $this->_customerModel->getResource(); $this->_entityTable = $customerResource->getEntityTable(); }
/** * Constructor * * @param array $data */ public function __construct(array $data = array()) { if (!isset($data['attribute_collection'])) { /** @var $attributeCollection Mage_Customer_Model_Resource_Address_Attribute_Collection */ $attributeCollection = Mage::getResourceModel(static::ATTRIBUTE_COLLECTION_NAME); $attributeCollection->addSystemHiddenFilter()->addExcludeHiddenFrontendFilter(); $data['attribute_collection'] = $attributeCollection; } parent::__construct($data); $this->_addressCollection = isset($data['address_collection']) ? $data['address_collection'] : Mage::getResourceModel('Mage_Customer_Model_Resource_Address_Collection'); $this->_entityTable = isset($data['entity_table']) ? $data['entity_table'] : Mage::getModel('Mage_Customer_Model_Address')->getResource()->getEntityTable(); $this->_regionCollection = isset($data['region_collection']) ? $data['region_collection'] : Mage::getResourceModel('Mage_Directory_Model_Resource_Region_Collection'); $this->addMessageTemplate(self::ERROR_ADDRESS_ID_IS_EMPTY, $this->_helper('Mage_ImportExport_Helper_Data')->__('Customer address id column is not specified')); $this->addMessageTemplate(self::ERROR_ADDRESS_NOT_FOUND, $this->_helper('Mage_ImportExport_Helper_Data')->__("Customer address for such customer doesn't exist")); $this->addMessageTemplate(self::ERROR_INVALID_REGION, $this->_helper('Mage_ImportExport_Helper_Data')->__('Region is invalid')); $this->addMessageTemplate(self::ERROR_DUPLICATE_PK, $this->_helper('Mage_ImportExport_Helper_Data')->__('Row with such email, website and address id combination was already found.')); $this->_initAttributes(); $this->_initAddresses()->_initCountryRegions(); }