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