ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PrincipalMatchReportTest.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
7  protected $elementMap = [
8 
9  '{DAV:}principal-match' => 'Sabre\DAVACL\Xml\Request\PrincipalMatchReport',
10 
11  ];
12 
13  function testDeserialize() {
14 
15  $xml = <<<XML
16 <?xml version="1.0" encoding="utf-8" ?>
17  <D:principal-match xmlns:D="DAV:">
18  <D:principal-property>
19  <D:owner/>
20  </D:principal-property>
21  </D:principal-match>
22 XML;
23 
24  $result = $this->parse($xml);
25 
26  $this->assertEquals(PrincipalMatchReport::PRINCIPAL_PROPERTY, $result['value']->type);
27  $this->assertEquals('{DAV:}owner', $result['value']->principalProperty);
28 
29  }
30 
31  function testDeserializeSelf() {
32 
33  $xml = <<<XML
34 <?xml version="1.0" encoding="utf-8" ?>
35  <D:principal-match xmlns:D="DAV:">
36  <D:self />
37  <D:prop>
38  <D:foo />
39  </D:prop>
40  </D:principal-match>
41 XML;
42 
43  $result = $this->parse($xml);
44 
45  $this->assertEquals(PrincipalMatchReport::SELF, $result['value']->type);
46  $this->assertNull($result['value']->principalProperty);
47  $this->assertEquals(['{DAV:}foo'], $result['value']->properties);
48 
49  }
50 
51 }
$result
parse($xml, array $elementMap=[])
Definition: XmlTest.php:26
const PRINCIPAL_PROPERTY
Report on a property on resources, such as {DAV:}owner, that match the current principal.
const SELF
Report on a list of principals that match the current principal.