Exemplo n.º 1
0
 /**
  * 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);
     }
 }