/** * test PROPFIND on calendar * * @group ServerTests */ public function testPropfindThundebird() { $credentials = $this->getTestCredentials(); $account = $this->getAccountByName($credentials['username']); $this->assertInstanceOf('Tinebase_Model_FullUser', $account); $containerId = $this->getPersonalContainer($account, 'Calendar_Model_Event')->getFirstRecord()->getId(); $request = \Zend\Http\PhpEnvironment\Request::fromString(<<<EOS PROPFIND /calendars/{$account->contact_id}/{$containerId}/ HTTP/1.1 Host: localhost Depth: 1 Content-Type: application/xml; charset="utf-8" User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120824 Thunderbird/15.0 Lightning/1.7 <?xml version="1.0" encoding="UTF-8"?> <D:propfind xmlns:D="DAV:" xmlns:CS="http://calendarserver.org/ns/" xmlns:C="urn:ietf:params:xml:ns:caldav"><D:prop><D:resourcetype/><D:owner/><D:current-user-principal/><D:supported-report-set/><C:supported-calendar-component-set/><CS:getctag/></D:prop></D:propfind> EOS ); $_SERVER['REQUEST_METHOD'] = $request->getMethod(); $_SERVER['REQUEST_URI'] = $request->getUri()->getPath(); $_SERVER['HTTP_DEPTH'] = '0'; $request->getServer()->set('PHP_AUTH_USER', $credentials['username']); $request->getServer()->set('PHP_AUTH_PW', $credentials['password']); $request->getServer()->set('REMOTE_ADDR', 'localhost'); ob_start(); $server = new Tinebase_Server_WebDAV(); $server->handle($request); $result = ob_get_contents(); ob_end_clean(); $responseDoc = new DOMDocument(); $responseDoc->loadXML($result); #$responseDoc->formatOutput = true; error_log($responseDoc->saveXML()); $xpath = new DomXPath($responseDoc); $xpath->registerNamespace('cal', 'urn:ietf:params:xml:ns:caldav'); $xpath->registerNamespace('cs', 'http://calendarserver.org/ns/'); $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/d:current-user-principal'); $this->assertEquals(1, $nodes->length, $responseDoc->saveXML()); }