]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/tests/Sabre/CalDAV/Notifications/Notification/SystemStatusTest.php
Merge remote branch 'friendica/master'
[friendica-addons.git] / dav / SabreDAV / tests / Sabre / CalDAV / Notifications / Notification / SystemStatusTest.php
1 <?php
2
3 class Sabre_CalDAV_Notifications_Notification extends \PHPUnit_Framework_TestCase {
4
5     /**
6      * @dataProvider dataProvider
7      */
8     function testSerializers($notification, $expected1, $expected2) {
9
10         $this->assertEquals('foo', $notification->getId());
11
12
13         $dom = new DOMDocument('1.0','UTF-8');
14         $elem = $dom->createElement('cs:root');
15         $elem->setAttribute('xmlns:cs',Sabre_CalDAV_Plugin::NS_CALENDARSERVER);
16         $dom->appendChild($elem);
17         $notification->serialize(new Sabre_DAV_Server(), $elem);
18         $this->assertEquals($expected1, $dom->saveXML());
19
20         $dom = new DOMDocument('1.0','UTF-8');
21         $elem = $dom->createElement('cs:root');
22         $elem->setAttribute('xmlns:cs',Sabre_CalDAV_Plugin::NS_CALENDARSERVER);
23         $dom->appendChild($elem);
24         $notification->serializeBody(new Sabre_DAV_Server(), $elem);
25         $this->assertEquals($expected2, $dom->saveXML());
26
27
28     }
29
30     function dataProvider() {
31
32         return array(
33
34             array(
35                 new Sabre_CalDAV_Notifications_Notification_SystemStatus('foo'),
36                 '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<cs:root xmlns:cs="http://calendarserver.org/ns/"><cs:systemstatus type="high"/></cs:root>' . "\n",
37                 '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<cs:root xmlns:cs="http://calendarserver.org/ns/"><cs:systemstatus type="high"/></cs:root>' . "\n",
38             ),
39
40             array(
41                 new Sabre_CalDAV_Notifications_Notification_SystemStatus('foo',Sabre_CalDAV_Notifications_Notification_SystemStatus::TYPE_MEDIUM,'bar'),
42                 '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<cs:root xmlns:cs="http://calendarserver.org/ns/"><cs:systemstatus type="medium"/></cs:root>' . "\n",
43                 '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<cs:root xmlns:cs="http://calendarserver.org/ns/"><cs:systemstatus type="medium"><cs:description>bar</cs:description></cs:systemstatus></cs:root>' . "\n",
44             ),
45
46             array(
47                 new Sabre_CalDAV_Notifications_Notification_SystemStatus('foo',Sabre_CalDAV_Notifications_Notification_SystemStatus::TYPE_LOW,null,'http://example.org/'),
48                 '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<cs:root xmlns:cs="http://calendarserver.org/ns/"><cs:systemstatus type="low"/></cs:root>' . "\n",
49                 '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<cs:root xmlns:cs="http://calendarserver.org/ns/"><cs:systemstatus type="low"><d:href>http://example.org/</d:href></cs:systemstatus></cs:root>' . "\n",
50             )
51         );
52
53     }
54
55 }