Issue48Test.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Sabre\VObject;
  3. use
  4. DateTime,
  5. DateTimeZone;
  6. class Issue48Test extends \PHPUnit_Framework_TestCase {
  7. function testExpand() {
  8. $input = <<<ICS
  9. BEGIN:VCALENDAR
  10. BEGIN:VEVENT
  11. UID:foo
  12. DTEND;TZID=Europe/Moscow:20130710T120000
  13. DTSTART;TZID=Europe/Moscow:20130710T110000
  14. RRULE:FREQ=DAILY;UNTIL=20130712T195959Z
  15. END:VEVENT
  16. BEGIN:VEVENT
  17. UID:foo
  18. DTEND;TZID=Europe/Moscow:20130713T120000
  19. DTSTART;TZID=Europe/Moscow:20130713T110000
  20. RECURRENCE-ID;TZID=Europe/Moscow:20130711T110000
  21. END:VEVENT
  22. END:VCALENDAR
  23. ICS;
  24. $vcal = Reader::read($input);
  25. $this->assertInstanceOf('Sabre\\VObject\\Component\\VCalendar', $vcal);
  26. $it = new Recur\EventIterator($vcal, 'foo');
  27. $result = iterator_to_array($it);
  28. $tz = new DateTimeZone('Europe/Moscow');
  29. $expected = array(
  30. new DateTime('2013-07-10 11:00:00', $tz),
  31. new DateTime('2013-07-12 11:00:00', $tz),
  32. new DateTime('2013-07-13 11:00:00', $tz),
  33. );
  34. $this->assertEquals($expected, $result);
  35. }
  36. }