Skip to content

Commit

Permalink
test: adjust testPropFindUnfiltered to show multi-propstat behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Dec 11, 2023
1 parent a93bd80 commit eb50dc2
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion tests/Sabre/DAV/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,20 @@ public function testPropFindUnfiltered()
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
<d:propstat>
<d:prop>
<d:contentlength></d:contentlength>
</d:prop>
<d:status>HTTP/1.1 404 Not Found</d:status>
</d:propstat>
</d:response>
<d:response>
<d:href>/folder1/file1.txt</d:href>
<d:propstat>
<d:prop>
<d:resourcetype/>
<d:displayname>File1</d:displayname>
<d:contentlength>12</d:contentlength>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
Expand All @@ -363,6 +370,7 @@ public function testPropFindUnfiltered()
<d:prop>
<d:resourcetype/>
<d:displayname>File2</d:displayname>
<d:contentlength>27</d:contentlength>
</d:prop>
<d:status>HTTP/1.1 403 Forbidden</d:status>
</d:propstat>
Expand All @@ -373,15 +381,32 @@ public function testPropFindUnfiltered()
<d:prop>
<d:resourcetype/>
<d:displayname>File3</d:displayname>
<d:contentlength>42</d:contentlength>
</d:prop>
<d:status>HTTP/1.1 425 Too Early</d:status>
</d:propstat>
</d:response>
<d:response>
<d:href>/folder1/subfolder</d:href>
<d:propstat>
<d:prop>
<d:resourcetype><d:collection/></d:resourcetype>
<d:displayname>SubFolder</d:displayname>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
<d:propstat>
<d:prop>
<d:contentlength></d:contentlength>
</d:prop>
<d:status>HTTP/1.1 404 Not Found</d:status>
</d:propstat>
</d:response>
</d:multistatus>
XML;

$client->response = new Response(207, [], $responseBody);
$result = $client->propFindUnfiltered('folder1', ['{DAV:}resourcetype', '{DAV:}displayname', '{urn:zim}gir'], 1);
$result = $client->propFindUnfiltered('folder1', ['{DAV:}resourcetype', '{DAV:}displayname', '{DAV:}contentlength', '{urn:zim}gir'], 1);

self::assertEquals([
'/folder1' => [
Expand All @@ -395,23 +420,33 @@ public function testPropFindUnfiltered()
'properties' => [
'{DAV:}resourcetype' => null,
'{DAV:}displayname' => 'File1',
'{DAV:}contentlength' => 12,
],
'status' => 200,
],
'/folder1/file2.txt' => [
'properties' => [
'{DAV:}resourcetype' => null,
'{DAV:}displayname' => 'File2',
'{DAV:}contentlength' => 27,
],
'status' => 403,
],
'/folder1/file3.txt' => [
'properties' => [
'{DAV:}resourcetype' => null,
'{DAV:}displayname' => 'File3',
'{DAV:}contentlength' => 42,
],
'status' => 425,
],
'/folder1/subfolder' => [
'properties' => [
'{DAV:}resourcetype' => new Xml\Property\ResourceType('{DAV:}collection'),
'{DAV:}displayname' => 'SubFolder',
],
'status' => 200,
],
], $result);

$request = $client->request;
Expand Down

0 comments on commit eb50dc2

Please sign in to comment.