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