ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
AclPrincipalPropSetReportTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\DAVACL;
4 
6 
8 
9  public $setupACL = true;
10  public $autoLogin = 'admin';
11 
12  function testReport() {
13 
14  $xml = <<<XML
15 <?xml version="1.0"?>
16 <acl-principal-prop-set xmlns="DAV:">
17  <prop>
18  <principal-URL />
19  <displayname />
20  </prop>
21 </acl-principal-prop-set>
22 XML;
23 
24  $request = new Request('REPORT', '/principals/user1', ['Content-Type' => 'application/xml', 'Depth' => 0]);
25  $request->setBody($xml);
26 
27  $response = $this->request($request, 207);
28 
29  $expected = <<<XML
30 <?xml version="1.0"?>
31 <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
32  <d:response>
33  <d:href>/principals/admin/</d:href>
34  <d:propstat>
35  <d:prop>
36  <d:principal-URL><d:href>/principals/admin/</d:href></d:principal-URL>
37  <d:displayname>Admin</d:displayname>
38  </d:prop>
39  <d:status>HTTP/1.1 200 OK</d:status>
40  </d:propstat>
41  </d:response>
42 </d:multistatus>
43 XML;
44 
45  $this->assertXmlStringEqualsXmlString(
46  $expected,
47  $response->getBodyAsString()
48  );
49 
50  }
51 
52  function testReportDepth1() {
53 
54  $xml = <<<XML
55 <?xml version="1.0"?>
56 <acl-principal-prop-set xmlns="DAV:">
57  <principal-URL />
58  <displayname />
59 </acl-principal-prop-set>
60 XML;
61 
62  $request = new Request('REPORT', '/principals/user1', ['Content-Type' => 'application/xml', 'Depth' => 1]);
63  $request->setBody($xml);
64 
65  $this->request($request, 400);
66 
67  }
68 
69 }
foreach($paths as $path) $request
Definition: asyncclient.php:32
The Request class represents a single HTTP request.
Definition: Request.php:18
This class may be used as a basis for other webdav-related unittests.
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
$response