aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/vobject/tests/Sabre/VObject/Issue48Test.php
blob: 980d432b9f73394b2508d19a91e95106c55d9583 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php

namespace Sabre\VObject;

use
    DateTime,
    DateTimeZone;

class Issue48Test extends \PHPUnit_Framework_TestCase {

    function testExpand() {

        $input = <<<ICS
BEGIN:VCALENDAR
BEGIN:VEVENT
UID:foo
DTEND;TZID=Europe/Moscow:20130710T120000
DTSTART;TZID=Europe/Moscow:20130710T110000
RRULE:FREQ=DAILY;UNTIL=20130712T195959Z
END:VEVENT
BEGIN:VEVENT
UID:foo
DTEND;TZID=Europe/Moscow:20130713T120000
DTSTART;TZID=Europe/Moscow:20130713T110000
RECURRENCE-ID;TZID=Europe/Moscow:20130711T110000
END:VEVENT
END:VCALENDAR
ICS;

        $vcal = Reader::read($input);
        $this->assertInstanceOf('Sabre\\VObject\\Component\\VCalendar', $vcal);

        $it = new RecurrenceIterator($vcal, 'foo');

        $result = iterator_to_array($it);

        $tz = new DateTimeZone('Europe/Moscow');

        $this->assertEquals(array(
            new DateTime('2013-07-10 11:00:00', $tz),
            new DateTime('2013-07-12 11:00:00', $tz),
            new DateTime('2013-07-13 11:00:00', $tz),
        ), $result);

    }

}