3 class Sabre_CalDAV_Notifications_Notification extends \PHPUnit_Framework_TestCase {
6 * @dataProvider dataProvider
8 function testSerializers($notification, $expected1, $expected2) {
10 $this->assertEquals('foo', $notification->getId());
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());
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());
30 function dataProvider() {
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",
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",
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",