4 * This unittest is created to check if a VALARM TRIGGER of PT0S is supported
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
11 class Sabre_CalDAV_Issue205Test extends Sabre_DAVServerTest {
13 protected $setupCalDAV = true;
15 protected $caldavCalendars = array(
19 'principaluri' => 'principals/user1',
24 protected $caldavCalendarObjects = array(
27 'calendardata' => 'BEGIN:VCALENDAR
30 UID:20120330T155305CEST-6585fBUVgV
31 DTSTAMP:20120330T135305Z
32 DTSTART;TZID=Europe/Berlin:20120326T155200
33 DTEND;TZID=Europe/Berlin:20120326T165200
34 SUMMARY:original summary
38 ATTACH;VALUE=URI:Basso
48 function testIssue205() {
50 $request = new Sabre_HTTP_Request(array(
51 'REQUEST_METHOD' => 'REPORT',
52 'HTTP_CONTENT_TYPE' => 'application/xml',
53 'REQUEST_URI' => '/calendars/user1/calendar1',
57 $request->setBody('<?xml version="1.0" encoding="utf-8" ?>
58 <C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
61 <C:expand start="20120325T220000Z" end="20120401T215959Z"/>
66 <C:comp-filter name="VCALENDAR">
67 <C:comp-filter name="VEVENT">
68 <C:comp-filter name="VALARM">
69 <C:time-range start="20120325T220000Z" end="20120401T215959Z"/>
74 </C:calendar-query>');
76 $response = $this->request($request);
78 $this->assertFalse(strpos($response->body, '<s:exception>Exception</s:exception>'), 'Exception occurred: ' . $response->body);
79 $this->assertFalse(strpos($response->body, 'Unknown or bad format'), 'DateTime unknown format Exception: ' . $response->body);
81 // Everts super awesome xml parser.
84 $start = strpos($response->body, 'BEGIN:VCALENDAR'),
85 strpos($response->body, 'END:VCALENDAR') - $start + 13
87 $body = str_replace(' ','',$body);
89 $vObject = Sabre_VObject_Reader::read($body);
91 $this->assertEquals(1, count($vObject->VEVENT));