ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ShareTest.php
Go to the documentation of this file.
1 <?php
2 
4 
7 
8 class ShareTest extends XmlTest {
9 
10  protected $elementMap = [
11  '{http://calendarserver.org/ns/}share' => 'Sabre\\CalDAV\\Xml\\Request\\Share',
12  ];
13 
14  function testDeserialize() {
15 
16  $xml = <<<XML
17 <?xml version="1.0" encoding="utf-8" ?>
18  <CS:share xmlns:D="DAV:"
19  xmlns:CS="http://calendarserver.org/ns/">
20  <CS:set>
21  <D:href>mailto:eric@example.com</D:href>
22  <CS:common-name>Eric York</CS:common-name>
23  <CS:summary>Shared workspace</CS:summary>
24  <CS:read-write />
25  </CS:set>
26  <CS:remove>
27  <D:href>mailto:foo@bar</D:href>
28  </CS:remove>
29  </CS:share>
30 XML;
31 
32  $result = $this->parse($xml);
33  $share = new Share([
34  new Sharee([
35  'href' => 'mailto:eric@example.com',
36  'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE,
37  'properties' => [
38  '{DAV:}displayname' => 'Eric York',
39  ],
40  'comment' => 'Shared workspace',
41  ]),
42  new Sharee([
43  'href' => 'mailto:foo@bar',
44  'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS,
45  ]),
46  ]);
47 
48  $this->assertEquals(
49  $share,
50  $result['value']
51  );
52 
53  }
54 
56 
57  $xml = <<<XML
58 <?xml version="1.0" encoding="utf-8" ?>
59  <CS:share xmlns:D="DAV:"
60  xmlns:CS="http://calendarserver.org/ns/">
61  <CS:set>
62  <D:href>mailto:eric@example.com</D:href>
63  <CS:read />
64  </CS:set>
65  </CS:share>
66 XML;
67 
68  $result = $this->parse($xml);
69  $share = new Share([
70  new Sharee([
71  'href' => 'mailto:eric@example.com',
72  'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ,
73  ]),
74  ]);
75 
76  $this->assertEquals(
77  $share,
78  $result['value']
79  );
80 
81  }
82 
83 }
This class represents the {DAV:}sharee element.
Definition: Sharee.php:21
$result
Share POST request parser.
Definition: Share.php:21
parse($xml, array $elementMap=[])
Definition: XmlTest.php:26