25 'principaluri' =>
'principals/user2',
28 $caldavNS .
'calendar-timezone' =>
"BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nTZID:Europe/Berlin\r\nEND:VTIMEZONE\r\nEND:VCALENDAR",
31 'principaluri' =>
'principals/user2',
40 'calendardata' =>
'BEGIN:VCALENDAR 42 DTSTART:20110101T130000 50 'calendardata' =>
'BEGIN:VCALENDAR 52 DTSTART:20110101T080000 70 'CONTENT_TYPE' =>
'text/calendar',
72 $this->response =
new HTTP\ResponseMock();
79 $this->aclPlugin->allowUnauthenticatedAccess =
false;
80 $this->server->addPlugin($this->aclPlugin);
86 $this->authPlugin->beforeMethod($this->request, $this->response);
87 $this->server->addPlugin($this->authPlugin);
91 $this->server->addPlugin($this->plugin);
94 $this->plugin =
new Plugin();
95 $this->server->addPlugin($this->plugin);
101 $this->server->httpRequest =
new HTTP\Request(
103 '/calendars/user1/outbox',
104 [
'Content-Type' =>
'text/plain']
108 $this->plugin->httpPost($this->server->httpRequest, $this->server->httpResponse)
115 $this->server->httpRequest =
new HTTP\Request(
117 '/calendars/user1/blabla',
118 [
'Content-Type' =>
'text/calendar']
122 $this->plugin->httpPost($this->server->httpRequest, $this->server->httpResponse)
129 $this->server->httpRequest =
new HTTP\Request(
131 '/calendars/user1/inbox',
132 [
'Content-Type' =>
'text/calendar']
136 $this->plugin->httpPost($this->server->httpRequest, $this->server->httpResponse)
146 $this->server->httpRequest =
new HTTP\Request(
148 '/calendars/user1/outbox',
149 [
'Content-Type' =>
'text/calendar']
159 $this->server->httpRequest->setBody($body);
160 $this->plugin->httpPost($this->server->httpRequest, $this->server->httpResponse);
169 $this->server->httpRequest =
new HTTP\Request(
171 '/calendars/user1/outbox',
172 [
'Content-Type' =>
'text/calendar']
183 $this->server->httpRequest->setBody($body);
184 $this->plugin->httpPost($this->server->httpRequest, $this->server->httpResponse);
193 $this->server->httpRequest =
new HTTP\Request(
195 '/calendars/user1/outbox',
196 [
'Content-Type' =>
'text/calendar']
204 ORGANIZER:mailto:john@wayne.org
209 $this->server->httpRequest->setBody($body);
210 $this->plugin->httpPost($this->server->httpRequest, $this->server->httpResponse);
219 $this->server->httpRequest =
new HTTP\Request(
221 '/calendars/user1/outbox',
222 [
'Content-Type' =>
'text/calendar']
229 ORGANIZER:mailto:user1.sabredav@sabredav.org
234 $this->server->httpRequest->setBody($body);
235 $this->plugin->httpPost($this->server->httpRequest, $this->server->httpResponse);
244 $this->server->httpRequest =
new HTTP\Request(
246 '/calendars/user1/outbox',
247 [
'Content-Type' =>
'text/calendar']
254 ORGANIZER:mailto:user1.sabredav@sabredav.org
255 ATTENDEE:mailto:
user2.sabredav@sabredav.org
260 $this->server->httpRequest->setBody($body);
261 $this->plugin->httpPost($this->server->httpRequest, $this->server->httpResponse);
267 $this->server->httpRequest =
new HTTP\Request(
269 '/calendars/user1/outbox',
270 [
'Content-Type' =>
'text/calendar']
277 ORGANIZER:mailto:user1.sabredav@sabredav.org
278 ATTENDEE:mailto:
user2.sabredav@sabredav.org
279 ATTENDEE:mailto:user3.sabredav@sabredav.org
280 DTSTART:20110101T080000Z
281 DTEND:20110101T180000Z
286 $this->server->httpRequest->setBody($body);
289 $this->aclPlugin->adminPrincipals[] =
'principals/user1';
292 $this->plugin->httpPost($this->server->httpRequest, $this->response)
295 $this->assertEquals(200, $this->response->status);
296 $this->assertEquals([
297 'Content-Type' => [
'application/xml'],
298 ], $this->response->getHeaders());
301 '<d:href>mailto:user2.sabredav@sabredav.org</d:href>',
302 '<d:href>mailto:user3.sabredav@sabredav.org</d:href>',
303 '<cal:request-status>2.0;Success</cal:request-status>',
304 '<cal:request-status>3.7;Could not find principal</cal:request-status>',
305 'FREEBUSY:20110101T120000Z/20110101T130000Z',
308 foreach ($strings as $string) {
310 strpos($this->response->body, $string) !==
false,
311 'The response body did not contain: ' . $string .
'Full response: ' . $this->response->body
316 strpos($this->response->body,
'FREEBUSY;FBTYPE=BUSY:20110101T080000Z/20110101T090000Z') ==
false,
317 'The response body did contain free busy info from a transparent calendar.' 329 $this->caldavBackend->deleteCalendar(1);
330 $this->caldavBackend->deleteCalendar(2);
332 $this->server->httpRequest =
new HTTP\Request(
334 '/calendars/user1/outbox',
335 [
'Content-Type' =>
'text/calendar']
342 ORGANIZER:mailto:user1.sabredav@sabredav.org
343 ATTENDEE:mailto:
user2.sabredav@sabredav.org
344 DTSTART:20110101T080000Z
345 DTEND:20110101T180000Z
350 $this->server->httpRequest->setBody($body);
353 $this->aclPlugin->adminPrincipals[] =
'principals/user1';
356 $this->plugin->httpPost($this->server->httpRequest, $this->response)
359 $this->assertEquals(200, $this->response->status);
360 $this->assertEquals([
361 'Content-Type' => [
'application/xml'],
362 ], $this->response->getHeaders());
365 '<d:href>mailto:user2.sabredav@sabredav.org</d:href>',
366 '<cal:request-status>2.0;Success</cal:request-status>',
369 foreach ($strings as $string) {
371 strpos($this->response->body, $string) !==
false,
372 'The response body did not contain: ' . $string .
'Full response: ' . $this->response->body
380 $this->server->httpRequest =
new HTTP\Request(
382 '/calendars/user1/outbox',
383 [
'Content-Type' =>
'text/calendar']
390 ORGANIZER:mailto:user1.sabredav@sabredav.org
391 ATTENDEE:mailto:
user2.sabredav@sabredav.org
392 DTSTART:20110101T080000Z
393 DTEND:20110101T180000Z
398 $this->server->httpRequest->setBody($body);
401 $this->aclPlugin->adminPrincipals[] =
'principals/user1';
404 $this->server->on(
'propFind',
function(DAV\
PropFind $propFind) {
411 $this->plugin->httpPost($this->server->httpRequest, $this->response)
414 $this->assertEquals(200, $this->response->status);
415 $this->assertEquals([
416 'Content-Type' => [
'application/xml'],
417 ], $this->response->getHeaders());
420 '<d:href>mailto:user2.sabredav@sabredav.org</d:href>',
421 '<cal:request-status>3.7;No calendar-home-set property found</cal:request-status>',
424 foreach ($strings as $string) {
426 strpos($this->response->body, $string) !==
false,
427 'The response body did not contain: ' . $string .
'Full response: ' . $this->response->body
435 $this->server->httpRequest =
new HTTP\Request(
437 '/calendars/user1/outbox',
438 [
'Content-Type' =>
'text/calendar']
445 ORGANIZER:mailto:user1.sabredav@sabredav.org
446 ATTENDEE:mailto:
user2.sabredav@sabredav.org
447 DTSTART:20110101T080000Z
448 DTEND:20110101T180000Z
453 $this->server->httpRequest->setBody($body);
456 $this->aclPlugin->adminPrincipals[] =
'principals/user1';
459 $this->server->on(
'propFind',
function(DAV\
PropFind $propFind) {
466 $this->plugin->httpPost($this->server->httpRequest, $this->response)
469 $this->assertEquals(200, $this->response->status);
470 $this->assertEquals([
471 'Content-Type' => [
'application/xml'],
472 ], $this->response->getHeaders());
475 '<d:href>mailto:user2.sabredav@sabredav.org</d:href>',
476 '<cal:request-status>3.7;No schedule-inbox-URL property found</cal:request-status>',
479 foreach ($strings as $string) {
481 strpos($this->response->body, $string) !==
false,
482 'The response body did not contain: ' . $string .
'Full response: ' . $this->response->body
490 $this->server->httpRequest =
new HTTP\Request(
492 '/calendars/user1/outbox',
493 [
'Content-Type' =>
'text/calendar']
500 ORGANIZER:mailto:user1.sabredav@sabredav.org
501 ATTENDEE:mailto:
user2.sabredav@sabredav.org
502 DTSTART:20110101T080000Z
503 DTEND:20110101T180000Z
508 $this->server->httpRequest->setBody($body);
511 $this->aclPlugin->adminPrincipals[] =
'principals/user1';
514 $this->server->on(
'propFind',
function(DAV\
PropFind $propFind) {
516 $propFind->handle(
'{' .
Plugin::NS_CALDAV .
'}calendar-availability',
function() {
521 DTSTART:20110101T000000Z
522 DTEND:20110102T000000Z
524 DTSTART:20110101T090000Z
525 DTEND:20110101T170000Z
537 $this->plugin->httpPost($this->server->httpRequest, $this->response)
540 $this->assertEquals(200, $this->response->status);
541 $this->assertEquals([
542 'Content-Type' => [
'application/xml'],
543 ], $this->response->getHeaders());
546 '<d:href>mailto:user2.sabredav@sabredav.org</d:href>',
547 '<cal:request-status>2.0;Success</cal:request-status>',
548 'FREEBUSY;FBTYPE=BUSY-UNAVAILABLE:20110101T080000Z/20110101T090000Z',
549 'FREEBUSY:20110101T120000Z/20110101T130000Z',
550 'FREEBUSY;FBTYPE=BUSY-UNAVAILABLE:20110101T170000Z/20110101T180000Z',
553 foreach ($strings as $string) {
555 strpos($this->response->body, $string) !==
false,
556 'The response body did not contain: ' . $string .
'Full response: ' . $this->response->body
This plugin provides Authentication for a WebDAV server.
testNoCalendarHomeFound()
This class holds all the information about a PROPFIND request.
schedule-calendar-transp property.
testIncorrectOrganizer()
Sabre
testSucceedNoCalendars()
Testing if the freebusy request still works, even if there are no calendars in the target users' acco...
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
const NS_CALDAV
This is the official CalDAV namespace.
testSucceedUseVAVAILABILITY()