ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SupportedPrivilegeSetTest.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use Sabre\DAV;
7 use Sabre\HTTP;
8 
10 
11  function testSimple() {
12 
13  $prop = new SupportedPrivilegeSet([
14  'privilege' => '{DAV:}all',
15  ]);
16  $this->assertInstanceOf('Sabre\DAVACL\Xml\Property\SupportedPrivilegeSet', $prop);
17 
18  }
19 
20 
24  function testSerializeSimple() {
25 
26  $prop = new SupportedPrivilegeSet([]);
27 
28  $xml = (new DAV\Server())->xml->write('{DAV:}supported-privilege-set', $prop);
29 
30  $this->assertXmlStringEqualsXmlString('
31 <d:supported-privilege-set xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
32  <d:supported-privilege>
33  <d:privilege>
34  <d:all/>
35  </d:privilege>
36  </d:supported-privilege>
37 </d:supported-privilege-set>', $xml);
38 
39  }
40 
45 
46  $prop = new SupportedPrivilegeSet([
47  '{DAV:}read' => [],
48  '{DAV:}write' => [
49  'description' => 'booh',
50  ]
51  ]);
52 
53  $xml = (new DAV\Server())->xml->write('{DAV:}supported-privilege-set', $prop);
54 
55  $this->assertXmlStringEqualsXmlString('
56 <d:supported-privilege-set xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
57  <d:supported-privilege>
58  <d:privilege>
59  <d:all/>
60  </d:privilege>
61  <d:supported-privilege>
62  <d:privilege>
63  <d:read/>
64  </d:privilege>
65  </d:supported-privilege>
66  <d:supported-privilege>
67  <d:privilege>
68  <d:write/>
69  </d:privilege>
70  <d:description>booh</d:description>
71  </d:supported-privilege>
72  </d:supported-privilege>
73 </d:supported-privilege-set>', $xml);
74 
75  }
76 
77  function testToHtml() {
78 
79  $prop = new SupportedPrivilegeSet([
80  '{DAV:}read' => [],
81  '{DAV:}write' => [
82  'description' => 'booh',
83  ],
84  ]);
85  $html = new HtmlOutputHelper(
86  '/base/',
87  ['DAV:' => 'd']
88  );
89 
90  $expected = <<<HTML
91 <ul class="tree"><li><span title="{DAV:}all">d:all</span>
92 <ul>
93 <li><span title="{DAV:}read">d:read</span></li>
94 <li><span title="{DAV:}write">d:write</span> booh</li>
95 </ul></li>
96 </ul>
97 
98 HTML;
99 
100  $this->assertEquals($expected, $prop->toHtml($html));
101 
102  }
103 }
all(array $promises)
This file contains a set of functions that are useful for dealing with the Promise object...
Definition: functions.php:32
Main DAV server class.
Definition: Server.php:23
$html
Definition: example_001.php:87
This class provides a few utility functions for easily generating HTML for the browser plugin...