4 * This unittest is created to find out why an overwritten DAILY event has wrong DTSTART, DTEND, SUMMARY and RECURRENCEID
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_Issue203Test 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 RRULE:FREQ=DAILY;COUNT=2;INTERVAL=1
35 SUMMARY:original summary
39 UID:20120330T155305CEST-6585fBUVgV
40 DTSTAMP:20120330T135352Z
42 DTSTART;TZID=Europe/Berlin:20120328T155200
43 DTEND;TZID=Europe/Berlin:20120328T165200
44 RECURRENCE-ID;TZID=Europe/Berlin:20120327T155200
46 SUMMARY:overwritten summary
55 function testIssue203() {
57 $request = new Sabre_HTTP_Request(array(
58 'REQUEST_METHOD' => 'REPORT',
59 'HTTP_CONTENT_TYPE' => 'application/xml',
60 'REQUEST_URI' => '/calendars/user1/calendar1',
64 $request->setBody('<?xml version="1.0" encoding="utf-8" ?>
65 <C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
68 <C:expand start="20120325T220000Z" end="20120401T215959Z"/>
73 <C:comp-filter name="VCALENDAR">
74 <C:comp-filter name="VEVENT">
75 <C:time-range start="20120325T220000Z" end="20120401T215959Z"/>
79 </C:calendar-query>');
81 $response = $this->request($request);
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 = Sabre_VObject_Reader::read($body);
93 $this->assertEquals(2, count($vObject->VEVENT));
96 $expectedEvents = array(
98 'DTSTART' => '20120326T135200Z',
99 'DTEND' => '20120326T145200Z',
100 'SUMMARY' => 'original summary',
103 'DTSTART' => '20120328T135200Z',
104 'DTEND' => '20120328T145200Z',
105 'SUMMARY' => 'overwritten summary',
106 'RECURRENCE-ID' => '20120327T135200Z',
110 // try to match agains $expectedEvents array
111 foreach ($expectedEvents as $expectedEvent) {
115 foreach ($vObject->VEVENT as $vevent) {
116 /** @var $vevent Sabre_VObject_Component_VEvent */
118 foreach ($vevent->children as $child) {
119 /** @var $child Sabre_VObject_Property */
121 if (isset($expectedEvent[$child->name])) {
122 if ($expectedEvent[$child->name] != $child->value) {
132 $this->assertTrue($matching, 'Did not find the following event in the response: '.var_export($expectedEvent, true));