7
|
1 <?php
|
|
2
|
|
3 namespace Sabre\VObject;
|
|
4
|
|
5 use
|
|
6 DateTime;
|
|
7
|
|
8 class RecurrenceIteratorByMonthInDailyTest extends \PHPUnit_Framework_TestCase {
|
|
9
|
|
10 /**
|
|
11 * This tests the expansion of dates with DAILY frequency in RRULE with BYMONTH restrictions
|
|
12 */
|
|
13 function testExpand() {
|
|
14
|
|
15 $ics = <<<ICS
|
|
16 BEGIN:VCALENDAR
|
|
17 VERSION:2.0
|
|
18 PRODID:-//Apple Inc.//iCal 4.0.4//EN
|
|
19 CALSCALE:GREGORIAN
|
|
20 BEGIN:VEVENT
|
|
21 TRANSP:OPAQUE
|
|
22 DTEND:20070925T183000Z
|
|
23 UID:uuid
|
|
24 DTSTAMP:19700101T000000Z
|
|
25 LOCATION:
|
|
26 DESCRIPTION:
|
|
27 STATUS:CONFIRMED
|
|
28 SEQUENCE:18
|
|
29 SUMMARY:Stuff
|
|
30 DTSTART:20070925T160000Z
|
|
31 CREATED:20071004T144642Z
|
|
32 RRULE:FREQ=DAILY;BYMONTH=9,10;BYDAY=SU
|
|
33 END:VEVENT
|
|
34 END:VCALENDAR
|
|
35 ICS;
|
|
36
|
|
37 $vcal = Reader::read($ics);
|
|
38 $this->assertInstanceOf('Sabre\\VObject\\Component\\VCalendar', $vcal);
|
|
39
|
|
40 $vcal->expand(new DateTime('2013-09-28'), new DateTime('2014-09-11'));
|
|
41
|
|
42 foreach ($vcal->VEVENT as $event) {
|
|
43 $dates[] = $event->DTSTART->getValue();
|
|
44 }
|
|
45
|
|
46 $expectedDates = array(
|
|
47 "20130929T160000Z",
|
|
48 "20131006T160000Z",
|
|
49 "20131013T160000Z",
|
|
50 "20131020T160000Z",
|
|
51 "20131027T160000Z",
|
|
52 "20140907T160000Z"
|
|
53 );
|
|
54
|
|
55 $this->assertEquals($expectedDates, $dates, 'Recursed dates are restricted by month');
|
|
56 }
|
|
57
|
|
58 }
|