[Pkg-owncloud-commits] [php-sabredav] 124/275: Testing Schedule-Reply.

David Prévot taffit at moszumanska.debian.org
Thu Sep 25 14:55:59 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 0aca3c0131490d35b022f1470b9f3d09856b0614
Author: Evert Pot <me at evertpot.com>
Date:   Thu Jul 31 18:19:53 2014 -0400

    Testing Schedule-Reply.
---
 lib/CalDAV/Schedule/Plugin.php                     |  2 +-
 .../Sabre/CalDAV/Schedule/ScheduleDeliverTest.php  | 66 +++++++++++++++++++++-
 2 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/lib/CalDAV/Schedule/Plugin.php b/lib/CalDAV/Schedule/Plugin.php
index faefd3f..fb938c3 100644
--- a/lib/CalDAV/Schedule/Plugin.php
+++ b/lib/CalDAV/Schedule/Plugin.php
@@ -879,7 +879,7 @@ class Plugin extends ServerPlugin {
     private function scheduleReply(RequestInterface $request) {
 
         $scheduleReply = $request->getHeader('Schedule-Reply');
-        return strpos($scheduleReply, 'F')!=='0';
+        return $scheduleReply!=='F';
 
     }
 
diff --git a/tests/Sabre/CalDAV/Schedule/ScheduleDeliverTest.php b/tests/Sabre/CalDAV/Schedule/ScheduleDeliverTest.php
index 208cb90..49da040 100644
--- a/tests/Sabre/CalDAV/Schedule/ScheduleDeliverTest.php
+++ b/tests/Sabre/CalDAV/Schedule/ScheduleDeliverTest.php
@@ -63,6 +63,22 @@ ICS;
         $this->assertItemsInInbox('user2', 0);
 
     }
+    function testNewInviteSchedulingDisabled() {
+
+        $newObject = <<<ICS
+BEGIN:VCALENDAR
+BEGIN:VEVENT
+UID:foo
+ORGANIZER:mailto:user1.sabredav at sabredav.org
+ATTENDEE:mailto:user2.sabredav at sabredav.org
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $this->deliver(null, $newObject, true);
+        $this->assertItemsInInbox('user2', 0);
+
+    }
     function testUpdatedInvite() {
 
         $newObject = <<<ICS
@@ -87,6 +103,30 @@ ICS;
         $this->assertItemsInInbox('user2', 1);
 
     }
+    function testUpdatedInviteSchedulingDisabled() {
+
+        $newObject = <<<ICS
+BEGIN:VCALENDAR
+BEGIN:VEVENT
+UID:foo
+ORGANIZER:mailto:user1.sabredav at sabredav.org
+ATTENDEE:mailto:user2.sabredav at sabredav.org
+END:VEVENT
+END:VCALENDAR
+ICS;
+        $oldObject = <<<ICS
+BEGIN:VCALENDAR
+BEGIN:VEVENT
+UID:foo
+ORGANIZER:mailto:user1.sabredav at sabredav.org
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $this->deliver($oldObject, $newObject, true);
+        $this->assertItemsInInbox('user2', 0);
+
+    }
 
     function testUpdatedInviteWrongPath() {
 
@@ -132,6 +172,26 @@ ICS;
         $this->assertItemsInInbox('user2', 1);
 
     }
+
+    function testDeletedInviteSchedulingDisabled() {
+
+        $newObject = null;
+
+        $oldObject = <<<ICS
+BEGIN:VCALENDAR
+BEGIN:VEVENT
+UID:foo
+ORGANIZER:mailto:user1.sabredav at sabredav.org
+ATTENDEE:mailto:user2.sabredav at sabredav.org
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $this->deliver($oldObject, $newObject, true);
+        $this->assertItemsInInbox('user2', 0);
+
+    }
+
     function testDeletedInviteWrongUrl() {
 
         $newObject = null;
@@ -154,7 +214,11 @@ ICS;
 
     protected $calendarObjectUri;
 
-    function deliver($oldObject, $newObject) {
+    function deliver($oldObject, $newObject, $disableScheduling = false) {
+
+        if ($disableScheduling) {
+            $this->server->httpRequest->setHeader('Schedule-Reply','F');
+        }
 
         if ($oldObject && $newObject) {
             // update

-- 
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