[Pkg-owncloud-commits] [php-sabre-vobject] 57/106: Multiple overridden events now behave correctly.

David Prévot taffit at moszumanska.debian.org
Fri Aug 22 15:11:02 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 bfd42296aa55a4ff8af4b7b4a1b1a7272876481b
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Sun Aug 3 11:36:18 2014 -0400

    Multiple overridden events now behave correctly.
---
 lib/Sabre/VObject/RecurrenceIterator.php            | 7 ++++---
 tests/Sabre/VObject/RecurrenceIterator/MainTest.php | 5 +++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/Sabre/VObject/RecurrenceIterator.php b/lib/Sabre/VObject/RecurrenceIterator.php
index 34f16ae..c191b5b 100644
--- a/lib/Sabre/VObject/RecurrenceIterator.php
+++ b/lib/Sabre/VObject/RecurrenceIterator.php
@@ -273,7 +273,7 @@ class RecurrenceIterator implements \Iterator {
             $stamp = $event->DTSTART->getDateTime()->getTimeStamp();
             $index[$stamp] = $key;
         }
-        ksort($index);
+        krsort($index);
         $this->counter = 0;
         $this->overriddenEventsIndex = $index;
         $this->currentOverriddenEvent = null;
@@ -318,7 +318,8 @@ class RecurrenceIterator implements \Iterator {
         // overridden event may cut ahead.
         if ($this->overriddenEventsIndex) {
 
-            $offset = reset($this->overriddenEventsIndex);
+
+            $offset = end($this->overriddenEventsIndex);
             $timestamp = key($this->overriddenEventsIndex);
             if (!$nextDate || $timestamp < $nextDate->getTimeStamp()) {
                 // Overridden event comes first.
@@ -329,7 +330,7 @@ class RecurrenceIterator implements \Iterator {
                 $this->currentDate = $this->currentOverriddenEvent->DTSTART->getDateTime();
 
                 // Ensuring that this item will only be used once.
-                array_shift($this->overriddenEventsIndex);
+                array_pop($this->overriddenEventsIndex);
 
                 // Exit point!
                 return;
diff --git a/tests/Sabre/VObject/RecurrenceIterator/MainTest.php b/tests/Sabre/VObject/RecurrenceIterator/MainTest.php
index 9669a2e..ecea965 100644
--- a/tests/Sabre/VObject/RecurrenceIterator/MainTest.php
+++ b/tests/Sabre/VObject/RecurrenceIterator/MainTest.php
@@ -1,13 +1,14 @@
 <?php
 
-namespace Sabre\VObject;
+namespace Sabre\VObject\RecurrenceIterator;
 
 use
     DateTime,
     DateTimeZone,
+    Sabre\VObject\RecurrenceIterator,
     Sabre\VObject\Component\VCalendar;
 
-class RecurrenceIteratorTest extends \PHPUnit_Framework_TestCase {
+class MainTest extends \PHPUnit_Framework_TestCase {
 
     function testValues() {
 

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