/** * Test for method getAttributeOptions() */ public function testGetAttributeOptions() { $indexAttributeCode = 'gender'; /** @var $attributeCollection Mage_Customer_Model_Resource_Attribute_Collection */ $attributeCollection = Mage::getResourceModel('Mage_Customer_Model_Resource_Attribute_Collection'); $attributeCollection->addFieldToFilter('attribute_code', array('in' => array($indexAttributeCode, 'group_id'))); /** @var $attribute Mage_Customer_Model_Attribute */ foreach ($attributeCollection as $attribute) { $index = $attribute->getAttributeCode() == $indexAttributeCode ? 'value' : 'label'; $expectedOptions = array(); foreach ($attribute->getSource()->getAllOptions(false) as $option) { $expectedOptions[strtolower($option[$index])] = $option['value']; } $actualOptions = $this->_model->getAttributeOptions($attribute, array($indexAttributeCode)); sort($expectedOptions); sort($actualOptions); $this->assertEquals($expectedOptions, $actualOptions); } }
/** * Constructor * * @param array $data */ public function __construct(array $data = array()) { parent::__construct($data); $this->addMessageTemplate(self::ERROR_WEBSITE_IS_EMPTY, $this->_helper('Mage_ImportExport_Helper_Data')->__('Website is not specified')); $this->addMessageTemplate(self::ERROR_EMAIL_IS_EMPTY, $this->_helper('Mage_ImportExport_Helper_Data')->__('E-mail is not specified')); $this->addMessageTemplate(self::ERROR_INVALID_WEBSITE, $this->_helper('Mage_ImportExport_Helper_Data')->__("Invalid value in website column")); $this->addMessageTemplate(self::ERROR_INVALID_EMAIL, $this->_helper('Mage_ImportExport_Helper_Data')->__('E-mail is invalid')); $this->addMessageTemplate(self::ERROR_VALUE_IS_REQUIRED, $this->_helper('Mage_ImportExport_Helper_Data')->__("Required attribute '%s' has an empty value")); $this->addMessageTemplate(self::ERROR_CUSTOMER_NOT_FOUND, $this->_helper('Mage_ImportExport_Helper_Data')->__("Customer with such email and website code doesn't exist")); $this->_initCustomers($data)->_initWebsites(true); }
/** * Test entity type id getter * * @covers Mage_ImportExport_Model_Import_Entity_EavAbstract::getEntityTypeId */ public function testGetEntityTypeId() { $this->assertEquals(self::ENTITY_TYPE_ID, $this->_model->getEntityTypeId()); }