[Pkg-owncloud-commits] [php-sabre-vobject] 01/06: Replying to an event without master event was broken.

David Prévot taffit at moszumanska.debian.org
Thu Feb 26 02:09:40 UTC 2015


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

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

commit 57b10802c8203c5b2ce3a75848de59d2e75fcda4
Author: Evert Pot <me at evertpot.com>
Date:   Wed Feb 25 12:40:33 2015 -0500

    Replying to an event without master event was broken.
    
    Fixes #210
---
 lib/ITip/Broker.php                            |  2 +-
 tests/VObject/ITip/BrokerAttendeeReplyTest.php | 75 ++++++++++++++++++++++++++
 tests/VObject/ITip/BrokerTester.php            |  8 +--
 3 files changed, 80 insertions(+), 5 deletions(-)

diff --git a/lib/ITip/Broker.php b/lib/ITip/Broker.php
index fb38a50..23ae4d7 100644
--- a/lib/ITip/Broker.php
+++ b/lib/ITip/Broker.php
@@ -671,7 +671,7 @@ class Broker {
         // event, which means we need to send DECLINED specifically for those
         // instances.
         // We only need to do that though, if the master event is not declined.
-        if ($instances['master']['newstatus'] !== 'DECLINED') {
+        if (isset($instances['master']) && $instances['master']['newstatus'] !== 'DECLINED') {
             foreach($eventInfo['exdate'] as $exDate) {
 
                 if (!in_array($exDate, $oldEventInfo['exdate'])) {
diff --git a/tests/VObject/ITip/BrokerAttendeeReplyTest.php b/tests/VObject/ITip/BrokerAttendeeReplyTest.php
index c82ec1d..fd873fe 100644
--- a/tests/VObject/ITip/BrokerAttendeeReplyTest.php
+++ b/tests/VObject/ITip/BrokerAttendeeReplyTest.php
@@ -959,4 +959,79 @@ ICS
 
     }
 
+    /**
+     * This function tests an attendee updating their status to an event where
+     * they don't have the master event of.
+     *
+     * This is possible in cases an organizer created a recurring event, and
+     * invited an attendee for one instance of the event.
+     */
+    function testReplyNoMasterEvent() {
+
+        $oldMessage = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:foobar
+SEQUENCE:1
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=One:mailto:one at example.org
+RECURRENCE-ID:20140724T120000Z
+DTSTART:20140724T120000Z
+SUMMARY:Daily sprint
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+
+        $newMessage = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:foobar
+SEQUENCE:1
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one at example.org
+RECURRENCE-ID:20140724T120000Z
+DTSTART:20140724T120000Z
+SUMMARY:Daily sprint
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $version = \Sabre\VObject\Version::VERSION;
+
+        $expected = array(
+            array(
+                'uid' => 'foobar',
+                'method' => 'REPLY',
+                'component' => 'VEVENT',
+                'sender' => 'mailto:one at example.org',
+                'senderName' => 'One',
+                'recipient' => 'mailto:strunk at example.org',
+                'recipientName' => 'Strunk',
+                'message' => <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+METHOD:REPLY
+BEGIN:VEVENT
+UID:foobar
+SEQUENCE:1
+DTSTART:20140724T120000Z
+SUMMARY:Daily sprint
+RECURRENCE-ID:20140724T120000Z
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;PARTSTAT=ACCEPTED;CN=One:mailto:one at example.org
+END:VEVENT
+END:VCALENDAR
+ICS
+
+            ),
+
+        );
+
+        $result = $this->parse($oldMessage, $newMessage, $expected);
+
+    }
 }
diff --git a/tests/VObject/ITip/BrokerTester.php b/tests/VObject/ITip/BrokerTester.php
index 5049ad0..b9b26cf 100644
--- a/tests/VObject/ITip/BrokerTester.php
+++ b/tests/VObject/ITip/BrokerTester.php
@@ -11,7 +11,7 @@ use Sabre\VObject\Reader;
  * @author Evert Pot (http://evertpot.com/) 
  * @license http://sabre.io/license/ Modified BSD License
  */
-abstract class BrokerTester extends \PHPUnit_Framework_TestCase {
+abstract class BrokerTester extends \Sabre\VObject\TestCase {
 
     function parse($oldMessage, $newMessage, $expected = array(), $currentUser = 'mailto:one at example.org') {
 
@@ -27,9 +27,9 @@ abstract class BrokerTester extends \PHPUnit_Framework_TestCase {
             foreach($ex as $key=>$val) {
 
                 if ($key==='message') {
-                    $this->assertEquals(
-                        str_replace("\n", "\r\n", $val),
-                        rtrim($message->message->serialize(), "\r\n")
+                    $this->assertVObjEquals(
+                        $val,
+                        $message->message->serialize()
                     );
                 } else {
                     $this->assertEquals($val, $message->$key);

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



More information about the Pkg-owncloud-commits mailing list