@@ -96,4 +96,59 @@ public function testMultiGetVCard4()
9696 ],
9797 ], $ result );
9898 }
99+
100+ public function testMultiGet404 ()
101+ {
102+ $ request = HTTP \Sapi::createFromServerArray ([
103+ 'REQUEST_METHOD ' => 'REPORT ' ,
104+ 'REQUEST_URI ' => '/addressbooks/user1/book1 ' ,
105+ ]);
106+
107+ $ request ->setBody (
108+ '<?xml version="1.0"?>
109+ <c:addressbook-multiget xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:carddav">
110+ <d:prop>
111+ <d:getetag />
112+ <c:address-data />
113+ </d:prop>
114+ <d:href>/addressbooks/user1/unknown/card1</d:href>
115+ <d:href>/addressbooks/user1/book1/card1</d:href>
116+ <d:href>/addressbooks/user1/book1/unknown-card</d:href>
117+ </c:addressbook-multiget> '
118+ );
119+
120+ $ response = new HTTP \ResponseMock ();
121+
122+ $ this ->server ->httpRequest = $ request ;
123+ $ this ->server ->httpResponse = $ response ;
124+
125+ $ this ->server ->exec ();
126+
127+ $ this ->assertEquals (207 , $ response ->status , 'Incorrect status code. Full response body: ' .$ response ->body );
128+
129+ $ this ->assertXmlStringEqualsXmlString ('<?xml version="1.0"?>
130+ <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:card="urn:ietf:params:xml:ns:carddav">
131+ <d:response>
132+ <d:href>/addressbooks/user1/unknown/card1</d:href>
133+ <d:status>HTTP/1.1 404 Not Found</d:status>
134+ </d:response>
135+ <d:response>
136+ <d:href>/addressbooks/user1/book1/card1</d:href>
137+ <d:propstat>
138+ <d:prop>
139+ <d:getetag>"ffe3b42186ba156c84fc1581c273f01c"</d:getetag>
140+ <card:address-data>BEGIN:VCARD
141+ VERSION:3.0
142+ UID:12345
143+ END:VCARD</card:address-data>
144+ </d:prop>
145+ <d:status>HTTP/1.1 200 OK</d:status>
146+ </d:propstat>
147+ </d:response>
148+ <d:response>
149+ <d:href>/addressbooks/user1/book1/unknown-card</d:href>
150+ <d:status>HTTP/1.1 404 Not Found</d:status>
151+ </d:response>
152+ </d:multistatus> ' , $ response ->body );
153+ }
99154}
0 commit comments