VTimeZoneTest.php 941 B

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