7
|
1 <?php
|
|
2
|
|
3 namespace Sabre\VObject;
|
|
4
|
|
5 use
|
|
6 DateTime,
|
|
7 DateTimeZone;
|
|
8
|
|
9 class RecurrenceIteratorMissingOverriddenTest extends \PHPUnit_Framework_TestCase {
|
|
10
|
|
11 function testExpand() {
|
|
12
|
|
13 $input = <<<ICS
|
|
14 BEGIN:VCALENDAR
|
|
15 VERSION:2.0
|
|
16 BEGIN:VEVENT
|
|
17 UID:foo
|
|
18 DTSTART:20130727T120000Z
|
|
19 DURATION:PT1H
|
|
20 RRULE:FREQ=DAILY;COUNT=2
|
|
21 SUMMARY:A
|
|
22 END:VEVENT
|
|
23 BEGIN:VEVENT
|
|
24 RECURRENCE-ID:20130728T120000Z
|
|
25 UID:foo
|
|
26 DTSTART:20140101T120000Z
|
|
27 DURATION:PT1H
|
|
28 SUMMARY:B
|
|
29 END:VEVENT
|
|
30 END:VCALENDAR
|
|
31 ICS;
|
|
32
|
|
33 $vcal = Reader::read($input);
|
|
34 $this->assertInstanceOf('Sabre\\VObject\\Component\\VCalendar', $vcal);
|
|
35
|
|
36 $vcal->expand(new DateTime('2011-01-01'), new DateTime('2015-01-01'));
|
|
37
|
|
38 $result = $vcal->serialize();
|
|
39
|
|
40 $output = <<<ICS
|
|
41 BEGIN:VCALENDAR
|
|
42 VERSION:2.0
|
|
43 BEGIN:VEVENT
|
|
44 UID:foo
|
|
45 DTSTART:20130727T120000Z
|
|
46 DURATION:PT1H
|
|
47 SUMMARY:A
|
|
48 END:VEVENT
|
|
49 BEGIN:VEVENT
|
|
50 RECURRENCE-ID:20130728T120000Z
|
|
51 UID:foo
|
|
52 DTSTART:20140101T120000Z
|
|
53 DURATION:PT1H
|
|
54 SUMMARY:B
|
|
55 END:VEVENT
|
|
56 END:VCALENDAR
|
|
57
|
|
58 ICS;
|
|
59 $this->assertEquals($output, str_replace("\r","",$result));
|
|
60
|
|
61 }
|
|
62
|
|
63 }
|