/** * test xml generation for sync to client */ public function testAppendXml() { $dom = $this->_getOutputDOMDocument(); $appData = $dom->getElementsByTagNameNS('uri:AirSync', 'ApplicationData')->item(0); $controller = $this->_getController($this->_getDevice(Syncope_Model_Device::TYPE_WEBOS)); $task = Tasks_TestCase::getTestRecord(); $task->description = "Hello\r\nTask\nLars"; $task = Tasks_Controller_Task::getInstance()->create($task); $this->objects['tasks']['appendxml'] = $task; $controller->appendXML($appData, null, $task, array()); #$dom->formatOutput = true; echo $dom->saveXML(); $dom->formatOutput = false; // namespace === uri:Calendar $dueDate = $task->due->format("Y-m-d\\TH:i:s") . '.000Z'; $this->assertEquals($dueDate, @$dom->getElementsByTagNameNS('uri:Tasks', 'DueDate')->item(0)->nodeValue, $dom->saveXML()); $this->assertEquals("Hello\r\nTask\r\nLars", @$dom->getElementsByTagNameNS('uri:AirSyncBase', 'Data')->item(0)->nodeValue, $dom->saveXML()); // try to encode XML until we have wbxml tests $outputStream = fopen("php://temp", 'r+'); $encoder = new Wbxml_Encoder($outputStream, 'UTF-8', 3); $encoder->encode($dom); #rewind($outputStream); #fpassthru($outputStream); }