[Pkg-owncloud-commits] [php-sabredav] 139/275: Tests.

David Prévot taffit at moszumanska.debian.org
Thu Sep 25 14:56:01 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabredav.

commit 3c5c989d18237d5002b1adc08471d70de1c0414e
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Sat Aug 9 15:01:57 2014 -0400

    Tests.
---
 lib/CalDAV/Schedule/Plugin.php              | 14 +++++++-----
 tests/Sabre/CalDAV/Backend/AbstractTest.php | 34 +++++++++++++++++++++++++----
 2 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/lib/CalDAV/Schedule/Plugin.php b/lib/CalDAV/Schedule/Plugin.php
index 8ca40b6..351dfa3 100644
--- a/lib/CalDAV/Schedule/Plugin.php
+++ b/lib/CalDAV/Schedule/Plugin.php
@@ -107,21 +107,23 @@ class Plugin extends ServerPlugin {
         $server->on('beforeUnbind',        [$this, 'beforeUnbind']);
         $server->on('schedule',            [$this, 'scheduleLocalDelivery']);
 
+        $ns = '{' . self::NS_CALDAV . '}';
+
         /**
          * This information ensures that the {DAV:}resourcetype property has
          * the correct values.
          */
-        $server->resourceTypeMapping['\\Sabre\\CalDAV\\Schedule\\IOutbox'] = '{urn:ietf:params:xml:ns:caldav}schedule-outbox';
-        $server->resourceTypeMapping['\\Sabre\\CalDAV\\Schedule\\IInbox'] = '{urn:ietf:params:xml:ns:caldav}schedule-inbox';
+        $server->resourceTypeMapping['\\Sabre\\CalDAV\\Schedule\\IOutbox'] = $ns . 'schedule-outbox';
+        $server->resourceTypeMapping['\\Sabre\\CalDAV\\Schedule\\IInbox'] = $ns . 'schedule-inbox';
 
         /**
          * Properties we protect are made read-only by the server.
          */
         array_push($server->protectedProperties,
-            '{' . self::NS_CALDAV . '}schedule-inbox-URL',
-            '{' . self::NS_CALDAV . '}schedule-outbox-URL',
-            '{' . self::NS_CALDAV . '}calendar-user-address-set',
-            '{' . self::NS_CALDAV . '}calendar-user-type'
+            $ns . 'schedule-inbox-URL',
+            $ns . 'schedule-outbox-URL',
+            $ns . 'calendar-user-address-set',
+            $ns . 'calendar-user-type'
         );
 
     }
diff --git a/tests/Sabre/CalDAV/Backend/AbstractTest.php b/tests/Sabre/CalDAV/Backend/AbstractTest.php
index a2959f5..e71c0e9 100644
--- a/tests/Sabre/CalDAV/Backend/AbstractTest.php
+++ b/tests/Sabre/CalDAV/Backend/AbstractTest.php
@@ -44,14 +44,40 @@ class AbstractTest extends \PHPUnit_Framework_TestCase {
 
     }
 
+    function testGetCalendarObjectByUID() {
+
+        $abstract = new AbstractMock();
+        $this->assertNull(
+            $abstract->getCalendarObjectByUID('principal1', 'zim')
+        );
+        $this->assertEquals(
+            'cal1/event1.ics',
+            $abstract->getCalendarObjectByUID('principal1', 'foo')
+        );
+        $this->assertNull(
+            $abstract->getCalendarObjectByUID('principal22', 'foo')
+        );
+
+    }
+
 }
 
 class AbstractMock extends AbstractBackend {
 
-    function getCalendarsForUser($principalUri) { }
+    function getCalendarsForUser($principalUri) {
+
+        return array(
+            array(
+                'id' => 1,
+                'principaluri' => 'principal1',
+                'uri' => 'cal1',
+            ),
+        );
+
+    }
     function createCalendar($principalUri,$calendarUri,array $properties) { }
     function deleteCalendar($calendarId) { }
-    function getCalendarObjects($calendarId) { 
+    function getCalendarObjects($calendarId) {
 
         return array(
             array(
@@ -67,7 +93,7 @@ class AbstractMock extends AbstractBackend {
         );
 
     }
-    function getCalendarObject($calendarId,$objectUri) { 
+    function getCalendarObject($calendarId,$objectUri) {
 
         switch($objectUri) {
 
@@ -76,7 +102,7 @@ class AbstractMock extends AbstractBackend {
                     'id' => 1,
                     'calendarid' => 1,
                     'uri' => 'event1.ics',
-                    'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n",
+                    'calendardata' => "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n",
                 );
             case 'task1.ics' :
                 return array(

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list