ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ScheduleCalendarTranspTest.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use Sabre\CalDAV;
6 use Sabre\DAV;
7 
9 
10  function setUp() {
11 
12  $this->namespaceMap[CalDAV\Plugin::NS_CALDAV] = 'cal';
13  $this->namespaceMap[CalDAV\Plugin::NS_CALENDARSERVER] = 'cs';
14 
15 
16  }
17 
18  function testSimple() {
19 
21  $this->assertEquals(
23  $prop->getValue()
24  );
25 
26  }
27 
31  function testBadValue() {
32 
33  new ScheduleCalendarTransp('ahhh');
34 
35  }
36 
40  function testSerializeOpaque() {
41 
43  $xml = $this->write(['{DAV:}root' => $property]);
44 
45  $this->assertXmlStringEqualsXmlString(
46 '<?xml version="1.0"?>
47 <d:root xmlns:d="DAV:" xmlns:cal="' . CalDAV\Plugin::NS_CALDAV . '" xmlns:cs="' . CalDAV\Plugin::NS_CALENDARSERVER . '">
48  <cal:opaque />
49 </d:root>
50 ', $xml);
51 
52  }
53 
58 
60  $xml = $this->write(['{DAV:}root' => $property]);
61 
62  $this->assertXmlStringEqualsXmlString(
63 '<?xml version="1.0"?>
64 <d:root xmlns:d="DAV:" xmlns:cal="' . CalDAV\Plugin::NS_CALDAV . '" xmlns:cs="' . CalDAV\Plugin::NS_CALENDARSERVER . '">
65  <cal:transparent />
66 </d:root>
67 ', $xml);
68 
69  }
70 
72 
75 
76 $xml = <<<XML
77 <?xml version="1.0"?>
78 <d:root xmlns:d="DAV:" xmlns:cal="$cal" xmlns:cs="$cs">
79  <cal:transparent />
80 </d:root>
81 XML;
82 
83  $result = $this->parse(
84  $xml,
85  ['{DAV:}root' => 'Sabre\\CalDAV\\Xml\\Property\\ScheduleCalendarTransp']
86  );
87 
88  $this->assertEquals(
90  $result['value']
91  );
92 
93  }
94 
95  function testUnserializeOpaque() {
96 
99 
100 $xml = <<<XML
101 <?xml version="1.0"?>
102 <d:root xmlns:d="DAV:" xmlns:cal="$cal" xmlns:cs="$cs">
103  <cal:opaque />
104 </d:root>
105 XML;
106 
107  $result = $this->parse(
108  $xml,
109  ['{DAV:}root' => 'Sabre\\CalDAV\\Xml\\Property\\ScheduleCalendarTransp']
110  );
111 
112  $this->assertEquals(
114  $result['value']
115  );
116 
117  }
118 }
$result
parse($xml, array $elementMap=[])
Definition: XmlTest.php:26
const NS_CALENDARSERVER
This is the namespace for the proprietary calendarserver extensions.
Definition: Plugin.php:38
const NS_CALDAV
This is the official CalDAV namespace.
Definition: Plugin.php:33