[Pkg-owncloud-commits] [php-sabre-vobject] 01/10: Add `RECURRENCE-ID` to the first event in the series.

David Prévot taffit at moszumanska.debian.org
Thu Apr 7 01:41:24 UTC 2016


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

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

commit 3919e59406861fc54009ad07b1b7ee3cc01d788a
Author: Evert Pot <me at evertpot.com>
Date:   Tue Mar 29 21:09:28 2016 -0400

    Add `RECURRENCE-ID` to the first event in the series.
    
    Fixes #309
---
 ChangeLog.md                                                |  9 ++++++++-
 lib/Recur/EventIterator.php                                 | 13 +++----------
 lib/Version.php                                             |  2 +-
 tests/VObject/Component/VCalendarTest.php                   |  1 +
 .../VObject/Recur/EventIterator/ExpandFloatingTimesTest.php |  7 +++++--
 tests/VObject/Recur/EventIterator/IncorrectExpandTest.php   |  6 ++++--
 tests/VObject/Recur/EventIterator/MissingOverriddenTest.php |  6 ++++--
 7 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index a902913..07696ab 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,8 +1,15 @@
 ChangeLog
 =========
 
+3.5.1 (????-??-??)
+------------------
+
+* #306: When expanding recurring events, the first event should also have a
+  `RECURRENCE-ID` property.
+
+
 3.5.0 (2016-01-11)
------------------
+------------------
 
 * This release supports PHP 7, contrary to 3.4.x versions.
 * BC Break: `Sabre\VObject\Property\Float` has been renamed to
diff --git a/lib/Recur/EventIterator.php b/lib/Recur/EventIterator.php
index 64f5101..7b1c19d 100644
--- a/lib/Recur/EventIterator.php
+++ b/lib/Recur/EventIterator.php
@@ -278,16 +278,9 @@ class EventIterator implements \Iterator {
         if (isset($event->DTEND)) {
             $event->DTEND->setDateTime($this->getDtEnd(), $event->DTEND->isFloating());
         }
-        // Including a RECURRENCE-ID to the object, unless this is the first
-        // object.
-        //
-        // The inner recurIterator is always one step ahead, this is why we're
-        // checking for the key being higher than 1.
-        if ($this->recurIterator->key() > 1) {
-            $recurid = clone $event->DTSTART;
-            $recurid->name = 'RECURRENCE-ID';
-            $event->add($recurid);
-        }
+        $recurid = clone $event->DTSTART;
+        $recurid->name = 'RECURRENCE-ID';
+        $event->add($recurid);
         return $event;
 
     }
diff --git a/lib/Version.php b/lib/Version.php
index 9ff8f74..3b14056 100644
--- a/lib/Version.php
+++ b/lib/Version.php
@@ -14,6 +14,6 @@ class Version {
     /**
      * Full version number
      */
-    const VERSION = '3.5.0';
+    const VERSION = '3.5.1';
 
 }
diff --git a/tests/VObject/Component/VCalendarTest.php b/tests/VObject/Component/VCalendarTest.php
index 9c9db42..f3ecfc2 100644
--- a/tests/VObject/Component/VCalendarTest.php
+++ b/tests/VObject/Component/VCalendarTest.php
@@ -257,6 +257,7 @@ END:VEVENT
 BEGIN:VEVENT
 UID:bla3
 DTSTART;VALUE=DATE:20141112
+RECURRENCE-ID;VALUE=DATE:20141112
 END:VEVENT
 BEGIN:VEVENT
 UID:bla3
diff --git a/tests/VObject/Recur/EventIterator/ExpandFloatingTimesTest.php b/tests/VObject/Recur/EventIterator/ExpandFloatingTimesTest.php
index 05c4fcd..63c91ba 100644
--- a/tests/VObject/Recur/EventIterator/ExpandFloatingTimesTest.php
+++ b/tests/VObject/Recur/EventIterator/ExpandFloatingTimesTest.php
@@ -1,10 +1,11 @@
 <?php
 
-namespace Sabre\VObject;
+namespace Sabre\VObject\Recur\EventIterator;
 
 use
     DateTime,
-    DateTimeZone;
+    DateTimeZone,
+    Sabre\VObject\Reader;
 
 class ExpandFloatingTimesTest extends \PHPUnit_Framework_TestCase {
 
@@ -36,6 +37,7 @@ BEGIN:VEVENT
 UID:foo
 DTSTART:20150109T090000Z
 DTEND:20150109T100000Z
+RECURRENCE-ID:20150109T090000Z
 END:VEVENT
 BEGIN:VEVENT
 UID:foo
@@ -90,6 +92,7 @@ BEGIN:VEVENT
 UID:foo
 DTSTART:20150109T080000Z
 DTEND:20150109T090000Z
+RECURRENCE-ID:20150109T080000Z
 END:VEVENT
 BEGIN:VEVENT
 UID:foo
diff --git a/tests/VObject/Recur/EventIterator/IncorrectExpandTest.php b/tests/VObject/Recur/EventIterator/IncorrectExpandTest.php
index d6c93d0..6622dbd 100644
--- a/tests/VObject/Recur/EventIterator/IncorrectExpandTest.php
+++ b/tests/VObject/Recur/EventIterator/IncorrectExpandTest.php
@@ -1,10 +1,11 @@
 <?php
 
-namespace Sabre\VObject;
+namespace Sabre\VObject\Recur\EventIterator;
 
 use
     DateTime,
-    DateTimeZone;
+    DateTimeZone,
+    Sabre\VObject\Reader;
 
 /**
  * This is a unittest for Issue #53.
@@ -45,6 +46,7 @@ BEGIN:VEVENT
 UID:foo
 DTSTART:20130711T050000Z
 DTEND:20130711T053000Z
+RECURRENCE-ID:20130711T050000Z
 END:VEVENT
 BEGIN:VEVENT
 UID:foo
diff --git a/tests/VObject/Recur/EventIterator/MissingOverriddenTest.php b/tests/VObject/Recur/EventIterator/MissingOverriddenTest.php
index 1de517b..2ab4eff 100644
--- a/tests/VObject/Recur/EventIterator/MissingOverriddenTest.php
+++ b/tests/VObject/Recur/EventIterator/MissingOverriddenTest.php
@@ -1,10 +1,11 @@
 <?php
 
-namespace Sabre\VObject;
+namespace Sabre\VObject\Recur\EventIterator;
 
 use
     DateTime,
-    DateTimeZone;
+    DateTimeZone,
+    Sabre\VObject\Reader;
 
 class RecurrenceIteratorMissingOverriddenTest extends \PHPUnit_Framework_TestCase {
 
@@ -45,6 +46,7 @@ UID:foo
 DTSTART:20130727T120000Z
 DURATION:PT1H
 SUMMARY:A
+RECURRENCE-ID:20130727T120000Z
 END:VEVENT
 BEGIN:VEVENT
 RECURRENCE-ID:20130728T120000Z

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



More information about the Pkg-owncloud-commits mailing list