Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1726520
SupportedPrivilegeSetTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
2 KB
Subscribers
None
SupportedPrivilegeSetTest.php
View Options
<?php
namespace
Sabre\DAVACL\Xml\Property
;
use
Sabre\DAV
;
use
Sabre\HTTP
;
use
Sabre\DAV\Browser\HtmlOutputHelper
;
class
SupportedPrivilegeSetTest
extends
\PHPUnit_Framework_TestCase
{
function
testSimple
()
{
$prop
=
new
SupportedPrivilegeSet
([
'privilege'
=>
'{DAV:}all'
,
]);
$this
->
assertInstanceOf
(
'Sabre
\D
AVACL
\X
ml
\P
roperty
\S
upportedPrivilegeSet'
,
$prop
);
}
/**
* @depends testSimple
*/
function
testSerializeSimple
()
{
$prop
=
new
SupportedPrivilegeSet
([
'privilege'
=>
'{DAV:}all'
,
]);
$xml
=
(
new
DAV\Server
())->
xml
->
write
(
'{DAV:}supported-privilege-set'
,
$prop
);
$this
->
assertXmlStringEqualsXmlString
(
'
<d:supported-privilege-set xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<d:supported-privilege>
<d:privilege>
<d:all/>
</d:privilege>
</d:supported-privilege>
</d:supported-privilege-set>'
,
$xml
);
}
/**
* @depends testSimple
*/
function
testSerializeAggregate
()
{
$prop
=
new
SupportedPrivilegeSet
([
'privilege'
=>
'{DAV:}all'
,
'abstract'
=>
true
,
'aggregates'
=>
[
[
'privilege'
=>
'{DAV:}read'
,
],
[
'privilege'
=>
'{DAV:}write'
,
'description'
=>
'booh'
,
],
],
]);
$xml
=
(
new
DAV\Server
())->
xml
->
write
(
'{DAV:}supported-privilege-set'
,
$prop
);
$this
->
assertXmlStringEqualsXmlString
(
'
<d:supported-privilege-set xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<d:supported-privilege>
<d:privilege>
<d:all/>
</d:privilege>
<d:abstract/>
<d:supported-privilege>
<d:privilege>
<d:read/>
</d:privilege>
</d:supported-privilege>
<d:supported-privilege>
<d:privilege>
<d:write/>
</d:privilege>
<d:description>booh</d:description>
</d:supported-privilege>
</d:supported-privilege>
</d:supported-privilege-set>'
,
$xml
);
}
function
testToHtml
()
{
$prop
=
new
SupportedPrivilegeSet
([
'privilege'
=>
'{DAV:}all'
,
'abstract'
=>
true
,
'aggregates'
=>
[
[
'privilege'
=>
'{DAV:}read'
,
],
[
'privilege'
=>
'{DAV:}write'
,
'description'
=>
'booh'
,
],
],
]);
$html
=
new
HtmlOutputHelper
(
'/base/'
,
[
'DAV:'
=>
'd'
]
);
$expected
=
<<<HTML
<ul class="tree"><li><span title="{DAV:}all">d:all</span> <i>(abstract)</i>
<ul>
<li><span title="{DAV:}read">d:read</span></li>
<li><span title="{DAV:}write">d:write</span> booh</li>
</ul></li>
</ul>
HTML;
$this
->
assertEquals
(
$expected
,
$prop
->
toHtml
(
$html
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Dec 4, 5:02 PM (10 h, 8 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
913510
Default Alt Text
SupportedPrivilegeSetTest.php (2 KB)
Attached To
rDAVCAL DokuWiki DAVCal PlugIn
Event Timeline
Log In to Comment