22 'principaluri' =>
'principals/user1',
24 '{urn:ietf:params:xml:ns:caldav}calendar-timezone' =>
'BEGIN:VCALENDAR 31 RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU 32 DTSTART:19810329T020000 38 RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU 39 DTSTART:19961027T030000 51 'calendardata' =>
'BEGIN:VCALENDAR 55 CREATED:20140701T143658Z 56 UID:dba46fe8-1631-4d98-a575-97963c364dfe 59 SUMMARY:Floating Time event, starting 05:30am Europe/Berlin 60 DTSTART:20141108T053000 61 DTSTAMP:20140701T143706Z 70 function testExpandCalendarQuery() {
72 $request =
new HTTP\Request(
'REPORT',
'/calendars/user1/calendar1', [
74 'Content-Type' =>
'application/xml',
77 $request->setBody(
'<?xml version="1.0" encoding="utf-8" ?> 78 <C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> 81 <C:expand start="20141107T230000Z" end="20141108T225959Z"/> 86 <C:comp-filter name="VCALENDAR"> 87 <C:comp-filter name="VEVENT"> 88 <C:time-range start="20141107T230000Z" end="20141108T225959Z"/> 92 </C:calendar-query>');
102 $body = str_replace(
' ',
'', $body);
107 foreach ($vObject->VEVENT as $vevent) {
109 foreach ($vevent->children() as $child) {
111 if ($child->name ==
'DTSTART') {
113 $this->assertEquals(
'20141108T043000Z', $child->getValue());
114 } elseif ($child->name ==
'DTEND') {
116 $this->assertEquals(
'20141108T063000Z', $child->getValue());
122 function testExpandMultiGet() {
124 $request =
new HTTP\Request(
'REPORT',
'/calendars/user1/calendar1', [
126 'Content-Type' =>
'application/xml',
129 $request->setBody(
'<?xml version="1.0" encoding="utf-8" ?> 130 <C:calendar-multiget xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> 133 <C:expand start="20141107T230000Z" end="20141108T225959Z"/> 137 <D:href>/calendars/user1/calendar1/event.ics</D:href> 138 </C:calendar-multiget>');
142 $this->assertEquals(207,
$response->getStatus());
150 $body = str_replace(
' ',
'', $body);
155 foreach ($vObject->VEVENT as $vevent) {
157 foreach ($vevent->children() as $child) {
159 if ($child->name ==
'DTSTART') {
161 $this->assertEquals($child->getValue(),
'20141108T043000Z');
162 } elseif ($child->name ==
'DTEND') {
164 $this->assertEquals($child->getValue(),
'20141108T063000Z');
170 function testExpandExport() {
172 $request =
new HTTP\Request(
'GET',
'/calendars/user1/calendar1?export&start=1&end=2000000000&expand=1', [
174 'Content-Type' =>
'application/xml',
179 $this->assertEquals(200,
$response->getStatus());
187 $body = str_replace(
' ',
'', $body);
192 foreach ($vObject->VEVENT as $vevent) {
194 foreach ($vevent->children() as $child) {
196 if ($child->name ==
'DTSTART') {
198 $this->assertEquals(
'20141108T043000Z', $child->getValue());
199 } elseif ($child->name ==
'DTEND') {
201 $this->assertEquals(
'20141108T063000Z', $child->getValue());
foreach($paths as $path) $request
This class may be used as a basis for other webdav-related unittests.
This unittest is created to check if expand() works correctly with floating times (using calendar-tim...
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
request($request, $expectedStatus=null)
Makes a request, and returns a response object.