ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
NeedPrivilegesExceptionTest.php
Go to the documentation of this file.
1
<?
php
2
3
namespace
Sabre\DAVACL\Exception
;
4
5
use
Sabre\DAV
;
6
7
class
NeedPrivilegesExceptionTest
extends
\PHPUnit_Framework_TestCase
{
8
9
function
testSerialize
() {
10
11
$uri =
'foo'
;
12
$privileges = [
13
'{DAV:}read'
,
14
'{DAV:}write'
,
15
];
16
$ex =
new
NeedPrivileges
($uri, $privileges);
17
18
$server
=
new
DAV\Server
();
19
$dom = new \DOMDocument(
'1.0'
,
'utf-8'
);
20
$root
= $dom->createElementNS(
'DAV:'
,
'd:root'
);
21
$dom->appendChild(
$root
);
22
23
$ex->serialize(
$server
,
$root
);
24
25
$xpaths = [
26
'/d:root'
=> 1,
27
'/d:root/d:need-privileges'
=> 1,
28
'/d:root/d:need-privileges/d:resource'
=> 2,
29
'/d:root/d:need-privileges/d:resource/d:href'
=> 2,
30
'/d:root/d:need-privileges/d:resource/d:privilege'
=> 2,
31
'/d:root/d:need-privileges/d:resource/d:privilege/d:read'
=> 1,
32
'/d:root/d:need-privileges/d:resource/d:privilege/d:write'
=> 1,
33
];
34
35
// Reloading because PHP DOM sucks
36
$dom2 = new \DOMDocument(
'1.0'
,
'utf-8'
);
37
$dom2->loadXML($dom->saveXML());
38
39
$dxpath = new \DOMXPath($dom2);
40
$dxpath->registerNamespace(
'd'
,
'DAV:'
);
41
foreach
($xpaths as $xpath => $count) {
42
43
$this->assertEquals($count, $dxpath->query($xpath)->length,
'Looking for : '
. $xpath .
', we could only find '
. $dxpath->query($xpath)->length .
' elements, while we expected '
. $count);
44
45
}
46
47
}
48
49
}
Sabre\DAV
Sabre\DAVACL\Exception
Definition:
AceConflict.php:3
Sabre\DAVACL\Exception\NeedPrivilegesExceptionTest
Definition:
NeedPrivilegesExceptionTest.php:7
PHPUnit_Framework_TestCase
$server
$server
Definition:
sabredav.php:48
Sabre\DAV\Server
Main DAV server class.
Definition:
Server.php:23
$root
$root
Definition:
sabredav.php:45
Sabre\DAVACL\Exception\NeedPrivileges
NeedPrivileges.
Definition:
NeedPrivileges.php:17
php
Sabre\DAVACL\Exception\NeedPrivilegesExceptionTest\testSerialize
testSerialize()
Definition:
NeedPrivilegesExceptionTest.php:9
libs
composer
vendor
sabre
dav
tests
Sabre
DAVACL
Exception
NeedPrivilegesExceptionTest.php
Generated on Thu Feb 27 2025 19:01:30 for ILIAS by
1.8.13 (using
Doxyfile
)