1<?php
2
3namespace Sabre\VObject\Recur\EventIterator;
4
5use DateTime;
6use Sabre\VObject\Reader;
7
8/**
9 * This is a unittest for Issue #53.
10 */
11class IncorrectExpandTest extends \PHPUnit_Framework_TestCase {
12
13    use \Sabre\VObject\PHPUnitAssertions;
14
15    function testExpand() {
16
17        $input = <<<ICS
18BEGIN:VCALENDAR
19VERSION:2.0
20BEGIN:VEVENT
21UID:foo
22DTSTART:20130711T050000Z
23DTEND:20130711T053000Z
24RRULE:FREQ=DAILY;INTERVAL=1;COUNT=2
25END:VEVENT
26BEGIN:VEVENT
27UID:foo
28DTSTART:20130719T050000Z
29DTEND:20130719T053000Z
30RECURRENCE-ID:20130712T050000Z
31END:VEVENT
32END:VCALENDAR
33ICS;
34
35        $vcal = Reader::read($input);
36        $this->assertInstanceOf('Sabre\\VObject\\Component\\VCalendar', $vcal);
37
38        $vcal = $vcal->expand(new DateTime('2011-01-01'), new DateTime('2014-01-01'));
39
40        $output = <<<ICS
41BEGIN:VCALENDAR
42VERSION:2.0
43BEGIN:VEVENT
44UID:foo
45DTSTART:20130711T050000Z
46DTEND:20130711T053000Z
47RECURRENCE-ID:20130711T050000Z
48END:VEVENT
49BEGIN:VEVENT
50UID:foo
51DTSTART:20130719T050000Z
52DTEND:20130719T053000Z
53RECURRENCE-ID:20130712T050000Z
54END:VEVENT
55END:VCALENDAR
56
57ICS;
58        $this->assertVObjectEqualsVObject($output, $vcal);
59
60    }
61
62}
63