1<?php 2 3namespace Sabre\VObject; 4 5use DateTimeImmutable; 6use DateTimeZone; 7 8class Issue50Test extends \PHPUnit_Framework_TestCase { 9 10 function testExpand() { 11 12 $input = <<<ICS 13BEGIN:VCALENDAR 14VERSION:2.0 15PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN 16BEGIN:VTIMEZONE 17TZID:Europe/Brussels 18X-LIC-LOCATION:Europe/Brussels 19BEGIN:DAYLIGHT 20TZOFFSETFROM:+0100 21TZOFFSETTO:+0200 22TZNAME:CEST 23DTSTART:19700329T020000 24RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3 25END:DAYLIGHT 26BEGIN:STANDARD 27TZOFFSETFROM:+0200 28TZOFFSETTO:+0100 29TZNAME:CET 30DTSTART:19701025T030000 31RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 32END:STANDARD 33END:VTIMEZONE 34BEGIN:VEVENT 35CREATED:20130705T142510Z 36LAST-MODIFIED:20130715T132556Z 37DTSTAMP:20130715T132556Z 38UID:1aef0b27-3d92-4581-829a-11999dd36724 39SUMMARY:Werken 40RRULE:FREQ=DAILY;COUNT=5 41DTSTART;TZID=Europe/Brussels:20130715T090000 42DTEND;TZID=Europe/Brussels:20130715T170000 43LOCATION:Job 44DESCRIPTION:Vrij 45X-MOZ-GENERATION:9 46END:VEVENT 47BEGIN:VEVENT 48CREATED:20130715T081654Z 49LAST-MODIFIED:20130715T110931Z 50DTSTAMP:20130715T110931Z 51UID:1aef0b27-3d92-4581-829a-11999dd36724 52SUMMARY:Werken 53RECURRENCE-ID;TZID=Europe/Brussels:20130719T090000 54DTSTART;TZID=Europe/Brussels:20130719T070000 55DTEND;TZID=Europe/Brussels:20130719T150000 56SEQUENCE:1 57LOCATION:Job 58DESCRIPTION:Vrij 59X-MOZ-GENERATION:1 60END:VEVENT 61BEGIN:VEVENT 62CREATED:20130715T111654Z 63LAST-MODIFIED:20130715T132556Z 64DTSTAMP:20130715T132556Z 65UID:1aef0b27-3d92-4581-829a-11999dd36724 66SUMMARY:Werken 67RECURRENCE-ID;TZID=Europe/Brussels:20130716T090000 68DTSTART;TZID=Europe/Brussels:20130716T070000 69DTEND;TZID=Europe/Brussels:20130716T150000 70SEQUENCE:1 71LOCATION:Job 72X-MOZ-GENERATION:2 73END:VEVENT 74BEGIN:VEVENT 75CREATED:20130715T125942Z 76LAST-MODIFIED:20130715T130023Z 77DTSTAMP:20130715T130023Z 78UID:1aef0b27-3d92-4581-829a-11999dd36724 79SUMMARY:Werken 80RECURRENCE-ID;TZID=Europe/Brussels:20130717T090000 81DTSTART;TZID=Europe/Brussels:20130717T070000 82DTEND;TZID=Europe/Brussels:20130717T150000 83SEQUENCE:1 84LOCATION:Job 85X-MOZ-GENERATION:3 86END:VEVENT 87BEGIN:VEVENT 88CREATED:20130715T130024Z 89LAST-MODIFIED:20130715T130034Z 90DTSTAMP:20130715T130034Z 91UID:1aef0b27-3d92-4581-829a-11999dd36724 92SUMMARY:Werken 93RECURRENCE-ID;TZID=Europe/Brussels:20130718T090000 94DTSTART;TZID=Europe/Brussels:20130718T090000 95DTEND;TZID=Europe/Brussels:20130718T170000 96LOCATION:Job 97X-MOZ-GENERATION:5 98DESCRIPTION:Vrij 99END:VEVENT 100END:VCALENDAR 101ICS; 102 103 $vcal = Reader::read($input); 104 $this->assertInstanceOf('Sabre\\VObject\\Component\\VCalendar', $vcal); 105 106 $it = new Recur\EventIterator($vcal, '1aef0b27-3d92-4581-829a-11999dd36724'); 107 108 $result = []; 109 foreach ($it as $instance) { 110 111 $result[] = $instance; 112 113 } 114 115 $tz = new DateTimeZone('Europe/Brussels'); 116 117 $this->assertEquals([ 118 new DateTimeImmutable('2013-07-15 09:00:00', $tz), 119 new DateTimeImmutable('2013-07-16 07:00:00', $tz), 120 new DateTimeImmutable('2013-07-17 07:00:00', $tz), 121 new DateTimeImmutable('2013-07-18 09:00:00', $tz), 122 new DateTimeImmutable('2013-07-19 07:00:00', $tz), 123 ], $result); 124 125 } 126 127} 128