[Pkg-owncloud-commits] [php-sabre-vobject] 13/106: Support for upgrading from non-scheduling to scheduling object.

David Prévot taffit at moszumanska.debian.org
Fri Aug 22 15:10:55 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 f345702ee5e13c85924f820e25dc25565e9bbc15
Author: Evert Pot <me at evertpot.com>
Date:   Fri Jul 18 19:22:47 2014 -0400

    Support for upgrading from non-scheduling to scheduling object.
---
 lib/Sabre/VObject/ITip/Broker.php                  | 15 +++---
 tests/Sabre/VObject/ITip/BrokerUpdateEventTest.php | 61 ++++++++++++++++++++++
 2 files changed, 70 insertions(+), 6 deletions(-)

diff --git a/lib/Sabre/VObject/ITip/Broker.php b/lib/Sabre/VObject/ITip/Broker.php
index 2a61780..c4f4d85 100644
--- a/lib/Sabre/VObject/ITip/Broker.php
+++ b/lib/Sabre/VObject/ITip/Broker.php
@@ -394,6 +394,7 @@ class Broker {
 
         $uid = null;
         $organizer = null;
+        $organizerName = null;
         $sequence = null;
 
         // Now we need to collect a list of attendees, and which instances they
@@ -410,12 +411,14 @@ class Broker {
                     throw new ITipException('If a calendar contained more than one event, they must have the same UID.');
                 }
             }
-            if (is_null($organizer) && isset($vevent->ORGANIZER)) {
-                $organizer = $vevent->ORGANIZER->getValue();
-                $organizerName = isset($vevent->ORGANIZER['CN'])?$vevent->ORGANIZER['CN']:null;
-            } else {
-                if ($organizer !== $vevent->ORGANIZER->getValue()) {
-                    throw new ITipException('Every instance of the event must have the same organizer.');
+            if (isset($vevent->ORGANIZER)) {
+                if (is_null($organizer)) {
+                    $organizer = $vevent->ORGANIZER->getValue();
+                    $organizerName = isset($vevent->ORGANIZER['CN'])?$vevent->ORGANIZER['CN']:null;
+                } else {
+                    if ($organizer !== $vevent->ORGANIZER->getValue()) {
+                        throw new ITipException('Every instance of the event must have the same organizer.');
+                    }
                 }
             }
             if (is_null($sequence) && isset($vevent->SEQUENCE)) {
diff --git a/tests/Sabre/VObject/ITip/BrokerUpdateEventTest.php b/tests/Sabre/VObject/ITip/BrokerUpdateEventTest.php
index fb3673d..67c5b8e 100644
--- a/tests/Sabre/VObject/ITip/BrokerUpdateEventTest.php
+++ b/tests/Sabre/VObject/ITip/BrokerUpdateEventTest.php
@@ -120,6 +120,67 @@ ICS
 
     }
 
+    function testInviteChangeFromNonSchedulingToSchedulingObject() {
+
+        $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
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=One:mailto:one at example.org
+DTSTART:20140716T120000Z
+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
+SEQUENCE:2
+ORGANIZER;CN=Strunk:mailto:strunk at example.org
+ATTENDEE;CN=One:mailto:one at example.org
+DTSTART:20140716T120000Z
+END:VEVENT
+END:VCALENDAR
+ICS
+
+            ),
+
+        );
+
+        $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