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)); }
public function getImages() { if (null === $this->_images) { $images = new Varien_Data_Collection(); $i = 1; while ($this->hasData('image' . $i)) { $image = new Varien_Object(); $image->setImage($this->getData('image' . $i))->setLink($this->getData('link' . $i))->setNewWindow((bool) $this->getData('new_window' . $i)); $images->addItem($image); $i++; } $this->_images = $images; } return $this->_images; }