1<?php
2
3namespace Sabre\VObject\Component;
4
5use Sabre\VObject\Reader;
6
7class VTimeZoneTest extends \PHPUnit_Framework_TestCase {
8
9    function testValidate() {
10
11        $input = <<<HI
12BEGIN:VCALENDAR
13VERSION:2.0
14PRODID:YoYo
15BEGIN:VTIMEZONE
16TZID:America/Toronto
17END:VTIMEZONE
18END:VCALENDAR
19HI;
20
21        $obj = Reader::read($input);
22
23        $warnings = $obj->validate();
24        $messages = [];
25        foreach ($warnings as $warning) {
26            $messages[] = $warning['message'];
27        }
28
29        $this->assertEquals([], $messages);
30
31    }
32
33    function testGetTimeZone() {
34
35        $input = <<<HI
36BEGIN:VCALENDAR
37VERSION:2.0
38PRODID:YoYo
39BEGIN:VTIMEZONE
40TZID:America/Toronto
41END:VTIMEZONE
42END:VCALENDAR
43HI;
44
45        $obj = Reader::read($input);
46
47        $tz = new \DateTimeZone('America/Toronto');
48
49        $this->assertEquals(
50            $tz,
51            $obj->VTIMEZONE->getTimeZone()
52        );
53
54    }
55
56}
57