ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ByMonthInDailyTest.php
Go to the documentation of this file.
1<?php
2
3namespace Sabre\VObject\Recur;
4
5use DateTime;
6use PHPUnit\Framework\TestCase;
8
9class ByMonthInDailyTest extends TestCase {
10
14 function testExpand() {
15
16 $ics = <<<ICS
17BEGIN:VCALENDAR
18VERSION:2.0
19PRODID:-//Apple Inc.//iCal 4.0.4//EN
20CALSCALE:GREGORIAN
21BEGIN:VEVENT
22TRANSP:OPAQUE
23DTEND:20070925T183000Z
24UID:uuid
25DTSTAMP:19700101T000000Z
26LOCATION:
27DESCRIPTION:
28STATUS:CONFIRMED
29SEQUENCE:18
30SUMMARY:Stuff
31DTSTART:20070925T160000Z
32CREATED:20071004T144642Z
33RRULE:FREQ=DAILY;BYMONTH=9,10;BYDAY=SU
34END:VEVENT
35END:VCALENDAR
36ICS;
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}
An exception for terminatinating execution or to throw for unit testing.
iCalendar/vCard/jCal/jCard/xCal/xCard reader object.
Definition: Reader.php:15
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
Definition: Reader.php:42
testExpand()
This tests the expansion of dates with DAILY frequency in RRULE with BYMONTH restrictions.