public function testGetAffectedFields() { $valueId = 2345; $attributeId = 345345; $attribute = $this->getMock('Mage_Eav_Model_Entity_Attribute_Abstract', array('getBackendTable', 'isStatic', 'getAttributeId', 'getName'), array(), '', false); $attribute->expects($this->any())->method('getName')->will($this->returnValue('image')); $attribute->expects($this->any())->method('getAttributeId')->will($this->returnValue($attributeId)); $attribute->expects($this->any())->method('isStatic')->will($this->returnValue(false)); $attribute->expects($this->any())->method('getBackendTable')->will($this->returnValue('table')); $this->_model->setAttribute($attribute); $object = new Varien_Object(); $object->setImage(array('images' => array(array('value_id' => $valueId)))); $object->setId(555); $this->assertEquals(array('table' => array(array('value_id' => $valueId, 'attribute_id' => $attributeId, 'entity_id' => $object->getId()))), $this->_model->getAffectedFields($object)); }
protected function setUp() { $this->_model = new Mage_Catalog_Model_Product_Attribute_Backend_Media(); $this->_model->setAttribute(Mage::getSingleton('Mage_Eav_Model_Config')->getAttribute('catalog_product', 'media_gallery')); }