/** * Return the new internal state for this attribute. * * @param array $changes The object data that should be updated. * * @return array The resulting internal state. * * @throws Horde_Kolab_Server_Exception If storing the value failed. */ public function update(array $changes) { $changes = parent::update($changes); if (!empty($changes)) { throw new Horde_Kolab_Server_Exception(sprintf("The value for \"%s\" may not be modified!", $this->_name)); } return $changes; }
public function testMethodChangesHasResultArrayWithAddedAndDeletedValuesIfTheObjectExistsAndHadValuesForTheAttributeAndNewValuesHaveBeenProvided() { $attribute = new Horde_Kolab_Server_Object_Attribute_Value($this->object, $this->composite, 'name'); $this->object->expects($this->once())->method('exists')->with()->will($this->returnValue(true)); $this->object->expects($this->once())->method('getInternal')->with('name')->will($this->returnValue(array('a', 'c'))); $data = array('name' => array('b', 'c', 'd')); $this->assertEquals(array('add' => array('name' => array('b', 'd')), 'delete' => array('name' => array('a'))), $attribute->update($data)); }