@@ -288,14 +288,14 @@ function testAddressBookDepth0() {
288288 );
289289
290290 $ request ->setBody (
291- '<?xml version="1.0"?>
291+ '<?xml version="1.0"?>
292292<c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav">
293293 <d:prop>
294294 <c:address-data content-type="application/vcard+json" />
295295 <d:getetag />
296296 </d:prop>
297297</c:addressbook-query> '
298- );
298+ );
299299
300300 $ response = new HTTP \ResponseMock ();
301301
@@ -305,6 +305,51 @@ function testAddressBookDepth0() {
305305 $ this ->server ->exec ();
306306
307307 $ this ->assertEquals (415 , $ response ->status , 'Incorrect status code. Full response body: ' . $ response ->body );
308+ }
309+
310+ function testAddressBookProperties () {
311+
312+ $ request = new HTTP \Request (
313+ 'REPORT ' ,
314+ '/addressbooks/user1/book3 ' ,
315+ ['Depth ' => '1 ' ]
316+ );
317+
318+ $ request ->setBody (
319+ '<?xml version="1.0"?>
320+ <c:addressbook-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav">
321+ <d:prop>
322+ <c:address-data>
323+ <c:prop name="FN"/>
324+ <c:prop name="BDAY"/>
325+ </c:address-data>
326+ <d:getetag />
327+ </d:prop>
328+ </c:addressbook-query> '
329+ );
330+
331+ $ response = new HTTP \ResponseMock ();
332+
333+ $ this ->server ->httpRequest = $ request ;
334+ $ this ->server ->httpResponse = $ response ;
335+
336+ $ this ->server ->exec ();
337+
338+ $ this ->assertEquals (207 , $ response ->status , 'Incorrect status code. Full response body: ' . $ response ->body );
339+
340+ // using the client for parsing
341+ $ client = new DAV \Client (['baseUri ' => '/ ' ]);
342+
343+ $ result = $ client ->parseMultiStatus ($ response ->body );
344+
345+ $ this ->assertEquals ([
346+ '/addressbooks/user1/book3/card3 ' => [
347+ 200 => [
348+ '{DAV:}getetag ' => '" ' . md5 ("BEGIN:VCARD \nVERSION:3.0 \nUID:12345 \nFN:Test-Card \nEMAIL;TYPE=home:bar@example.org \nEND:VCARD " ) . '" ' ,
349+ '{urn:ietf:params:xml:ns:carddav}address-data ' => "BEGIN:VCARD \r\nVERSION:3.0 \r\nUID:12345 \r\nFN:Test-Card \r\nEND:VCARD \r\n" ,
350+ ],
351+ ],
352+ ], $ result );
308353
309354 }
310355}
0 commit comments