mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-09 02:42:55 +00:00
100 lines
2.2 KiB
PHP
100 lines
2.2 KiB
PHP
|
<?php
|
||
|
|
||
|
class Sabre_DAVACL_Property_SupportedPrivilegeSetTest extends PHPUnit_Framework_TestCase {
|
||
|
|
||
|
function testSimple() {
|
||
|
|
||
|
$prop = new Sabre_DAVACL_Property_SupportedPrivilegeSet(array(
|
||
|
'privilege' => '{DAV:}all',
|
||
|
));
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @depends testSimple
|
||
|
*/
|
||
|
function testSerializeSimple() {
|
||
|
|
||
|
$prop = new Sabre_DAVACL_Property_SupportedPrivilegeSet(array(
|
||
|
'privilege' => '{DAV:}all',
|
||
|
));
|
||
|
|
||
|
$doc = new DOMDocument();
|
||
|
$root = $doc->createElementNS('DAV:', 'd:supported-privilege-set');
|
||
|
|
||
|
$doc->appendChild($root);
|
||
|
|
||
|
$server = new Sabre_DAV_Server();
|
||
|
$prop->serialize($server, $root);
|
||
|
|
||
|
$xml = $doc->saveXML();
|
||
|
|
||
|
$this->assertEquals(
|
||
|
'<?xml version="1.0"?>
|
||
|
<d:supported-privilege-set xmlns:d="DAV:">' .
|
||
|
'<d:supported-privilege>' .
|
||
|
'<d:privilege>' .
|
||
|
'<d:all/>' .
|
||
|
'</d:privilege>' .
|
||
|
'</d:supported-privilege>' .
|
||
|
'</d:supported-privilege-set>
|
||
|
', $xml);
|
||
|
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @depends testSimple
|
||
|
*/
|
||
|
function testSerializeAggregate() {
|
||
|
|
||
|
$prop = new Sabre_DAVACL_Property_SupportedPrivilegeSet(array(
|
||
|
'privilege' => '{DAV:}all',
|
||
|
'abstract' => true,
|
||
|
'aggregates' => array(
|
||
|
array(
|
||
|
'privilege' => '{DAV:}read',
|
||
|
),
|
||
|
array(
|
||
|
'privilege' => '{DAV:}write',
|
||
|
'description' => 'booh',
|
||
|
),
|
||
|
),
|
||
|
));
|
||
|
|
||
|
$doc = new DOMDocument();
|
||
|
$root = $doc->createElementNS('DAV:', 'd:supported-privilege-set');
|
||
|
|
||
|
$doc->appendChild($root);
|
||
|
|
||
|
$server = new Sabre_DAV_Server();
|
||
|
$prop->serialize($server, $root);
|
||
|
|
||
|
$xml = $doc->saveXML();
|
||
|
|
||
|
$this->assertEquals(
|
||
|
'<?xml version="1.0"?>
|
||
|
<d:supported-privilege-set xmlns:d="DAV:">' .
|
||
|
'<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);
|
||
|
|
||
|
}
|
||
|
}
|