]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/tests/Sabre/CalDAV/Issue228Test.php
Merge branch '3.6-release'
[friendica-addons.git] / dav / SabreDAV / tests / Sabre / CalDAV / Issue228Test.php
1 <?php
2
3 /**
4  * This unittest is created to check if the time-range filter is working correctly with all-day-events
5  *
6  * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
7  * @author Evert Pot (http://www.rooftopsolutions.nl/)
8  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
9  */
10 class Sabre_CalDAV_Issue228Test extends Sabre_DAVServerTest {
11
12     protected $setupCalDAV = true;
13
14     protected $caldavCalendars = array(
15         array(
16             'id' => 1,
17             'name' => 'Calendar',
18             'principaluri' => 'principals/user1',
19             'uri' => 'calendar1',
20         )
21     );
22
23     protected $caldavCalendarObjects = array(
24         1 => array(
25             'event.ics' => array(
26                 'calendardata' => 'BEGIN:VCALENDAR
27 VERSION:2.0
28 BEGIN:VEVENT
29 UID:20120730T113415CEST-6804EGphkd@xxxxxx.de
30 DTSTAMP:20120730T093415Z
31 DTSTART;VALUE=DATE:20120729
32 DTEND;VALUE=DATE:20120730
33 SUMMARY:sunday event
34 TRANSP:TRANSPARENT
35 END:VEVENT
36 END:VCALENDAR
37 ',
38             ),
39         ),
40     );
41
42     function testIssue228() {
43
44         $request = new Sabre_HTTP_Request(array(
45             'REQUEST_METHOD' => 'REPORT',
46             'HTTP_CONTENT_TYPE' => 'application/xml',
47             'REQUEST_URI' => '/calendars/user1/calendar1',
48             'HTTP_DEPTH' => '1',
49         ));
50
51         $request->setBody('<?xml version="1.0" encoding="utf-8" ?>
52 <C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
53   <D:prop>
54     <C:calendar-data>
55   <C:expand start="20120730T095609Z"
56             end="20120813T095609Z"/>
57 </C:calendar-data>
58     <D:getetag/>
59   </D:prop>
60   <C:filter>
61     <C:comp-filter name="VCALENDAR">
62       <C:comp-filter name="VEVENT">
63         <C:time-range start="20120730T095609Z" end="20120813T095609Z"/>
64       </C:comp-filter>
65     </C:comp-filter>
66   </C:filter>
67 </C:calendar-query>');
68
69         $response = $this->request($request);
70
71         // We must check if absolutely nothing was returned from this query.
72         $this->assertFalse(strpos($response->body, 'BEGIN:VCALENDAR'));
73
74     }
75 }