コード例 #1
0
ファイル: ClientTest.php プロジェクト: msooon/hubzilla
 function testPropFindDepth1CustomProp()
 {
     $client = new ClientMock(array('baseUri' => 'http://example.org/foo/bar/'));
     $responseBlob = array("HTTP/1.1 200 OK", "", "<?xml version=\"1.0\"?>", "<d:multistatus xmlns:d=\"DAV:\" xmlns:x=\"urn:custom\">", "  <d:response>", "    <d:href>/foo/bar/</d:href>", "    <d:propstat>", "      <d:prop>", "         <d:foo>hello</d:foo>", "         <x:bar>world</x:bar>", "      </d:prop>", "      <d:status>HTTP/1.1 200 OK</d:status>", "    </d:propstat>", "  </d:response>", "</d:multistatus>");
     $client->response = array(implode("\r\n", $responseBlob), array('header_size' => 19, 'http_code' => 200), 0, "");
     $result = $client->propfind('', array('{DAV:}foo', '{urn:custom}bar'), 1);
     $this->assertEquals(array("/foo/bar/" => array('{DAV:}foo' => 'hello', '{urn:custom}bar' => 'world')), $result);
     $requestBody = array('<?xml version="1.0"?>', '<d:propfind xmlns:d="DAV:">', '  <d:prop>', '    <d:foo />', '    <x:bar xmlns:x="urn:custom"/>', '  </d:prop>', '</d:propfind>');
     $requestBody = implode("\n", $requestBody);
     $this->assertEquals($requestBody, $client->curlSettings[CURLOPT_POSTFIELDS]);
 }