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