ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
BySetPosHangTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\VObject\Recur;
4 
5 use DateTime;
8 
9 class BySetPosHangTest extends TestCase {
10 
17  function testExpand() {
18 
19  $ics = <<<ICS
20 BEGIN:VCALENDAR
21 VERSION:2.0
22 PRODID:-//Sabre//Sabre VObject 3.4.2//EN
23 CALSCALE:GREGORIAN
24 BEGIN:VEVENT
25 SUMMARY:Test event 1
26 DTSTART;TZID=Europe/Copenhagen:20150101T170000
27 RRULE:FREQ=MONTHLY;BYDAY=TH;BYSETPOS=-2
28 UID:b4071499-6fe4-418a-83b8-2b8d5ebb38e4
29 END:VEVENT
30 END:VCALENDAR
31 ICS;
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 }
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...