@@ -1253,7 +1253,7 @@ public function rfcExamples()
1253
1253
date_create ('1999-03-11 09:00:00 ' ),
1254
1254
date_create ('1999-03-12 09:00:00 ' ),
1255
1255
date_create ('1999-03-13 09:00:00 ' ))),
1256
- // Every Tuesday, every other month, 6 occurences .
1256
+ // Every Tuesday, every other month, 6 occurrences .
1257
1257
array (
1258
1258
array ('freq ' => 'monthly ' , 'count ' => 6 , 'interval ' => 2 , 'byday ' => 'TU ' , 'dtstart ' => '1997-09-02 09:00:00 ' ),
1259
1259
array (date_create ('1997-09-02 09:00:00 ' ),
@@ -1501,7 +1501,7 @@ public function testRfcExamples($rule, $occurrences)
1501
1501
}
1502
1502
1503
1503
/**
1504
- * Rules that generate no occurence , because of a bad combination of BYXXX parts
1504
+ * Rules that generate no occurrence , because of a bad combination of BYXXX parts
1505
1505
* This tests are here to ensure that the lib will not go into an infinite loop.
1506
1506
*/
1507
1507
public function rulesWithoutOccurrences ()
@@ -1525,7 +1525,7 @@ public function rulesWithoutOccurrences()
1525
1525
'count ' => 1
1526
1526
)),
1527
1527
1528
- // haven't found a weekly rule with no occurence yet
1528
+ // haven't found a weekly rule with no occurrence yet
1529
1529
1530
1530
// every 7 days, monday, starting a wednesday (still nope)
1531
1531
array (array (
@@ -1785,10 +1785,10 @@ public function notOccurrences()
1785
1785
/**
1786
1786
* @dataProvider notOccurrences
1787
1787
*/
1788
- public function testNotOccurrences ($ rule , $ not_occurences )
1788
+ public function testNotOccurrences ($ rule , $ not_occurrences )
1789
1789
{
1790
1790
$ rule = new RRule ($ rule );
1791
- foreach ($ not_occurences as $ date ) {
1791
+ foreach ($ not_occurrences as $ date ) {
1792
1792
$ this ->assertFalse ($ rule ->occursAt ($ date ), "Rule must not match $ date " );
1793
1793
}
1794
1794
}
@@ -1912,6 +1912,7 @@ public function occurrencesAfter()
1912
1912
{
1913
1913
return [
1914
1914
["DTSTART:20170101 \nRRULE:FREQ=DAILY;UNTIL=20170103 " , '2017-01-01 ' , false , null , [date_create ('2017-01-02 ' ), date_create ('2017-01-03 ' )]],
1915
+ ["DTSTART:20170101 \nRRULE:FREQ=DAILY;UNTIL=20170103 " , '2017-01-01 ' , true , null , [date_create ('2017-01-01 ' ), date_create ('2017-01-02 ' ), date_create ('2017-01-03 ' )]],
1915
1916
["DTSTART:20170101 \nRRULE:FREQ=DAILY " , '2017-02-01 ' , false , 2 , [date_create ('2017-02-02 ' ),date_create ('2017-02-03 ' )]],
1916
1917
["DTSTART:20170101 \nRRULE:FREQ=DAILY " , '2017-02-01 ' , true , 2 , [date_create ('2017-02-01 ' ),date_create ('2017-02-02 ' )]],
1917
1918
["DTSTART:20170101 \nRRULE:FREQ=DAILY;INTERVAL=2 " , '2017-01-02 ' , true , 2 , [date_create ('2017-01-03 ' ),date_create ('2017-01-05 ' )]],
@@ -1929,6 +1930,17 @@ public function testGetOccurrencesAfter($rrule, $date, $inclusive, $limit, $expe
1929
1930
$ this ->assertEquals ($ expected , $ occurrences );
1930
1931
}
1931
1932
1933
+ public function testGetOccurrencesAfterThrowsLogicException ()
1934
+ {
1935
+ $ this ->expectException (\LogicException::class);
1936
+ $ this ->expectExceptionMessage ("Cannot get all occurrences of an infinite recurrence rule. " );
1937
+ $ rrule = new RRule (array (
1938
+ 'FREQ ' => 'DAILY ' ,
1939
+ 'DTSTART ' => '2017-01-01 '
1940
+ ));
1941
+ $ rrule ->getOccurrencesAfter ('2017-01-01 ' );
1942
+ }
1943
+
1932
1944
public function occurrencesBefore ()
1933
1945
{
1934
1946
return [
@@ -2730,31 +2742,31 @@ public function testDateTimeMutableReferenceBug()
2730
2742
$ occurrence ->modify ('+1 day ' );
2731
2743
$ this ->assertEquals (date_create ('2007-01-01 ' ), $ rrule [0 ], 'No modification possible with foreach (cached) ' );
2732
2744
2733
- // getOccurences
2745
+ // getOccurrences
2734
2746
$ occurrences = $ rrule ->getOccurrences ();
2735
2747
$ this ->assertEquals (date_create ('2007-01-01 ' ), $ occurrences [0 ]);
2736
2748
$ occurrences [0 ]->modify ('+1 day ' );
2737
2749
$ this ->assertEquals (date_create ('2007-01-02 ' ), $ occurrences [0 ]);
2738
- $ this ->assertEquals (date_create ('2007-01-01 ' ), $ rrule [0 ], 'No modification possible with getOccurences (uncached version) ' );
2750
+ $ this ->assertEquals (date_create ('2007-01-01 ' ), $ rrule [0 ], 'No modification possible with getOccurrences (uncached version) ' );
2739
2751
2740
2752
$ occurrences = $ rrule ->getOccurrences ();
2741
2753
$ this ->assertEquals (date_create ('2007-01-01 ' ), $ occurrences [0 ]);
2742
2754
$ occurrences [0 ]->modify ('+1 day ' );
2743
2755
$ this ->assertEquals (date_create ('2007-01-02 ' ), $ occurrences [0 ]);
2744
- $ this ->assertEquals (date_create ('2007-01-01 ' ), $ rrule [0 ], 'No modification possible with getOccurences (cached version) ' );
2756
+ $ this ->assertEquals (date_create ('2007-01-01 ' ), $ rrule [0 ], 'No modification possible with getOccurrences (cached version) ' );
2745
2757
2746
2758
// getOccurrencesBetween
2747
2759
$ occurrences = $ rrule ->getOccurrencesBetween (null , null );
2748
2760
$ this ->assertEquals (date_create ('2007-01-01 ' ), $ occurrences [0 ]);
2749
2761
$ occurrences [0 ]->modify ('+1 day ' );
2750
2762
$ this ->assertEquals (date_create ('2007-01-02 ' ), $ occurrences [0 ]);
2751
- $ this ->assertEquals (date_create ('2007-01-01 ' ), $ rrule [0 ], 'No modification possible with getOccurences (uncached version) ' );
2763
+ $ this ->assertEquals (date_create ('2007-01-01 ' ), $ rrule [0 ], 'No modification possible with getOccurrences (uncached version) ' );
2752
2764
2753
2765
$ occurrences = $ rrule ->getOccurrencesBetween (null , null );
2754
2766
$ this ->assertEquals (date_create ('2007-01-01 ' ), $ occurrences [0 ]);
2755
2767
$ occurrences [0 ]->modify ('+1 day ' );
2756
2768
$ this ->assertEquals (date_create ('2007-01-02 ' ), $ occurrences [0 ]);
2757
- $ this ->assertEquals (date_create ('2007-01-01 ' ), $ rrule [0 ], 'No modification possible with getOccurences (cached version) ' );
2769
+ $ this ->assertEquals (date_create ('2007-01-01 ' ), $ rrule [0 ], 'No modification possible with getOccurrences (cached version) ' );
2758
2770
}
2759
2771
2760
2772
public function testGetRule ()
0 commit comments