Issue228Test.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace Sabre\CalDAV;
  3. use Sabre\HTTP;
  4. /**
  5. * This unittest is created to check if the time-range filter is working correctly with all-day-events
  6. *
  7. * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
  8. * @author Evert Pot (http://evertpot.com/)
  9. * @license http://sabre.io/license/ Modified BSD License
  10. */
  11. class Issue228Test extends \Sabre\DAVServerTest {
  12. protected $setupCalDAV = true;
  13. protected $caldavCalendars = array(
  14. array(
  15. 'id' => 1,
  16. 'name' => 'Calendar',
  17. 'principaluri' => 'principals/user1',
  18. 'uri' => 'calendar1',
  19. )
  20. );
  21. protected $caldavCalendarObjects = array(
  22. 1 => array(
  23. 'event.ics' => array(
  24. 'calendardata' => 'BEGIN:VCALENDAR
  25. VERSION:2.0
  26. BEGIN:VEVENT
  27. UID:20120730T113415CEST-6804EGphkd@xxxxxx.de
  28. DTSTAMP:20120730T093415Z
  29. DTSTART;VALUE=DATE:20120729
  30. DTEND;VALUE=DATE:20120730
  31. SUMMARY:sunday event
  32. TRANSP:TRANSPARENT
  33. END:VEVENT
  34. END:VCALENDAR
  35. ',
  36. ),
  37. ),
  38. );
  39. function testIssue228() {
  40. $request = HTTP\Sapi::createFromServerArray(array(
  41. 'REQUEST_METHOD' => 'REPORT',
  42. 'HTTP_CONTENT_TYPE' => 'application/xml',
  43. 'REQUEST_URI' => '/calendars/user1/calendar1',
  44. 'HTTP_DEPTH' => '1',
  45. ));
  46. $request->setBody('<?xml version="1.0" encoding="utf-8" ?>
  47. <C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
  48. <D:prop>
  49. <C:calendar-data>
  50. <C:expand start="20120730T095609Z"
  51. end="20120813T095609Z"/>
  52. </C:calendar-data>
  53. <D:getetag/>
  54. </D:prop>
  55. <C:filter>
  56. <C:comp-filter name="VCALENDAR">
  57. <C:comp-filter name="VEVENT">
  58. <C:time-range start="20120730T095609Z" end="20120813T095609Z"/>
  59. </C:comp-filter>
  60. </C:comp-filter>
  61. </C:filter>
  62. </C:calendar-query>');
  63. $response = $this->request($request);
  64. // We must check if absolutely nothing was returned from this query.
  65. $this->assertFalse(strpos($response->body, 'BEGIN:VCALENDAR'));
  66. }
  67. }