[Pkg-owncloud-commits] [php-sabre-vobject] 42/106: ITip broker can now handle deletes.

David Prévot taffit at moszumanska.debian.org
Fri Aug 22 15:11:00 UTC 2014


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 9f96d16ae9fc5044c127fa6dfce628e94718682b
Author: Evert Pot <me at evertpot.com>
Date:   Tue Jul 29 17:18:05 2014 -0400

    ITip broker can now handle deletes.
    
    100% unittest coverage achieved.
---
 lib/Sabre/VObject/ITip/Broker.php                  |  87 ++++++---
 lib/Sabre/VObject/ITip/ITipException.php           |  15 ++
 .../Sabre/VObject/ITip/BrokerAttendeeReplyTest.php |  34 ++++
 ...dateEventTest.php => BrokerDeleteEventTest.php} | 120 +++++-------
 tests/Sabre/VObject/ITip/BrokerNewEventTest.php    | 206 +++++++++++++++++++++
 tests/Sabre/VObject/ITip/BrokerUpdateEventTest.php |  37 ++++
 6 files changed, 400 insertions(+), 99 deletions(-)

diff --git a/lib/Sabre/VObject/ITip/Broker.php b/lib/Sabre/VObject/ITip/Broker.php
index b41ec8d..724320a 100644
--- a/lib/Sabre/VObject/ITip/Broker.php
+++ b/lib/Sabre/VObject/ITip/Broker.php
@@ -129,27 +129,28 @@ class Broker {
      * differences between events, and potentially send old attendees
      * cancellations, and current attendees updates.
      *
+     * If $calendar is null, but $oldCalendar is specified, we treat the
+     * operation as if the user has deleted an event. If the user was an
+     * organizer, this means that we need to send cancellation notices to
+     * people. If the user was an attendee, we need to make sure that the
+     * organizer gets the 'declined' message.
+     *
      * @param VCalendar|string $calendar
      * @param string|array $userHref
      * @param VCalendar|string $oldCalendar
      * @return array
      */
-    public function parseEvent($calendar, $userHref, $oldCalendar = null) {
-
-        if (is_string($calendar)) {
-            $calendar = Reader::read($calendar);
-        }
-        if (!isset($calendar->VEVENT)) {
-            // We only support events at the moment
-            return array();
-        }
-
-        $eventInfo = $this->parseEventInfo($calendar);
+    public function parseEvent($calendar = null, $userHref, $oldCalendar = null) {
 
         if ($oldCalendar) {
             if (is_string($oldCalendar)) {
                 $oldCalendar = Reader::read($oldCalendar);
             }
+            if (!isset($oldCalendar->VEVENT)) {
+                // We only support events at the moment
+                return array();
+            }
+
             $oldEventInfo = $this->parseEventInfo($oldCalendar);
         } else {
             $oldEventInfo = array(
@@ -157,23 +158,64 @@ class Broker {
             );
         }
 
-        // Events that don't have an organizer or attendees don't generate
-        // messages.
-        if (!$eventInfo['attendees'] && $oldEventInfo['attendees']) {
-            return array();
+        $userHref = (array)$userHref;
+
+        if (!is_null($calendar)) {
+
+            if (is_string($calendar)) {
+                $calendar = Reader::read($calendar);
+            }
+            if (!isset($calendar->VEVENT)) {
+                // We only support events at the moment
+                return array();
+            }
+            $eventInfo = $this->parseEventInfo($calendar);
+            if (!$eventInfo['attendees'] && !$oldEventInfo['attendees']) {
+                // If there were no attendees on either side of the equation,
+                // we don't need to do anything.
+                return array();
+            }
+
+            $organizer = (string)$calendar->VEVENT->ORGANIZER;
+            $baseCalendar = $calendar;
+
+        } else {
+            // The calendar object got deleted, we need to process this as a
+            // cancellation / decline.
+            if (!$oldCalendar) {
+                // No old and no new calendar, there's no thing to do.
+                return array();
+            }
+
+
+            $organizer = (string)$oldCalendar->VEVENT->ORGANIZER;
+            $eventInfo = $oldEventInfo;
+            $eventInfo['sequence']++;
+
+            if (in_array($organizer, $userHref)) {
+                // This is an organizer deleting the event.
+                $eventInfo['attendees'] = [];
+            } else {
+                // This is an attendee deleting the event.
+                foreach($eventInfo['attendees'] as $key=>$attendee) {
+                    if (in_array($attendee['href'], $userHref)) {
+                        $eventInfo['attendees'][$key]['instances'] = array('master' => array('id'=>'master', 'partstat' => 'DECLINED'));
+                    }
+                }
+            }
+            $baseCalendar = $oldCalendar;
+
         }
 
-        $userHref = (array)$userHref;
-        $organizer = (string)$calendar->VEVENT->ORGANIZER;
         if (in_array($organizer, $userHref)) {
-            return $this->parseEventForOrganizer($calendar, $eventInfo, $oldEventInfo);
+            return $this->parseEventForOrganizer($baseCalendar, $eventInfo, $oldEventInfo);
         } elseif ($oldCalendar) {
             // We need to figure out if the user is an attendee, but we're only
             // doing so if there's an oldCalendar, because we only want to
             // process updates, not creation of new events.
             foreach($eventInfo['attendees'] as $attendee) {
                 if (in_array($attendee['href'], $userHref)) {
-                    return $this->parseEventForAttendee($calendar, $eventInfo, $oldEventInfo, $attendee['href']);
+                    return $this->parseEventForAttendee($baseCalendar, $eventInfo, $oldEventInfo, $attendee['href']);
                 }
             }
         }
@@ -367,11 +409,6 @@ class Broker {
      */
     protected function parseEventForOrganizer(VCalendar $calendar, array $eventInfo, array $oldEventInfo) {
 
-        // Shortcut for noop
-        if (!$oldEventInfo['attendees'] && !$eventInfo['attendees']) {
-            return array();
-        }
-
         // Merging attendee lists.
         $attendees = array();
         foreach($oldEventInfo['attendees'] as $attendee) {
@@ -591,7 +628,7 @@ class Broker {
      * @param VCalendar $calendar
      * @return void
      */
-    protected function parseEventInfo(VCalendar $calendar) {
+    protected function parseEventInfo(VCalendar $calendar = null) {
 
         $uid = null;
         $organizer = null;
diff --git a/lib/Sabre/VObject/ITip/ITipException.php b/lib/Sabre/VObject/ITip/ITipException.php
new file mode 100644
index 0000000..2efe563
--- /dev/null
+++ b/lib/Sabre/VObject/ITip/ITipException.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Sabre\VObject\ITip;
+
+use Exception;
+
+/**
+ * This message is emitted in case of serious problems with iTip messages.
+ *
+ * @copyright Copyright (C) 2007-2014 fruux GmbH. All rights reserved.
+ * @author Evert Pot (http://evertpot.com/)
+ * @license http://sabre.io/license/ Modified BSD License
+ */
+class ITipException extends Exception {
+}
diff --git a/tests/Sabre/VObject/ITip/BrokerAttendeeReplyTest.php b/tests/Sabre/VObject/ITip/BrokerAttendeeReplyTest.php
index caa2c83..b2c95f7 100644
--- a/tests/Sabre/VObject/ITip/BrokerAttendeeReplyTest.php
+++ b/tests/Sabre/VObject/ITip/BrokerAttendeeReplyTest.php
@@ -234,6 +234,40 @@ ICS;
 
     }
 
+    function testNoRelevantAttendee() {
+
+        $oldMessage = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:foobar
+SEQUENCE:1
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=Two:mailto:two at example.org
+DTSTART:20140716T120000Z
+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=Two:mailto:two at example.org
+DTSTART:20140716T120000Z
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $expected = array();
+        $result = $this->parse($oldMessage, $newMessage, $expected);
+
+    }
+
     function parse($oldMessage, $newMessage, $expected = array()) {
 
         $broker = new Broker();
diff --git a/tests/Sabre/VObject/ITip/BrokerUpdateEventTest.php b/tests/Sabre/VObject/ITip/BrokerDeleteEventTest.php
similarity index 64%
copy from tests/Sabre/VObject/ITip/BrokerUpdateEventTest.php
copy to tests/Sabre/VObject/ITip/BrokerDeleteEventTest.php
index 2c76212..b5b9e75 100644
--- a/tests/Sabre/VObject/ITip/BrokerUpdateEventTest.php
+++ b/tests/Sabre/VObject/ITip/BrokerDeleteEventTest.php
@@ -2,9 +2,9 @@
 
 namespace Sabre\VObject\ITip;
 
-class BrokerUpdateTest extends \PHPUnit_Framework_TestCase {
+class BrokerDeleteEventTest extends \PHPUnit_Framework_TestCase {
 
-    function testInviteChange() {
+    function testOrganizerDelete() {
 
         $oldMessage = <<<ICS
 BEGIN:VCALENDAR
@@ -21,19 +21,7 @@ END:VCALENDAR
 ICS;
 
 
-        $newMessage = <<<ICS
-BEGIN:VCALENDAR
-VERSION:2.0
-BEGIN:VEVENT
-UID:foobar
-SEQUENCE:2
-ORGANIZER;CN=Strunk:mailto:strunk at example.org
-ATTENDEE;CN=Two:mailto:two at example.org
-ATTENDEE;CN=Three:mailto:three at example.org
-DTSTART:20140716T120000Z
-END:VEVENT
-END:VCALENDAR
-ICS;
+        $newMessage = null;
 
         $version = \Sabre\VObject\Version::VERSION;
 
@@ -60,11 +48,11 @@ ORGANIZER;CN=Strunk:mailto:strunk at example.org
 END:VEVENT
 END:VCALENDAR
 ICS
-
             ),
+
             array(
                 'uid' => 'foobar',
-                'method' => 'REQUEST',
+                'method' => 'CANCEL',
                 'component' => 'VEVENT',
                 'sender' => 'mailto:strunk at example.org',
                 'senderName' => 'Strunk',
@@ -75,40 +63,12 @@ BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//Sabre//Sabre VObject $version//EN
 CALSCALE:GREGORIAN
-METHOD:REQUEST
+METHOD:CANCEL
 BEGIN:VEVENT
-UID:foobar
 SEQUENCE:2
-ORGANIZER;CN=Strunk:mailto:strunk at example.org
-ATTENDEE;CN=Two:mailto:two at example.org
-ATTENDEE;CN=Three:mailto:three at example.org
-DTSTART:20140716T120000Z
-END:VEVENT
-END:VCALENDAR
-ICS
-
-            ),
-            array(
-                'uid' => 'foobar',
-                'method' => 'REQUEST',
-                'component' => 'VEVENT',
-                'sender' => 'mailto:strunk at example.org',
-                'senderName' => 'Strunk',
-                'recipient' => 'mailto:three at example.org',
-                'recipientName' => 'Three',
-                'message' => <<<ICS
-BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//Sabre//Sabre VObject $version//EN
-CALSCALE:GREGORIAN
-METHOD:REQUEST
-BEGIN:VEVENT
 UID:foobar
-SEQUENCE:2
-ORGANIZER;CN=Strunk:mailto:strunk at example.org
 ATTENDEE;CN=Two:mailto:two at example.org
-ATTENDEE;CN=Three:mailto:three at example.org
-DTSTART:20140716T120000Z
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
 END:VEVENT
 END:VCALENDAR
 ICS
@@ -116,11 +76,11 @@ ICS
             ),
         );
 
-        $result = $this->parse($oldMessage, $newMessage, $expected);
+        $result = $this->parse($oldMessage, $newMessage, $expected, 'mailto:strunk at example.org');
 
     }
 
-    function testInviteChangeFromNonSchedulingToSchedulingObject() {
+    function testAttendeeDelete() {
 
         $oldMessage = <<<ICS
 BEGIN:VCALENDAR
@@ -128,63 +88,75 @@ VERSION:2.0
 BEGIN:VEVENT
 UID:foobar
 SEQUENCE:1
-DTSTART:20140716T120000Z
-END:VEVENT
-END:VCALENDAR
-ICS;
-
-
-        $newMessage = <<<ICS
-BEGIN:VCALENDAR
-VERSION:2.0
-BEGIN:VEVENT
-UID:foobar
-SEQUENCE:2
 ORGANIZER;CN=Strunk:mailto:strunk at example.org
 ATTENDEE;CN=One:mailto:one at example.org
+ATTENDEE;CN=Two:mailto:two at example.org
 DTSTART:20140716T120000Z
 END:VEVENT
 END:VCALENDAR
 ICS;
 
+
+        $newMessage = null;
+
         $version = \Sabre\VObject\Version::VERSION;
 
         $expected = array(
             array(
                 'uid' => 'foobar',
-                'method' => 'REQUEST',
+                'method' => 'REPLY',
                 'component' => 'VEVENT',
-                'sender' => 'mailto:strunk at example.org',
-                'senderName' => 'Strunk',
-                'recipient' => 'mailto:one at example.org',
-                'recipientName' => 'One',
+                'sender' => 'mailto:one at example.org',
+                'senderName' => 'One',
+                'recipient' => 'mailto:strunk at example.org',
+                'recipientName' => 'Strunk',
                 'message' => <<<ICS
 BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//Sabre//Sabre VObject $version//EN
 CALSCALE:GREGORIAN
-METHOD:REQUEST
+METHOD:REPLY
 BEGIN:VEVENT
 UID:foobar
 SEQUENCE:2
 ORGANIZER;CN=Strunk:mailto:strunk at example.org
-ATTENDEE;CN=One:mailto:one at example.org
-DTSTART:20140716T120000Z
+ATTENDEE;PARTSTAT=DECLINED;CN=One:mailto:one at example.org
 END:VEVENT
 END:VCALENDAR
 ICS
-
             ),
-
         );
 
-        $result = $this->parse($oldMessage, $newMessage, $expected);
+        $result = $this->parse($oldMessage, $newMessage, $expected, 'mailto:one at example.org');
+
+
+    }
+
+    function testNoCalendar() {
+
+        $this->parse(null, null, array(), 'mailto:one at example.org');
 
     }
-    function parse($oldMessage, $newMessage, $expected = array()) {
+
+    function testVTodo() {
+
+        $oldMessage = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VTODO
+UID:foobar
+SEQUENCE:1
+END:VTODO
+END:VCALENDAR
+ICS;
+        $this->parse($oldMessage, null, array(), 'mailto:one at example.org');
+
+    }
+
+    function parse($oldMessage, $newMessage, $expected = array(), $currentUser) {
 
         $broker = new Broker();
-        $result = $broker->parseEvent($newMessage, 'mailto:strunk at example.org', $oldMessage);
+        $result = $broker->parseEvent($newMessage, $currentUser, $oldMessage);
 
         $this->assertEquals(count($expected), count($result));
 
diff --git a/tests/Sabre/VObject/ITip/BrokerNewEventTest.php b/tests/Sabre/VObject/ITip/BrokerNewEventTest.php
index 577b402..57bff9c 100644
--- a/tests/Sabre/VObject/ITip/BrokerNewEventTest.php
+++ b/tests/Sabre/VObject/ITip/BrokerNewEventTest.php
@@ -77,6 +77,57 @@ ICS;
 
     }
 
+    /**
+     * @expectedException \Sabre\VObject\ITip\ITipException
+     */
+    function testBrokenEventUIDMisMatch() {
+
+        $message = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:foobar
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=White:mailto:white at example.org
+END:VEVENT
+BEGIN:VEVENT
+UID:foobar2
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=White:mailto:white at example.org
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $expected = array();
+        $this->parse($message, array());
+
+    }
+    /**
+     * @expectedException \Sabre\VObject\ITip\ITipException
+     */
+    function testBrokenEventOrganizerMisMatch() {
+
+        $message = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:foobar
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=White:mailto:white at example.org
+END:VEVENT
+BEGIN:VEVENT
+UID:foobar
+ORGANIZER:mailto:foo at example.org
+ATTENDEE;CN=White:mailto:white at example.org
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $expected = array();
+        $this->parse($message, array());
+
+    }
+
     function testRecurrenceInvite() {
 
         $message = <<<ICS
@@ -199,6 +250,161 @@ ICS
 
     }
 
+    function testRecurrenceInvite2() {
+
+        // This method tests a nearly identical path, but in this case the 
+        // master event does not have an EXDATE.
+        $message = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:foobar
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=One:mailto:one at example.org
+ATTENDEE;CN=Two:mailto:two at example.org
+DTSTART:20140716T120000Z
+RRULE:FREQ=DAILY
+END:VEVENT
+BEGIN:VEVENT
+UID:foobar
+RECURRENCE-ID:20140718T120000Z
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=Two:mailto:two at example.org
+ATTENDEE;CN=Three:mailto:three at example.org
+DTSTART:20140718T120000Z
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $version = \Sabre\VObject\Version::VERSION;
+
+        $expected = array(
+            array(
+                'uid' => 'foobar',
+                'method' => 'REQUEST',
+                'component' => 'VEVENT',
+                'sender' => 'mailto:strunk at example.org',
+                'senderName' => 'Strunk',
+                'recipient' => 'mailto:one at example.org',
+                'recipientName' => 'One',
+                'message' => <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Sabre//Sabre VObject $version//EN
+CALSCALE:GREGORIAN
+METHOD:REQUEST
+BEGIN:VEVENT
+UID:foobar
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=One:mailto:one at example.org
+ATTENDEE;CN=Two:mailto:two at example.org
+DTSTART:20140716T120000Z
+RRULE:FREQ=DAILY
+EXDATE:20140718T120000Z
+END:VEVENT
+END:VCALENDAR
+ICS
+
+            ),
+            array(
+                'uid' => 'foobar',
+                'method' => 'REQUEST',
+                'component' => 'VEVENT',
+                'sender' => 'mailto:strunk at example.org',
+                'senderName' => 'Strunk',
+                'recipient' => 'mailto:two at example.org',
+                'recipientName' => 'Two',
+                'message' => <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Sabre//Sabre VObject $version//EN
+CALSCALE:GREGORIAN
+METHOD:REQUEST
+BEGIN:VEVENT
+UID:foobar
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=One:mailto:one at example.org
+ATTENDEE;CN=Two:mailto:two at example.org
+DTSTART:20140716T120000Z
+RRULE:FREQ=DAILY
+END:VEVENT
+BEGIN:VEVENT
+UID:foobar
+RECURRENCE-ID:20140718T120000Z
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=Two:mailto:two at example.org
+ATTENDEE;CN=Three:mailto:three at example.org
+DTSTART:20140718T120000Z
+END:VEVENT
+END:VCALENDAR
+ICS
+
+            ),
+            array(
+                'uid' => 'foobar',
+                'method' => 'REQUEST',
+                'component' => 'VEVENT',
+                'sender' => 'mailto:strunk at example.org',
+                'senderName' => 'Strunk',
+                'recipient' => 'mailto:three at example.org',
+                'recipientName' => 'Three',
+                'message' => <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Sabre//Sabre VObject $version//EN
+CALSCALE:GREGORIAN
+METHOD:REQUEST
+BEGIN:VEVENT
+UID:foobar
+RECURRENCE-ID:20140718T120000Z
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=Two:mailto:two at example.org
+ATTENDEE;CN=Three:mailto:three at example.org
+DTSTART:20140718T120000Z
+END:VEVENT
+END:VCALENDAR
+ICS
+
+            ),
+        );
+
+        $result = $this->parse($message, $expected);
+
+    }
+
+    function testScheduleAgentClient() {
+
+        $message = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:foobar
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=White;SCHEDULE-AGENT=CLIENT:mailto:white at example.org
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $version = \Sabre\VObject\Version::VERSION;
+        $expectedMessage = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Sabre//Sabre VObject $version//EN
+CALSCALE:GREGORIAN
+METHOD:REQUEST
+BEGIN:VEVENT
+UID:foobar
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=White;SCHEDULE-AGENT=CLIENT:mailto:white at example.org
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $expected = array();
+        $result = $this->parse($message, $expected);
+
+    }
+
     function parse($message, $expected = array()) {
 
         $broker = new Broker();
diff --git a/tests/Sabre/VObject/ITip/BrokerUpdateEventTest.php b/tests/Sabre/VObject/ITip/BrokerUpdateEventTest.php
index 2c76212..c45e82e 100644
--- a/tests/Sabre/VObject/ITip/BrokerUpdateEventTest.php
+++ b/tests/Sabre/VObject/ITip/BrokerUpdateEventTest.php
@@ -13,6 +13,7 @@ BEGIN:VEVENT
 UID:foobar
 SEQUENCE:1
 ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=Strunk:mailto:strunk at example.org
 ATTENDEE;CN=One:mailto:one at example.org
 ATTENDEE;CN=Two:mailto:two at example.org
 DTSTART:20140716T120000Z
@@ -28,6 +29,7 @@ BEGIN:VEVENT
 UID:foobar
 SEQUENCE:2
 ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=Strunk:mailto:strunk at example.org
 ATTENDEE;CN=Two:mailto:two at example.org
 ATTENDEE;CN=Three:mailto:three at example.org
 DTSTART:20140716T120000Z
@@ -80,6 +82,7 @@ BEGIN:VEVENT
 UID:foobar
 SEQUENCE:2
 ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=Strunk:mailto:strunk at example.org
 ATTENDEE;CN=Two:mailto:two at example.org
 ATTENDEE;CN=Three:mailto:three at example.org
 DTSTART:20140716T120000Z
@@ -106,6 +109,7 @@ BEGIN:VEVENT
 UID:foobar
 SEQUENCE:2
 ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=Strunk:mailto:strunk at example.org
 ATTENDEE;CN=Two:mailto:two at example.org
 ATTENDEE;CN=Three:mailto:three at example.org
 DTSTART:20140716T120000Z
@@ -181,6 +185,39 @@ ICS
         $result = $this->parse($oldMessage, $newMessage, $expected);
 
     }
+
+    function testNoAttendees() {
+
+        $oldMessage = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:foobar
+SEQUENCE:1
+DTSTART:20140716T120000Z
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+
+        $newMessage = <<<ICS
+BEGIN:VCALENDAR
+VERSION:2.0
+BEGIN:VEVENT
+UID:foobar
+SEQUENCE:2
+DTSTART:20140716T120000Z
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $version = \Sabre\VObject\Version::VERSION;
+
+        $expected = array();
+        $result = $this->parse($oldMessage, $newMessage, $expected);
+
+    }
+
     function parse($oldMessage, $newMessage, $expected = array()) {
 
         $broker = new Broker();

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