6 * This unittest is created to check if a VALARM TRIGGER of PT0S is supported
9 * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
10 * @author Evert Pot (http://www.rooftopsolutions.nl/)
11 * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
13 class Sabre_CalDAV_Issue205Test extends Sabre_DAVServerTest {
15 protected $setupCalDAV = true;
17 protected $caldavCalendars = array(
21 'principaluri' => 'principals/user1',
26 protected $caldavCalendarObjects = array(
29 'calendardata' => 'BEGIN:VCALENDAR
32 UID:20120330T155305CEST-6585fBUVgV
33 DTSTAMP:20120330T135305Z
34 DTSTART;TZID=Europe/Berlin:20120326T155200
35 DTEND;TZID=Europe/Berlin:20120326T165200
36 SUMMARY:original summary
40 ATTACH;VALUE=URI:Basso
50 function testIssue205() {
52 $request = new Sabre_HTTP_Request(array(
53 'REQUEST_METHOD' => 'REPORT',
54 'HTTP_CONTENT_TYPE' => 'application/xml',
55 'REQUEST_URI' => '/calendars/user1/calendar1',
59 $request->setBody('<?xml version="1.0" encoding="utf-8" ?>
60 <C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
63 <C:expand start="20120325T220000Z" end="20120401T215959Z"/>
68 <C:comp-filter name="VCALENDAR">
69 <C:comp-filter name="VEVENT">
70 <C:comp-filter name="VALARM">
71 <C:time-range start="20120325T220000Z" end="20120401T215959Z"/>
76 </C:calendar-query>');
78 $response = $this->request($request);
80 $this->assertFalse(strpos($response->body, '<s:exception>Exception</s:exception>'), 'Exception occurred: ' . $response->body);
81 $this->assertFalse(strpos($response->body, 'Unknown or bad format'), 'DateTime unknown format Exception: ' . $response->body);
83 // Everts super awesome xml parser.
86 $start = strpos($response->body, 'BEGIN:VCALENDAR'),
87 strpos($response->body, 'END:VCALENDAR') - $start + 13
89 $body = str_replace(' ','',$body);
91 $vObject = VObject\Reader::read($body);
93 $this->assertEquals(1, count($vObject->VEVENT));