ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ShareeTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\DAV\Xml\Element;
4 
7 
8 class ShareeTest extends XmlTest {
9 
14 
15  new Sharee(['foo' => 'bar']);
16 
17  }
18 
19  function testDeserialize() {
20 
21  $xml = <<<XML
22 <?xml version="1.0" encoding="utf-8" ?>
23 <D:sharee xmlns:D="DAV:">
24  <D:href>mailto:eric@example.com</D:href>
25  <D:prop>
26  <D:displayname>Eric York</D:displayname>
27  </D:prop>
28  <D:comment>Shared workspace</D:comment>
29  <D:share-access>
30  <D:read-write />
31  </D:share-access>
32 </D:sharee>
33 XML;
34 
35  $result = $this->parse($xml, [
36  '{DAV:}sharee' => 'Sabre\\DAV\\Xml\\Element\\Sharee'
37  ]);
38 
39  $expected = new Sharee([
40  'href' => 'mailto:eric@example.com',
41  'properties' => ['{DAV:}displayname' => 'Eric York'],
42  'comment' => 'Shared workspace',
43  'access' => Plugin::ACCESS_READWRITE,
44  ]);
45  $this->assertEquals(
46  $expected,
47  $result['value']
48  );
49 
50  }
51 
55  function testDeserializeNoHref() {
56 
57  $xml = <<<XML
58 <?xml version="1.0" encoding="utf-8" ?>
59 <D:sharee xmlns:D="DAV:">
60  <D:prop>
61  <D:displayname>Eric York</D:displayname>
62  </D:prop>
63  <D:comment>Shared workspace</D:comment>
64  <D:share-access>
65  <D:read-write />
66  </D:share-access>
67 </D:sharee>
68 XML;
69 
70  $this->parse($xml, [
71  '{DAV:}sharee' => 'Sabre\\DAV\\Xml\\Element\\Sharee'
72  ]);
73 
74  }
75 
76 
81 
82  $xml = <<<XML
83 <?xml version="1.0" encoding="utf-8" ?>
84 <D:sharee xmlns:D="DAV:">
85  <D:href>mailto:eric@example.com</D:href>
86  <D:prop>
87  <D:displayname>Eric York</D:displayname>
88  </D:prop>
89  <D:comment>Shared workspace</D:comment>
90 </D:sharee>
91 XML;
92 
93  $this->parse($xml, [
94  '{DAV:}sharee' => 'Sabre\\DAV\\Xml\\Element\\Sharee'
95  ]);
96 
97  }
98 }
This class represents the {DAV:}sharee element.
Definition: Sharee.php:21
$result
parse($xml, array $elementMap=[])
Definition: XmlTest.php:26
comment()
Definition: comment.php:2