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