diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/sabre/vobject/tests/VObject/Recur/EventIterator/Issue48Test.php	Sat Jan 13 09:06:10 2018 -0500
@@ -0,0 +1,49 @@
+<?php
+
+namespace Sabre\VObject;
+
+use
+    DateTime,
+    DateTimeZone;
+
+class Issue48Test extends \PHPUnit_Framework_TestCase {
+
+    function testExpand() {
+
+        $input = <<<ICS
+BEGIN:VCALENDAR
+BEGIN:VEVENT
+UID:foo
+DTEND;TZID=Europe/Moscow:20130710T120000
+DTSTART;TZID=Europe/Moscow:20130710T110000
+RRULE:FREQ=DAILY;UNTIL=20130712T195959Z
+END:VEVENT
+BEGIN:VEVENT
+UID:foo
+DTEND;TZID=Europe/Moscow:20130713T120000
+DTSTART;TZID=Europe/Moscow:20130713T110000
+RECURRENCE-ID;TZID=Europe/Moscow:20130711T110000
+END:VEVENT
+END:VCALENDAR
+ICS;
+
+        $vcal = Reader::read($input);
+        $this->assertInstanceOf('Sabre\\VObject\\Component\\VCalendar', $vcal);
+
+        $it = new Recur\EventIterator($vcal, 'foo');
+
+        $result = iterator_to_array($it);
+
+        $tz = new DateTimeZone('Europe/Moscow');
+
+        $expected = array(
+            new DateTime('2013-07-10 11:00:00', $tz),
+            new DateTime('2013-07-12 11:00:00', $tz),
+            new DateTime('2013-07-13 11:00:00', $tz),
+        );
+
+        $this->assertEquals($expected, $result);
+
+    }
+
+}