X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=dav%2FSabreDAV%2Ftests%2FSabre%2FCalDAV%2FPluginTest.php;fp=dav%2FSabreDAV%2Ftests%2FSabre%2FCalDAV%2FPluginTest.php;h=cac4049f2204c6b5317157efbf3653ac1a070813;hb=fefee23e903a4d82944dcaf75b8953c5181a6ebf;hp=eb097c9e8cfd70843c1628463dfc652c76bcbfbe;hpb=4a5e30ec845bcb756543f14c4d8e0b5a3138f2fc;p=friendica-addons.git
diff --git a/dav/SabreDAV/tests/Sabre/CalDAV/PluginTest.php b/dav/SabreDAV/tests/Sabre/CalDAV/PluginTest.php
index eb097c9e..cac4049f 100644
--- a/dav/SabreDAV/tests/Sabre/CalDAV/PluginTest.php
+++ b/dav/SabreDAV/tests/Sabre/CalDAV/PluginTest.php
@@ -23,8 +23,34 @@ class Sabre_CalDAV_PluginTest extends PHPUnit_Framework_TestCase {
function setup() {
- if (!SABRE_HASSQLITE) $this->markTestSkipped('No PDO SQLite support');
- $this->caldavBackend = Sabre_CalDAV_TestUtil::getBackend();
+ $this->caldavBackend = new Sabre_CalDAV_Backend_Mock(array(
+ array(
+ 'id' => 1,
+ 'uri' => 'UUID-123467',
+ 'principaluri' => 'principals/user1',
+ '{DAV:}displayname' => 'user1 calendar',
+ '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar description',
+ '{http://apple.com/ns/ical/}calendar-order' => '1',
+ '{http://apple.com/ns/ical/}calendar-color' => '#FF0000',
+ '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array('VEVENT','VTODO')),
+ ),
+ array(
+ 'id' => 2,
+ 'uri' => 'UUID-123468',
+ 'principaluri' => 'principals/user1',
+ '{DAV:}displayname' => 'user1 calendar2',
+ '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar description',
+ '{http://apple.com/ns/ical/}calendar-order' => '1',
+ '{http://apple.com/ns/ical/}calendar-color' => '#FF0000',
+ '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array('VEVENT','VTODO')),
+ )
+ ), array(
+ 1 => array(
+ 'UUID-2345' => array(
+ 'calendardata' => Sabre_CalDAV_TestUtil::getTestCalendarData(),
+ )
+ )
+ ));
$principalBackend = new Sabre_DAVACL_MockPrincipalBackend();
$principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-read',array('principals/user1'));
$principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-write',array('principals/user1'));
@@ -398,6 +424,7 @@ END:VCALENDAR';
'{urn:ietf:params:xml:ns:caldav}calendar-user-address-set',
'{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}calendar-proxy-read-for',
'{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}calendar-proxy-write-for',
+ '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}notification-URL',
));
$this->assertArrayHasKey(0,$props);
@@ -414,6 +441,12 @@ END:VCALENDAR';
$this->assertTrue($prop instanceof Sabre_DAV_Property_Href);
$this->assertEquals('calendars/user1/outbox',$prop->getHref());
+ $this->assertArrayHasKey('{'.Sabre_CalDAV_Plugin::NS_CALENDARSERVER .'}notification-URL',$props[0][200]);
+ $prop = $props[0][200]['{'.Sabre_CalDAV_Plugin::NS_CALENDARSERVER .'}notification-URL'];
+ $this->assertTrue($prop instanceof Sabre_DAV_Property_Href);
+ $this->assertEquals('calendars/user1/notifications/',$prop->getHref());
+
+
$this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}calendar-user-address-set',$props[0][200]);
$prop = $props[0][200]['{urn:ietf:params:xml:ns:caldav}calendar-user-address-set'];
$this->assertTrue($prop instanceof Sabre_DAV_Property_HrefList);
@@ -429,6 +462,7 @@ END:VCALENDAR';
$this->assertInstanceOf('Sabre_DAV_Property_HrefList', $prop);
$this->assertEquals(array('principals/admin'), $prop->getHrefs());
+
}
function testSupportedReportSetPropertyNonCalendar() {
@@ -755,7 +789,7 @@ END:VCALENDAR';
'' .
' ' .
' ' .
- ' ' .
+ ' ' .
' ' .
'' .
'' .
@@ -991,4 +1025,60 @@ END:VCALENDAR';
$this->assertEquals('HTTP/1.1 400 Bad request',$this->response->status,'Invalid HTTP status received. Full response body: ' . $this->response->body);
}
+
+ function testNotificationProperties() {
+
+ $request = array(
+ '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}notificationtype',
+ );
+ $result = array();
+ $notification = new Sabre_CalDAV_Notifications_Node(
+ $this->caldavBackend,
+ new Sabre_CalDAV_Notifications_Notification_SystemStatus('foo')
+ );
+ $this->plugin->beforeGetProperties('foo', $notification, $request, $result);
+
+ $this->assertEquals(
+ array(
+ 200 => array(
+ '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}notificationtype' => $notification->getNotificationType()
+ )
+ ), $result);
+
+ }
+
+ function testNotificationGet() {
+
+ $notification = new Sabre_CalDAV_Notifications_Node(
+ $this->caldavBackend,
+ new Sabre_CalDAV_Notifications_Notification_SystemStatus('foo')
+ );
+
+ $server = new Sabre_DAV_Server(array($notification));
+ $caldav = new Sabre_CalDAV_Plugin();
+
+ $httpResponse = new Sabre_HTTP_ResponseMock();
+ $server->httpResponse = $httpResponse;
+
+ $server->addPlugin($caldav);
+
+ $caldav->beforeMethod('GET','foo');
+
+ $this->assertEquals('HTTP/1.1 200 OK', $httpResponse->status);
+ $this->assertEquals(array(
+ 'Content-Type' => 'application/xml',
+ ), $httpResponse->headers);
+
+ $expected =
+'
+
+
+
+';
+
+ $this->assertEquals($expected, $httpResponse->body);
+
+
+ }
+
}