]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/tests/Sabre/CalDAV/Issue211Test.php
Merge branch 'master' of git://github.com/friendica/friendica-addons
[friendica-addons.git] / dav / SabreDAV / tests / Sabre / CalDAV / Issue211Test.php
1 <?php
2
3 /**
4  * This unittest is created to check for an endless loop in Sabre_CalDAV_CalendarQueryValidator
5  *
6  *
7  * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
8  * @author Evert Pot (http://www.rooftopsolutions.nl/)
9  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
10  */
11 class Sabre_CalDAV_Issue211Test extends Sabre_DAVServerTest {
12
13     protected $setupCalDAV = true;
14
15     protected $caldavCalendars = array(
16         array(
17             'id' => 1,
18             'name' => 'Calendar',
19             'principaluri' => 'principals/user1',
20             'uri' => 'calendar1',
21         )
22     );
23
24     protected $caldavCalendarObjects = array(
25         1 => array(
26             'event.ics' => array(
27                 'calendardata' => 'BEGIN:VCALENDAR
28 VERSION:2.0
29 BEGIN:VEVENT
30 UID:20120418T172519CEST-3510gh1hVw
31 DTSTAMP:20120418T152519Z
32 DTSTART;VALUE=DATE:20120330
33 DTEND;VALUE=DATE:20120531
34 EXDATE;TZID=Europe/Berlin:20120330T000000
35 RRULE:FREQ=YEARLY;INTERVAL=1
36 SEQUENCE:1
37 SUMMARY:Birthday
38 TRANSP:TRANSPARENT
39 BEGIN:VALARM
40 ACTION:EMAIL
41 ATTENDEE:MAILTO:xxx@domain.de
42 DESCRIPTION:Dies ist eine Kalender Erinnerung
43 SUMMARY:Kalender Alarm Erinnerung
44 TRIGGER;VALUE=DATE-TIME:20120329T060000Z
45 END:VALARM
46 END:VEVENT
47 END:VCALENDAR
48 ',
49             ),
50         ),
51     );
52
53     function testIssue211() {
54
55         $request = new Sabre_HTTP_Request(array(
56             'REQUEST_METHOD' => 'REPORT',
57             'HTTP_CONTENT_TYPE' => 'application/xml',
58             'REQUEST_URI' => '/calendars/user1/calendar1',
59             'HTTP_DEPTH' => '1',
60         ));
61
62         $request->setBody('<?xml version="1.0" encoding="utf-8" ?>
63 <C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
64     <D:prop>
65         <C:calendar-data/>
66         <D:getetag/>
67     </D:prop>
68     <C:filter>
69         <C:comp-filter name="VCALENDAR">
70             <C:comp-filter name="VEVENT">
71                 <C:comp-filter name="VALARM">
72                     <C:time-range start="20120426T220000Z" end="20120427T215959Z"/>
73                 </C:comp-filter>
74             </C:comp-filter>
75         </C:comp-filter>
76     </C:filter>
77 </C:calendar-query>');
78
79         $response = $this->request($request);
80
81         // if this assert is reached, the endless loop is gone
82         // There should be no matching events
83         $this->assertFalse(strpos('BEGIN:VEVENT', $response->body));
84
85     }
86 }