4 * This unittests is created to find out why certain events show up twice.
6 * Hopefully, by the time I'm done with this, I've both found the problem, and
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_ExpandEventsDoubleEventsTest extends Sabre_DAVServerTest {
15 protected $setupCalDAV = true;
17 protected $caldavCalendars = array(
21 'principaluri' => 'principals/user1',
26 protected $caldavCalendarObjects = array(
29 'calendardata' => 'BEGIN:VCALENDAR
33 DTEND;TZID=Europe/Berlin:20120207T191500
34 RRULE:FREQ=DAILY;INTERVAL=1;COUNT=3
35 SUMMARY:RecurringEvents 3 times
36 DTSTART;TZID=Europe/Berlin:20120207T181500
39 CREATED:20120207T111900Z
41 DTEND;TZID=Europe/Berlin:20120208T191500
42 SUMMARY:RecurringEvents 3 times OVERWRITTEN
43 DTSTART;TZID=Europe/Berlin:20120208T181500
44 RECURRENCE-ID;TZID=Europe/Berlin:20120208T181500
52 function testExpand() {
54 $request = new Sabre_HTTP_Request(array(
55 'REQUEST_METHOD' => 'REPORT',
56 'HTTP_CONTENT_TYPE' => 'application/xml',
57 'REQUEST_URI' => '/calendars/user1/calendar1',
61 $request->setBody('<?xml version="1.0" encoding="utf-8" ?>
62 <C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
65 <C:expand start="20120205T230000Z" end="20120212T225959Z"/>
70 <C:comp-filter name="VCALENDAR">
71 <C:comp-filter name="VEVENT">
72 <C:time-range start="20120205T230000Z" end="20120212T225959Z"/>
76 </C:calendar-query>');
78 $response = $this->request($request);
80 // Everts super awesome xml parser.
83 $start = strpos($response->body, 'BEGIN:VCALENDAR'),
84 strpos($response->body, 'END:VCALENDAR') - $start + 13
86 $body = str_replace(' ','',$body);
88 $vObject = Sabre_VObject_Reader::read($body);
90 // We only expect 3 events
91 $this->assertEquals(3, count($vObject->VEVENT),'We got 6 events instead of 3. Output: ' . $body);
93 // TZID should be gone
94 $this->assertFalse(isset($vObject->VEVENT->DTSTART['TZID']));