Horde_Kolab_Storage_Object::serialize PHP Method

serialize() public method

Serialization.
public serialize ( ) : string
return string Serialized data.
    public function serialize()
    {
        return serialize(array(self::SERIALIZATION_DATA => $this->_data, self::SERIALIZATION_ERRORS => $this->_errors, self::SERIALIZATION_TYPE => $this->_type, self::SERIALIZATION_FOLDER => $this->_folder, self::SERIALIZATION_BACKENDID => $this->_backend_id, self::SERIALIZATION_MIMEPARTID => $this->_mime_part_id));
    }

Usage Example

示例#1
0
 public function testSerializeUnserializeForgetsContent()
 {
     $data_string = "<?xml version=\"1.0\"?>\n<kolab><test/></kolab>";
     $content = fopen('php://temp', 'r+');
     fwrite($content, $data_string);
     $data = $this->getMock('Horde_Kolab_Storage_Object_Writer');
     $object = new Horde_Kolab_Storage_Object();
     $this->folder->expects($this->once())->method('getType')->will($this->returnValue('event'));
     $this->folder->expects($this->once())->method('getPath')->will($this->returnValue('INBOX/Calendar'));
     $this->driver->expects($this->exactly(2))->method('fetchBodypart')->with('INBOX/Calendar', '1', '2')->will($this->returnValue($content));
     $object->setDriver($this->driver);
     $object->load('1', $this->folder, $data, $this->getMultipartMimeMessage('application/x-vnd.kolab.event'));
     $new_object = new Horde_Kolab_Storage_Object();
     $new_object->unserialize($object->serialize());
     $new_object->setDriver($this->driver);
     $this->assertSame($content, $new_object->getContent());
 }