/**
  * Sets up the fixture.
  * This method is called before a test is executed.
  */
 public function setUp()
 {
     parent::setUp();
     $this->objects['initialContainer'] = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array('name' => Tinebase_Record_Abstract::generateUID(), 'type' => Tinebase_Model_Container::TYPE_PERSONAL, 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Tasks')->getId())));
     $this->objects['sharedContainer'] = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array('name' => Tinebase_Record_Abstract::generateUID(), 'type' => Tinebase_Model_Container::TYPE_SHARED, 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Tasks')->getId())));
     $prefs = new Tasks_Preference();
     $prefs->setValue(Tasks_Preference::DEFAULTTASKLIST, $this->objects['initialContainer']->getId());
     $_SERVER['REQUEST_URI'] = 'lars';
 }
Esempio n. 2
0
 /**
  * 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);
 }