MissingOverriddenTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace Sabre\VObject\Recur\EventIterator;
  3. use
  4. DateTime,
  5. DateTimeZone,
  6. Sabre\VObject\Reader;
  7. class RecurrenceIteratorMissingOverriddenTest extends \PHPUnit_Framework_TestCase {
  8. function testExpand() {
  9. $input = <<<ICS
  10. BEGIN:VCALENDAR
  11. VERSION:2.0
  12. BEGIN:VEVENT
  13. UID:foo
  14. DTSTART:20130727T120000Z
  15. DURATION:PT1H
  16. RRULE:FREQ=DAILY;COUNT=2
  17. SUMMARY:A
  18. END:VEVENT
  19. BEGIN:VEVENT
  20. RECURRENCE-ID:20130728T120000Z
  21. UID:foo
  22. DTSTART:20140101T120000Z
  23. DURATION:PT1H
  24. SUMMARY:B
  25. END:VEVENT
  26. END:VCALENDAR
  27. ICS;
  28. $vcal = Reader::read($input);
  29. $this->assertInstanceOf('Sabre\\VObject\\Component\\VCalendar', $vcal);
  30. $vcal->expand(new DateTime('2011-01-01'), new DateTime('2015-01-01'));
  31. $result = $vcal->serialize();
  32. $output = <<<ICS
  33. BEGIN:VCALENDAR
  34. VERSION:2.0
  35. BEGIN:VEVENT
  36. UID:foo
  37. DTSTART:20130727T120000Z
  38. DURATION:PT1H
  39. SUMMARY:A
  40. RECURRENCE-ID:20130727T120000Z
  41. END:VEVENT
  42. BEGIN:VEVENT
  43. RECURRENCE-ID:20130728T120000Z
  44. UID:foo
  45. DTSTART:20140101T120000Z
  46. DURATION:PT1H
  47. SUMMARY:B
  48. END:VEVENT
  49. END:VCALENDAR
  50. ICS;
  51. $this->assertEquals($output, str_replace("\r","",$result));
  52. }
  53. }