16 'principaluri' =>
'principals/user1',
25 'calendardata' =>
"BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n",
26 'lastmodified' => null
34 'Accept' =>
'application/calendar+json',
36 $request =
new Request(
'GET',
'/calendars/user1/foo/bar.ics', $headers);
41 $this->assertEquals(200,
$response->getStatus(),
"Incorrect status code: " . $body);
44 if (json_last_error() !== JSON_ERROR_NONE) {
45 $this->fail(
'Json decoding error: ' . json_last_error_msg());
68 <c:calendar-multiget xmlns:c=
"urn:ietf:params:xml:ns:caldav" xmlns:d=
"DAV:">
70 <c:calendar-
data content-type=
"application/calendar+json" />
72 <d:href>/calendars/user1/foo/bar.ics</d:href>
73 </c:calendar-multiget>
81 $this->assertEquals(207,
$response->getStatus(),
'Full rsponse: ' .
$response->getBodyAsString());
83 $multiStatus = $this->server->xml->parse(
87 $responses = $multiStatus->getResponses();
88 $this->assertEquals(1, count($responses));
90 $response = $responses[0]->getResponseProperties()[200][
"{urn:ietf:params:xml:ns:caldav}calendar-data"];
92 $jresponse = json_decode(
$response,
true);
93 if (json_last_error()) {
94 $this->fail(
'Json decoding error: ' . json_last_error_msg() .
'. Full response: ' .
$response);
116 <?xml version=
"1.0"?>
117 <c:calendar-query xmlns:c=
"urn:ietf:params:xml:ns:caldav" xmlns:d=
"DAV:">
119 <c:calendar-
data content-type=
"application/calendar+json" />
122 <c:comp-filter name=
"VCALENDAR" />
134 $this->assertEquals(207,
$response->getStatus(),
"Invalid response code. Full body: " .
$response->getBodyAsString());
136 $multiStatus = $this->server->xml->parse(
140 $responses = $multiStatus->getResponses();
142 $this->assertEquals(1, count($responses));
144 $response = $responses[0]->getResponseProperties()[200][
"{urn:ietf:params:xml:ns:caldav}calendar-data"];
146 if (json_last_error()) {
147 $this->fail(
'Json decoding error: ' . json_last_error_msg());
169 <?xml version=
"1.0"?>
170 <c:calendar-query xmlns:c=
"urn:ietf:params:xml:ns:caldav" xmlns:d=
"DAV:">
172 <c:calendar-
data content-type=
"application/calendar+json" />
175 <c:comp-filter name=
"VCALENDAR" />
187 $this->assertEquals(207,
$response->getStatus(),
"Invalid response code. Full body: " .
$response->getBodyAsString());
189 $multiStatus = $this->server->xml->parse(
193 $responses = $multiStatus->getResponses();
195 $this->assertEquals(1, count($responses));
197 $response = $responses[0]->getResponseProperties()[200][
"{urn:ietf:params:xml:ns:caldav}calendar-data"];
199 if (json_last_error()) {
200 $this->fail(
'Json decoding error: ' . json_last_error_msg());
228 [
'uid', (object)[],
'text',
'foo'],
229 [
'dtstart', (
object)[],
'date',
'2016-04-06'],
236 $this->caldavPlugin->beforeWriteContent(
237 'calendars/user1/foo/bar.ics',
238 $this->server->tree->getNodeForPath(
'calendars/user1/foo/bar.ics'),
249 DTSTART;VALUE=DATE:20160406
255 $this->assertVObjectEqualsVObject(
foreach($paths as $path) $request
The Request class represents a single HTTP request.
This class may be used as a basis for other webdav-related unittests.
request($request, $expectedStatus=null)
Makes a request, and returns a response object.