EmClientTest.php 1.2 KB

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