1<?php
2
3namespace Sabre\VObject;
4
5use DateTimeImmutable;
6
7class EmClientTest extends \PHPUnit_Framework_TestCase {
8
9    function testParseTz() {
10
11        $str = 'BEGIN:VCALENDAR
12X-WR-CALNAME:Blackhawks Schedule 2011-12
13X-APPLE-CALENDAR-COLOR:#E51717
14X-WR-TIMEZONE:America/Chicago
15CALSCALE:GREGORIAN
16PRODID:-//eM Client/4.0.13961.0
17VERSION:2.0
18BEGIN:VTIMEZONE
19TZID:America/Chicago
20BEGIN:DAYLIGHT
21TZOFFSETFROM:-0600
22RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3
23DTSTART:20070311T020000
24TZNAME:CDT
25TZOFFSETTO:-0500
26END:DAYLIGHT
27BEGIN:STANDARD
28TZOFFSETFROM:-0500
29RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11
30DTSTART:20071104T020000
31TZNAME:CST
32TZOFFSETTO:-0600
33END:STANDARD
34END:VTIMEZONE
35BEGIN:VEVENT
36CREATED:20110624T181236Z
37UID:be3bbfff-96e8-4c66-9908-ab791a62231d
38DTEND;TZID="America/Chicago":20111008T223000
39TRANSP:OPAQUE
40SUMMARY:Stars @ Blackhawks (Home Opener)
41DTSTART;TZID="America/Chicago":20111008T193000
42DTSTAMP:20120330T013232Z
43SEQUENCE:2
44X-MICROSOFT-CDO-BUSYSTATUS:BUSY
45LAST-MODIFIED:20120330T013237Z
46CLASS:PUBLIC
47END:VEVENT
48END:VCALENDAR';
49
50        $vObject = Reader::read($str);
51        $dt = $vObject->VEVENT->DTSTART->getDateTime();
52        $this->assertEquals(new DateTimeImmutable('2011-10-08 19:30:00', new \DateTimeZone('America/Chicago')), $dt);
53
54    }
55
56}
57