ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
CurrentUserPrivilegeSetTest.php
Go to the documentation of this file.
1
<?
php
2
3
namespace
Sabre\DAVACL\Xml\Property
;
4
5
use
Sabre\DAV
;
6
use
Sabre\DAV\Browser\HtmlOutputHelper
;
7
use
Sabre\HTTP
;
8
use
Sabre\Xml\Reader
;
9
10
class
CurrentUserPrivilegeSetTest
extends
\PHPUnit_Framework_TestCase
{
11
12
function
testSerialize
() {
13
14
$privileges = [
15
'{DAV:}read'
,
16
'{DAV:}write'
,
17
];
18
$prop =
new
CurrentUserPrivilegeSet
($privileges);
19
$xml
= (
new
DAV\Server
())->xml->write(
'{DAV:}root'
, $prop);
20
21
$expected = <<<XML
22
<d:root xmlns:d=
"DAV:"
xmlns:
s
=
"http://sabredav.org/ns"
>
23
<d:privilege>
24
<d:read />
25
</d:privilege>
26
<d:privilege>
27
<d:
write
/>
28
</d:privilege>
29
</d:root>
30
XML;
31
32
33
$this->assertXmlStringEqualsXmlString($expected,
$xml
);
34
35
}
36
37
function
testUnserialize
() {
38
39
$source
=
'<?xml version="1.0"?>
40
<d:root xmlns:d="DAV:">
41
<d:privilege>
42
<d:write-properties />
43
</d:privilege>
44
<d:ignoreme />
45
<d:privilege>
46
<d:read />
47
</d:privilege>
48
</d:root>
49
'
;
50
51
$result
= $this->
parse
(
$source
);
52
$this->assertTrue(
$result
->has(
'{DAV:}read'
));
53
$this->assertTrue(
$result
->has(
'{DAV:}write-properties'
));
54
$this->assertFalse(
$result
->has(
'{DAV:}bind'
));
55
56
}
57
58
function
parse
(
$xml
) {
59
60
$reader
=
new
Reader
();
61
$reader
->elementMap[
'{DAV:}root'
] =
'Sabre\\DAVACL\\Xml\\Property\\CurrentUserPrivilegeSet'
;
62
$reader
->xml(
$xml
);
63
$result
=
$reader
->parse();
64
return
$result
[
'value'
];
65
66
}
67
68
function
testToHtml
() {
69
70
$privileges = [
'{DAV:}read'
,
'{DAV:}write'
];
71
72
$prop =
new
CurrentUserPrivilegeSet
($privileges);
73
$html
=
new
HtmlOutputHelper
(
74
'/base/'
,
75
[
'DAV:'
=>
'd'
]
76
);
77
78
$expected =
79
'<span title="{DAV:}read">d:read</span>, '
.
80
'<span title="{DAV:}write">d:write</span>'
;
81
82
$this->assertEquals($expected, $prop->toHtml(
$html
));
83
84
}
85
86
}
Sabre\DAV
Sabre\DAVACL\Xml\Property\CurrentUserPrivilegeSetTest\testUnserialize
testUnserialize()
Definition:
CurrentUserPrivilegeSetTest.php:37
Reader
Sabre\DAVACL\Xml\Property\CurrentUserPrivilegeSetTest\testSerialize
testSerialize()
Definition:
CurrentUserPrivilegeSetTest.php:12
HtmlOutputHelper
$result
$result
Definition:
CleanUpTest.php:463
$reader
$reader
Definition:
scanCallStructure.php:5
Sabre\HTTP
Definition:
ResponseMock.php:3
PHPUnit_Framework_TestCase
Sabre\DAVACL\Xml\Property\CurrentUserPrivilegeSetTest\parse
parse($xml)
Definition:
CurrentUserPrivilegeSetTest.php:58
s
Sabre\DAVACL\Xml\Property
Definition:
Acl.php:3
Sabre\Xml\Reader
The Reader class expands upon PHP's built-in XMLReader.
Definition:
Reader.php:20
Sabre\DAVACL\Xml\Property\CurrentUserPrivilegeSetTest
Definition:
CurrentUserPrivilegeSetTest.php:10
Sabre\DAV\Server
Main DAV server class.
Definition:
Server.php:23
Sabre\DAVACL\Xml\Property\CurrentUserPrivilegeSetTest\testToHtml
testToHtml()
Definition:
CurrentUserPrivilegeSetTest.php:68
Sabre\DAVACL\Xml\Property\CurrentUserPrivilegeSet
CurrentUserPrivilegeSet.
Definition:
CurrentUserPrivilegeSet.php:21
$xml
$xml
Definition:
fetch_windows_zones.php:11
php
$source
$source
Definition:
linkback.php:22
Sabre\VObject\write
write($vcard)
Definition:
mergeduplicates.php:76
$html
$html
Definition:
example_001.php:87
Sabre\DAV\Browser\HtmlOutputHelper
This class provides a few utility functions for easily generating HTML for the browser plugin...
Definition:
HtmlOutputHelper.php:16
libs
composer
vendor
sabre
dav
tests
Sabre
DAVACL
Xml
Property
CurrentUserPrivilegeSetTest.php
Generated on Thu Jan 16 2025 19:01:52 for ILIAS by
1.8.13 (using
Doxyfile
)