annotate vendor/sabre/vobject/tests/VObject/Recur/EventIterator/Issue48Test.php @ 7:430dbd5346f7

vendor sabre as distributed
author Charlie Root
date Sat, 13 Jan 2018 09:06:10 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
1 <?php
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
2
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
3 namespace Sabre\VObject;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
4
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
5 use
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
6 DateTime,
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
7 DateTimeZone;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
8
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
9 class Issue48Test extends \PHPUnit_Framework_TestCase {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
10
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
11 function testExpand() {
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
12
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
13 $input = <<<ICS
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
14 BEGIN:VCALENDAR
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
15 BEGIN:VEVENT
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
16 UID:foo
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
17 DTEND;TZID=Europe/Moscow:20130710T120000
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
18 DTSTART;TZID=Europe/Moscow:20130710T110000
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
19 RRULE:FREQ=DAILY;UNTIL=20130712T195959Z
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
20 END:VEVENT
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
21 BEGIN:VEVENT
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
22 UID:foo
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
23 DTEND;TZID=Europe/Moscow:20130713T120000
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
24 DTSTART;TZID=Europe/Moscow:20130713T110000
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
25 RECURRENCE-ID;TZID=Europe/Moscow:20130711T110000
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
26 END:VEVENT
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
27 END:VCALENDAR
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
28 ICS;
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
29
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
30 $vcal = Reader::read($input);
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
31 $this->assertInstanceOf('Sabre\\VObject\\Component\\VCalendar', $vcal);
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
32
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
33 $it = new Recur\EventIterator($vcal, 'foo');
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
34
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
35 $result = iterator_to_array($it);
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
36
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
37 $tz = new DateTimeZone('Europe/Moscow');
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
38
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
39 $expected = array(
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
40 new DateTime('2013-07-10 11:00:00', $tz),
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
41 new DateTime('2013-07-12 11:00:00', $tz),
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
42 new DateTime('2013-07-13 11:00:00', $tz),
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
43 );
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
44
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
45 $this->assertEquals($expected, $result);
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
46
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
47 }
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
48
430dbd5346f7 vendor sabre as distributed
Charlie Root
parents:
diff changeset
49 }