1<?php
2
3namespace Sabre\VObject\Recur;
4
5use Sabre\VObject\Reader;
6
7/**
8 * Testing case when overridden recurring events have same start date.
9 *
10 * Class SameDateForRecurringEventsTest
11 */
12class SameDateForRecurringEventsTest extends \PHPUnit_Framework_TestCase
13{
14
15    /**
16     * Checking is all events iterated by EventIterator.
17     */
18    function testAllEventsArePresentInIterator()
19    {
20        $ics = <<<ICS
21BEGIN:VCALENDAR
22BEGIN:VEVENT
23UID:1
24DTSTART;TZID=Europe/Kiev:20160713T110000
25DTEND;TZID=Europe/Kiev:20160713T113000
26RRULE:FREQ=DAILY;INTERVAL=1;COUNT=3
27END:VEVENT
28BEGIN:VEVENT
29UID:2
30DTSTART;TZID=Europe/Kiev:20160713T110000
31DTEND;TZID=Europe/Kiev:20160713T113000
32RECURRENCE-ID;TZID=Europe/Kiev:20160714T110000
33END:VEVENT
34BEGIN:VEVENT
35UID:3
36DTSTART;TZID=Europe/Kiev:20160713T110000
37DTEND;TZID=Europe/Kiev:20160713T113000
38RECURRENCE-ID;TZID=Europe/Kiev:20160715T110000
39END:VEVENT
40BEGIN:VEVENT
41UID:4
42DTSTART;TZID=Europe/Kiev:20160713T110000
43DTEND;TZID=Europe/Kiev:20160713T113000
44RECURRENCE-ID;TZID=Europe/Kiev:20160716T110000
45END:VEVENT
46END:VCALENDAR
47
48
49ICS;
50        $vCalendar = Reader::read($ics);
51        $eventIterator = new EventIterator($vCalendar->getComponents());
52
53        $this->assertEquals(4, iterator_count($eventIterator), 'in ICS 4 events');
54    }
55}
56