/** * @magentoDataFixture Mage/Catalog/controllers/_files/attribute_system_with_applyto_data.php */ public function testSaveActionApplyToData() { $postData = $this->_getAttributeData() + array('attribute_id' => '3'); unset($postData['apply_to']); $this->getRequest()->setPost($postData); $this->dispatch('backend/admin/catalog_product_attribute/save'); $model = new Mage_Catalog_Model_Resource_Eav_Attribute(new Mage_Core_Model_Event_Manager(), new Mage_Core_Model_Cache()); $model->load($postData['attribute_id']); $this->assertEquals(array('simple', 'configurable'), $model->getApplyTo()); }
/** * Check whether the attribute is Applicable to the object * * @param Varien_Object $object * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute * @return boolean */ protected function _isApplicableAttribute($object, $attribute) { $applyTo = $attribute->getApplyTo(); return count($applyTo) == 0 || in_array($object->getTypeId(), $applyTo); }