xref: /plugin/davcal/vendor/sabre/dav/tests/Sabre/CalDAV/Issue220Test.php (revision a1a3b6794e0e143a4a8b51d3185ce2d339be61ab)
1*a1a3b679SAndreas Boehler<?php
2*a1a3b679SAndreas Boehler
3*a1a3b679SAndreas Boehlernamespace Sabre\CalDAV;
4*a1a3b679SAndreas Boehler
5*a1a3b679SAndreas Boehleruse Sabre\HTTP;
6*a1a3b679SAndreas Boehler
7*a1a3b679SAndreas Boehler/**
8*a1a3b679SAndreas Boehler * This unittest is created to check for an endless loop in CalendarQueryValidator
9*a1a3b679SAndreas Boehler *
10*a1a3b679SAndreas Boehler * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
11*a1a3b679SAndreas Boehler * @author Evert Pot (http://evertpot.com/)
12*a1a3b679SAndreas Boehler * @license http://sabre.io/license/ Modified BSD License
13*a1a3b679SAndreas Boehler */
14*a1a3b679SAndreas Boehlerclass Issue220Test extends \Sabre\DAVServerTest {
15*a1a3b679SAndreas Boehler
16*a1a3b679SAndreas Boehler    protected $setupCalDAV = true;
17*a1a3b679SAndreas Boehler
18*a1a3b679SAndreas Boehler    protected $caldavCalendars = array(
19*a1a3b679SAndreas Boehler        array(
20*a1a3b679SAndreas Boehler            'id' => 1,
21*a1a3b679SAndreas Boehler            'name' => 'Calendar',
22*a1a3b679SAndreas Boehler            'principaluri' => 'principals/user1',
23*a1a3b679SAndreas Boehler            'uri' => 'calendar1',
24*a1a3b679SAndreas Boehler        )
25*a1a3b679SAndreas Boehler    );
26*a1a3b679SAndreas Boehler
27*a1a3b679SAndreas Boehler    protected $caldavCalendarObjects = array(
28*a1a3b679SAndreas Boehler        1 => array(
29*a1a3b679SAndreas Boehler            'event.ics' => array(
30*a1a3b679SAndreas Boehler                'calendardata' => 'BEGIN:VCALENDAR
31*a1a3b679SAndreas BoehlerVERSION:2.0
32*a1a3b679SAndreas BoehlerBEGIN:VEVENT
33*a1a3b679SAndreas BoehlerDTSTART;TZID=Europe/Berlin:20120601T180000
34*a1a3b679SAndreas BoehlerSUMMARY:Brot backen
35*a1a3b679SAndreas BoehlerRRULE:FREQ=DAILY;INTERVAL=1;WKST=MO
36*a1a3b679SAndreas BoehlerTRANSP:OPAQUE
37*a1a3b679SAndreas BoehlerDURATION:PT20M
38*a1a3b679SAndreas BoehlerLAST-MODIFIED:20120601T064634Z
39*a1a3b679SAndreas BoehlerCREATED:20120601T064634Z
40*a1a3b679SAndreas BoehlerDTSTAMP:20120601T064634Z
41*a1a3b679SAndreas BoehlerUID:b64f14c5-dccc-4eda-947f-bdb1f763fbcd
42*a1a3b679SAndreas BoehlerBEGIN:VALARM
43*a1a3b679SAndreas BoehlerTRIGGER;VALUE=DURATION:-PT5M
44*a1a3b679SAndreas BoehlerACTION:DISPLAY
45*a1a3b679SAndreas BoehlerDESCRIPTION:Default Event Notification
46*a1a3b679SAndreas BoehlerX-WR-ALARMUID:cd952c1b-b3d6-41fb-b0a6-ec3a1a5bdd58
47*a1a3b679SAndreas BoehlerEND:VALARM
48*a1a3b679SAndreas BoehlerEND:VEVENT
49*a1a3b679SAndreas BoehlerBEGIN:VEVENT
50*a1a3b679SAndreas BoehlerDTSTART;TZID=Europe/Berlin:20120606T180000
51*a1a3b679SAndreas BoehlerSUMMARY:Brot backen
52*a1a3b679SAndreas BoehlerTRANSP:OPAQUE
53*a1a3b679SAndreas BoehlerSTATUS:CANCELLED
54*a1a3b679SAndreas BoehlerDTEND;TZID=Europe/Berlin:20120606T182000
55*a1a3b679SAndreas BoehlerLAST-MODIFIED:20120605T094310Z
56*a1a3b679SAndreas BoehlerSEQUENCE:1
57*a1a3b679SAndreas BoehlerRECURRENCE-ID:20120606T160000Z
58*a1a3b679SAndreas BoehlerUID:b64f14c5-dccc-4eda-947f-bdb1f763fbcd
59*a1a3b679SAndreas BoehlerEND:VEVENT
60*a1a3b679SAndreas BoehlerEND:VCALENDAR
61*a1a3b679SAndreas Boehler',
62*a1a3b679SAndreas Boehler            ),
63*a1a3b679SAndreas Boehler        ),
64*a1a3b679SAndreas Boehler    );
65*a1a3b679SAndreas Boehler
66*a1a3b679SAndreas Boehler    function testIssue220() {
67*a1a3b679SAndreas Boehler
68*a1a3b679SAndreas Boehler        $request = HTTP\Sapi::createFromServerArray(array(
69*a1a3b679SAndreas Boehler            'REQUEST_METHOD' => 'REPORT',
70*a1a3b679SAndreas Boehler            'HTTP_CONTENT_TYPE' => 'application/xml',
71*a1a3b679SAndreas Boehler            'REQUEST_URI' => '/calendars/user1/calendar1',
72*a1a3b679SAndreas Boehler            'HTTP_DEPTH' => '1',
73*a1a3b679SAndreas Boehler        ));
74*a1a3b679SAndreas Boehler
75*a1a3b679SAndreas Boehler        $request->setBody('<?xml version="1.0" encoding="utf-8" ?>
76*a1a3b679SAndreas Boehler<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
77*a1a3b679SAndreas Boehler    <D:prop>
78*a1a3b679SAndreas Boehler        <C:calendar-data/>
79*a1a3b679SAndreas Boehler        <D:getetag/>
80*a1a3b679SAndreas Boehler    </D:prop>
81*a1a3b679SAndreas Boehler    <C:filter>
82*a1a3b679SAndreas Boehler        <C:comp-filter name="VCALENDAR">
83*a1a3b679SAndreas Boehler            <C:comp-filter name="VEVENT">
84*a1a3b679SAndreas Boehler                <C:comp-filter name="VALARM">
85*a1a3b679SAndreas Boehler                    <C:time-range start="20120607T161646Z" end="20120612T161646Z"/>
86*a1a3b679SAndreas Boehler                </C:comp-filter>
87*a1a3b679SAndreas Boehler            </C:comp-filter>
88*a1a3b679SAndreas Boehler        </C:comp-filter>
89*a1a3b679SAndreas Boehler    </C:filter>
90*a1a3b679SAndreas Boehler</C:calendar-query>');
91*a1a3b679SAndreas Boehler
92*a1a3b679SAndreas Boehler        $response = $this->request($request);
93*a1a3b679SAndreas Boehler
94*a1a3b679SAndreas Boehler        $this->assertFalse(strpos($response->body, '<s:exception>PHPUnit_Framework_Error_Warning</s:exception>'), 'Error Warning occurred: ' . $response->body);
95*a1a3b679SAndreas Boehler        $this->assertFalse(strpos($response->body, 'Invalid argument supplied for foreach()'), 'Invalid argument supplied for foreach(): ' . $response->body);
96*a1a3b679SAndreas Boehler
97*a1a3b679SAndreas Boehler        $this->assertEquals(207, $response->status);
98*a1a3b679SAndreas Boehler    }
99*a1a3b679SAndreas Boehler}
100