1<?php
2
3namespace Sabre\VObject;
4
5use DateTimeImmutable;
6use DateTimeZone;
7
8class Issue48Test extends \PHPUnit_Framework_TestCase {
9
10    function testExpand() {
11
12        $input = <<<ICS
13BEGIN:VCALENDAR
14BEGIN:VEVENT
15UID:foo
16DTEND;TZID=Europe/Moscow:20130710T120000
17DTSTART;TZID=Europe/Moscow:20130710T110000
18RRULE:FREQ=DAILY;UNTIL=20130712T195959Z
19END:VEVENT
20BEGIN:VEVENT
21UID:foo
22DTEND;TZID=Europe/Moscow:20130713T120000
23DTSTART;TZID=Europe/Moscow:20130713T110000
24RECURRENCE-ID;TZID=Europe/Moscow:20130711T110000
25END:VEVENT
26END:VCALENDAR
27ICS;
28
29        $vcal = Reader::read($input);
30        $this->assertInstanceOf('Sabre\\VObject\\Component\\VCalendar', $vcal);
31
32        $it = new Recur\EventIterator($vcal, 'foo');
33
34        $result = iterator_to_array($it);
35
36        $tz = new DateTimeZone('Europe/Moscow');
37
38        $expected = [
39            new DateTimeImmutable('2013-07-10 11:00:00', $tz),
40            new DateTimeImmutable('2013-07-12 11:00:00', $tz),
41            new DateTimeImmutable('2013-07-13 11:00:00', $tz),
42        ];
43
44        $this->assertEquals($expected, $result);
45
46    }
47
48}
49