6 * This unittests is created to find out why certain events show up twice.
8 * Hopefully, by the time I'm done with this, I've both found the problem, and
11 * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
12 * @author Evert Pot (http://www.rooftopsolutions.nl/)
13 * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
15 class Sabre_CalDAV_ExpandEventsDoubleEventsTest extends Sabre_DAVServerTest {
17 protected $setupCalDAV = true;
19 protected $caldavCalendars = array(
23 'principaluri' => 'principals/user1',
28 protected $caldavCalendarObjects = array(
31 'calendardata' => 'BEGIN:VCALENDAR
35 DTEND;TZID=Europe/Berlin:20120207T191500
36 RRULE:FREQ=DAILY;INTERVAL=1;COUNT=3
37 SUMMARY:RecurringEvents 3 times
38 DTSTART;TZID=Europe/Berlin:20120207T181500
41 CREATED:20120207T111900Z
43 DTEND;TZID=Europe/Berlin:20120208T191500
44 SUMMARY:RecurringEvents 3 times OVERWRITTEN
45 DTSTART;TZID=Europe/Berlin:20120208T181500
46 RECURRENCE-ID;TZID=Europe/Berlin:20120208T181500
54 function testExpand() {
56 $request = new Sabre_HTTP_Request(array(
57 'REQUEST_METHOD' => 'REPORT',
58 'HTTP_CONTENT_TYPE' => 'application/xml',
59 'REQUEST_URI' => '/calendars/user1/calendar1',
63 $request->setBody('<?xml version="1.0" encoding="utf-8" ?>
64 <C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
67 <C:expand start="20120205T230000Z" end="20120212T225959Z"/>
72 <C:comp-filter name="VCALENDAR">
73 <C:comp-filter name="VEVENT">
74 <C:time-range start="20120205T230000Z" end="20120212T225959Z"/>
78 </C:calendar-query>');
80 $response = $this->request($request);
82 // Everts super awesome xml parser.
85 $start = strpos($response->body, 'BEGIN:VCALENDAR'),
86 strpos($response->body, 'END:VCALENDAR') - $start + 13
88 $body = str_replace(' ','',$body);
90 $vObject = VObject\Reader::read($body);
92 // We only expect 3 events
93 $this->assertEquals(3, count($vObject->VEVENT),'We got 6 events instead of 3. Output: ' . $body);
95 // TZID should be gone
96 $this->assertFalse(isset($vObject->VEVENT->DTSTART['TZID']));