ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
BySetPosHangTest.php
Go to the documentation of this file.
1<?php
2
3namespace Sabre\VObject\Recur;
4
5use DateTime;
6use PHPUnit\Framework\TestCase;
8
9class BySetPosHangTest extends TestCase {
10
17 function testExpand() {
18
19 $ics = <<<ICS
20BEGIN:VCALENDAR
21VERSION:2.0
22PRODID:-//Sabre//Sabre VObject 3.4.2//EN
23CALSCALE:GREGORIAN
24BEGIN:VEVENT
25SUMMARY:Test event 1
26DTSTART;TZID=Europe/Copenhagen:20150101T170000
27RRULE:FREQ=MONTHLY;BYDAY=TH;BYSETPOS=-2
28UID:b4071499-6fe4-418a-83b8-2b8d5ebb38e4
29END:VEVENT
30END:VCALENDAR
31ICS;
32
33 $vcal = Reader::read($ics);
34 $this->assertInstanceOf('Sabre\\VObject\\Component\\VCalendar', $vcal);
35
36 $vcal = $vcal->expand(new DateTime('2015-01-01'), new DateTime('2016-01-01'));
37
38 foreach ($vcal->VEVENT as $event) {
39 $dates[] = $event->DTSTART->getValue();
40 }
41
42 $expectedDates = [
43 "20150101T160000Z",
44 "20150122T160000Z",
45 "20150219T160000Z",
46 "20150319T160000Z",
47 "20150423T150000Z",
48 "20150521T150000Z",
49 "20150618T150000Z",
50 "20150723T150000Z",
51 "20150820T150000Z",
52 "20150917T150000Z",
53 "20151022T150000Z",
54 "20151119T160000Z",
55 "20151224T160000Z",
56 ];
57
58 $this->assertEquals($expectedDates, $dates);
59 }
60
61}
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()
Using this iCalendar object, including BYSETPOS=-2 causes the iterator to hang, as reported in ticket...