ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ShareResourceTest.php
Go to the documentation of this file.
1<?php
2
4
8
10
11 function testDeserialize() {
12
13 $xml = <<<XML
14<?xml version="1.0" encoding="utf-8" ?>
15<D:share-resource xmlns:D="DAV:">
16 <D:sharee>
17 <D:href>mailto:eric@example.com</D:href>
18 <D:prop>
19 <D:displayname>Eric York</D:displayname>
20 </D:prop>
21 <D:comment>Shared workspace</D:comment>
22 <D:share-access>
23 <D:read-write />
24 </D:share-access>
25 </D:sharee>
26 <D:sharee>
27 <D:href>mailto:eric@example.com</D:href>
28 <D:share-access>
29 <D:read />
30 </D:share-access>
31 </D:sharee>
32 <D:sharee>
33 <D:href>mailto:wilfredo@example.com</D:href>
34 <D:share-access>
35 <D:no-access />
36 </D:share-access>
37 </D:sharee>
38</D:share-resource>
39XML;
40
41 $result = $this->parse($xml, [
42 '{DAV:}share-resource' => 'Sabre\\DAV\\Xml\\Request\\ShareResource'
43 ]);
44
45 $this->assertInstanceOf(
46 'Sabre\\DAV\\Xml\\Request\\ShareResource',
47 $result['value']
48 );
49
50 $expected = [
51 new Sharee(),
52 new Sharee(),
53 new Sharee(),
54 ];
55
56 $expected[0]->href = 'mailto:eric@example.com';
57 $expected[0]->properties['{DAV:}displayname'] = 'Eric York';
58 $expected[0]->comment = 'Shared workspace';
59 $expected[0]->access = Plugin::ACCESS_READWRITE;
60
61 $expected[1]->href = 'mailto:eric@example.com';
62 $expected[1]->access = Plugin::ACCESS_READ;
63
64 $expected[2]->href = 'mailto:wilfredo@example.com';
65 $expected[2]->access = Plugin::ACCESS_NOACCESS;
66
67 $this->assertEquals(
68 $expected,
69 $result['value']->sharees
70 );
71
72 }
73
74
75}
$result
An exception for terminatinating execution or to throw for unit testing.
This plugin implements HTTP requests and properties related to:
Definition: Plugin.php:27
This class represents the {DAV:}sharee element.
Definition: Sharee.php:21
parse($xml, array $elementMap=[])
Definition: XmlTest.php:26
comment()
Definition: comment.php:2