diff vendor/sabre/vobject/tests/VObject/Component/VTimeZoneTest.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/Component/VTimeZoneTest.php	Sat Jan 13 09:06:10 2018 -0500
@@ -0,0 +1,57 @@
+<?php
+
+namespace Sabre\VObject\Component;
+
+use Sabre\VObject;
+use Sabre\VObject\Reader;
+
+class VTimeZoneTest extends \PHPUnit_Framework_TestCase {
+
+    function testValidate() {
+
+        $input = <<<HI
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:YoYo
+BEGIN:VTIMEZONE
+TZID:America/Toronto
+END:VTIMEZONE
+END:VCALENDAR
+HI;
+
+        $obj = Reader::read($input);
+
+        $warnings = $obj->validate();
+        $messages = array();
+        foreach($warnings as $warning) {
+            $messages[] = $warning['message'];
+        }
+
+        $this->assertEquals(array(), $messages);
+
+    }
+
+    function testGetTimeZone() {
+
+        $input = <<<HI
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:YoYo
+BEGIN:VTIMEZONE
+TZID:America/Toronto
+END:VTIMEZONE
+END:VCALENDAR
+HI;
+
+        $obj = Reader::read($input);
+
+        $tz = new \DateTimeZone('America/Toronto');
+
+        $this->assertEquals(
+            $tz,
+            $obj->VTIMEZONE->getTimeZone()
+        );
+
+    }
+
+}