Add failing test for recurrences with limited occurence that have
authorGunnar Wrobel <p@rdus.de>
Mon, 9 Nov 2009 08:43:57 +0000 (09:43 +0100)
committerGunnar Wrobel <p@rdus.de>
Mon, 9 Nov 2009 08:43:57 +0000 (09:43 +0100)
multiple incidences per week.

From https://issues.kolab.org/issue3846:

horde counts recurring events per week and not per incident. This gets
a problem if a recurring event with more than one incident per week is
defined.  A recurring event with incidents on monday and friday with 3
incidents overall is displayed correctly with 3 incidents over one and
a half week in kontact and Outlook. Without this patch horde displays
6 incidents over 3 weeks.

framework/Date/test/Horde/Date/RecurrenceTest.php

index 8e69bdc..c3549d6 100644 (file)
@@ -137,6 +137,21 @@ class Horde_Date_RecurrenceTest extends PHPUnit_Framework_TestCase
                             $this->_getRecurrences($r));
     }
 
+    public function testWeeklyCountWithMultipleIncidencesPerWeek()
+    {
+        $r = new Horde_Date_Recurrence('2007-03-01 10:00:00');
+        $r->setRecurType(Horde_Date_Recurrence::RECUR_WEEKLY);
+        $r->setRecurOnDay(Horde_Date::MASK_THURSDAY | Horde_Date::MASK_SATURDAY);
+        $r->setRecurInterval(1);
+        $r->setRecurCount(3);
+        $this->assertEquals('W1 TH SA #3', $r->toRRule10($this->ical));
+        $this->assertEquals('FREQ=WEEKLY;INTERVAL=1;BYDAY=TH,SA;COUNT=3', $r->toRRule20($this->ical));
+        $this->assertEquals(array('2007-03-01 10:00:00',
+                                  '2007-03-03 10:00:00',
+                                  '2007-03-10 10:00:00',),
+                            $this->_getRecurrences($r));
+    }
+
     public function testMonthlyEnd()
     {
         $r = new Horde_Date_Recurrence('2007-03-01 10:00:00');