29        $caldavNS = 
'{urn:ietf:params:xml:ns:caldav}';
 
   34                'uri'                                          => 
'UUID-123467',
 
   35                'principaluri'                                 => 
'principals/user1',
 
   36                '{DAV:}displayname'                            => 
'user1 calendar',
 
   37                $caldavNS . 
'calendar-description'             => 
'Calendar description',
 
   38                '{http://apple.com/ns/ical/}calendar-order'    => 
'1',
 
   39                '{http://apple.com/ns/ical/}calendar-color'    => 
'#FF0000',
 
   40                $caldavNS . 
'supported-calendar-component-set' => 
new Xml\
Property\SupportedCalendarComponentSet([
'VEVENT', 
'VTODO']),
 
   44                'uri'                                          => 
'UUID-123468',
 
   45                'principaluri'                                 => 
'principals/user1',
 
   46                '{DAV:}displayname'                            => 
'user1 calendar2',
 
   47                $caldavNS . 
'calendar-description'             => 
'Calendar description',
 
   48                '{http://apple.com/ns/ical/}calendar-order'    => 
'1',
 
   49                '{http://apple.com/ns/ical/}calendar-color'    => 
'#FF0000',
 
   50                $caldavNS . 
'supported-calendar-component-set' => 
new Xml\
Property\SupportedCalendarComponentSet([
'VEVENT', 
'VTODO']),
 
   60        $principalBackend->setGroupMemberSet(
'principals/admin/calendar-proxy-read', [
'principals/user1']);
 
   61        $principalBackend->setGroupMemberSet(
'principals/admin/calendar-proxy-write', [
'principals/user1']);
 
   63            'uri' => 
'principals/admin/calendar-proxy-read',
 
   66            'uri' => 
'principals/admin/calendar-proxy-write',
 
   73        $root->addChild($calendars);
 
   74        $root->addChild($principals);
 
   77        $this->server->sapi = 
new HTTP\SapiMock();
 
   78        $this->server->debugExceptions = 
true;
 
   79        $this->server->setBaseUri(
'/');
 
   80        $this->plugin = 
new Plugin();
 
   81        $this->server->addPlugin($this->plugin);
 
   85        $aclPlugin->allowUnauthenticatedAccess = 
false;
 
   98        $this->response = 
new HTTP\ResponseMock();
 
  105        $this->assertEquals([
'MKCALENDAR'], $this->plugin->getHTTPMethods(
'calendars/user1/randomnewcalendar'));
 
  106        $this->assertEquals([
'calendar-access', 
'calendar-proxy'], $this->plugin->getFeatures());
 
  109            $this->plugin->getPluginInfo()[
'name']
 
  116        $request = 
new HTTP\Request(
'MKBREAKFAST', 
'/');
 
  118        $this->server->httpRequest = 
$request;
 
  119        $this->server->exec();
 
  121        $this->assertEquals(501, $this->response->status, 
'Incorrect status returned. Full response body:' . $this->response->body);
 
  127        $request = 
new HTTP\Request(
'REPORT', 
'/', [
'Content-Type' => 
'application/xml']);
 
  128        $request->setBody(
'<?xml version="1.0"?><s:somereport xmlns:s="http://www.rooftopsolutions.nl/NS/example" />');
 
  130        $this->server->httpRequest = 
$request;
 
  131        $this->server->exec();
 
  133        $this->assertEquals(415, $this->response->status);
 
  139        $request = 
new HTTP\Request(
'MKCALENDAR', 
'/blabla');
 
  141        $body = 
'<?xml version="1.0" encoding="utf-8" ?> 
  142   <C:mkcalendar xmlns:D="DAV:" 
  143                 xmlns:C="urn:ietf:params:xml:ns:caldav"> 
  146         <D:displayname>Lisa\'s Events</D:displayname> 
  147         <C:calendar-description xml:lang="en" 
  148   >Calendar restricted to events.</C:calendar-description> 
  149         <C:supported-calendar-component-set> 
  150           <C:comp name="VEVENT"/> 
  151         </C:supported-calendar-component-set> 
  152         <C:calendar-timezone><![CDATA[BEGIN:VCALENDAR 
  153   PRODID:-//Example Corp.//CalDAV Client//EN 
  157   LAST-MODIFIED:19870101T000000Z 
  159   DTSTART:19671029T020000 
  160   RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 
  163   TZNAME:Eastern Standard Time (US & Canada) 
  166   DTSTART:19870405T020000 
  167   RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 
  170   TZNAME:Eastern Daylight Time (US & Canada) 
  174   ]]></C:calendar-timezone> 
  180        $this->server->httpRequest = 
$request;
 
  181        $this->server->exec();
 
  183        $this->assertEquals(403, $this->response->status);
 
  189        $request = 
new HTTP\Request(
'MKCALENDAR', 
'/doesntexist/calendar');
 
  191        $body = 
'<?xml version="1.0" encoding="utf-8" ?> 
  192   <C:mkcalendar xmlns:D="DAV:" 
  193                 xmlns:C="urn:ietf:params:xml:ns:caldav"> 
  196         <D:displayname>Lisa\'s Events</D:displayname> 
  197         <C:calendar-description xml:lang="en" 
  198   >Calendar restricted to events.</C:calendar-description> 
  199         <C:supported-calendar-component-set> 
  200           <C:comp name="VEVENT"/> 
  201         </C:supported-calendar-component-set> 
  202         <C:calendar-timezone><![CDATA[BEGIN:VCALENDAR 
  203   PRODID:-//Example Corp.//CalDAV Client//EN 
  207   LAST-MODIFIED:19870101T000000Z 
  209   DTSTART:19671029T020000 
  210   RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 
  213   TZNAME:Eastern Standard Time (US & Canada) 
  216   DTSTART:19870405T020000 
  217   RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 
  220   TZNAME:Eastern Daylight Time (US & Canada) 
  224   ]]></C:calendar-timezone> 
  230        $this->server->httpRequest = 
$request;
 
  231        $this->server->exec();
 
  233        $this->assertEquals(409, $this->response->status);
 
  240            'REQUEST_METHOD' => 
'MKCALENDAR',
 
  241            'REQUEST_URI'    => 
'/calendars/user1/UUID-123467',
 
  244        $body = 
'<?xml version="1.0" encoding="utf-8" ?> 
  245   <C:mkcalendar xmlns:D="DAV:" 
  246                 xmlns:C="urn:ietf:params:xml:ns:caldav"> 
  249         <D:displayname>Lisa\'s Events</D:displayname> 
  250         <C:calendar-description xml:lang="en" 
  251   >Calendar restricted to events.</C:calendar-description> 
  252         <C:supported-calendar-component-set> 
  253           <C:comp name="VEVENT"/> 
  254         </C:supported-calendar-component-set> 
  255         <C:calendar-timezone><![CDATA[BEGIN:VCALENDAR 
  256   PRODID:-//Example Corp.//CalDAV Client//EN 
  260   LAST-MODIFIED:19870101T000000Z 
  262   DTSTART:19671029T020000 
  263   RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 
  266   TZNAME:Eastern Standard Time (US & Canada) 
  269   DTSTART:19870405T020000 
  270   RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 
  273   TZNAME:Eastern Daylight Time (US & Canada) 
  277   ]]></C:calendar-timezone> 
  283        $this->server->httpRequest = 
$request;
 
  284        $this->server->exec();
 
  286        $this->assertEquals(405, $this->response->status);
 
  292        $request = 
new HTTP\Request(
'MKCALENDAR', 
'/calendars/user1/NEWCALENDAR');
 
  294        $timezone = 
'BEGIN:VCALENDAR 
  295PRODID:-//Example Corp.//CalDAV Client//EN 
  299LAST-MODIFIED:19870101T000000Z 
  301DTSTART:19671029T020000 
  302RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 
  305TZNAME:Eastern Standard Time (US & Canada) 
  308DTSTART:19870405T020000 
  309RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 
  312TZNAME:Eastern Daylight Time (US & Canada) 
  317        $body = 
'<?xml version="1.0" encoding="utf-8" ?> 
  318   <C:mkcalendar xmlns:D="DAV:" 
  319                 xmlns:C="urn:ietf:params:xml:ns:caldav"> 
  322         <D:displayname>Lisa\'s Events</D:displayname> 
  323         <C:calendar-description xml:lang="en" 
  324   >Calendar restricted to events.</C:calendar-description> 
  325         <C:supported-calendar-component-set> 
  326           <C:comp name="VEVENT"/> 
  327         </C:supported-calendar-component-set> 
  328         <C:calendar-timezone><![CDATA[' . $timezone . 
']]></C:calendar-timezone> 
  334        $this->server->httpRequest = 
$request;
 
  335        $this->server->exec();
 
  337        $this->assertEquals(201, $this->response->status, 
'Invalid response code received. Full response body: ' . $this->response->body);
 
  339        $calendars = $this->caldavBackend->getCalendarsForUser(
'principals/user1');
 
  340        $this->assertEquals(3, count($calendars));
 
  344           if (
$calendar[
'uri'] === 
'NEWCALENDAR') {
 
  350        $this->assertInternalType(
'array', $newCalendar);
 
  353            'uri'                                                             => 
'NEWCALENDAR',
 
  355            '{urn:ietf:params:xml:ns:caldav}calendar-description'             => 
'Calendar restricted to events.',
 
  356            '{urn:ietf:params:xml:ns:caldav}calendar-timezone'                => $timezone,
 
  357            '{DAV:}displayname'                                               => 
'Lisa\'s Events',
 
  358            '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => 
null,
 
  363            $this->assertArrayHasKey(
$key, $newCalendar);
 
  365            if (is_null($value)) 
continue;
 
  366            $this->assertEquals($value, $newCalendar[
$key]);
 
  369        $sccs = 
'{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
 
  370        $this->assertTrue($newCalendar[$sccs] instanceof Xml\
Property\SupportedCalendarComponentSet);
 
  371        $this->assertEquals([
'VEVENT'], $newCalendar[$sccs]->getValue());
 
  377        $request = 
new HTTP\Request(
'MKCALENDAR', 
'/calendars/user1/NEWCALENDAR');
 
  380        $this->server->httpRequest = 
$request;
 
  381        $this->server->exec();
 
  383        $this->assertEquals(201, $this->response->status, 
'Invalid response code received. Full response body: ' . $this->response->body);
 
  385        $calendars = $this->caldavBackend->getCalendarsForUser(
'principals/user1');
 
  386        $this->assertEquals(3, count($calendars));
 
  390           if (
$calendar[
'uri'] === 
'NEWCALENDAR') {
 
  396        $this->assertInternalType(
'array', $newCalendar);
 
  399            'uri'                                                             => 
'NEWCALENDAR',
 
  401            '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => 
null,
 
  406            $this->assertArrayHasKey(
$key, $newCalendar);
 
  408            if (is_null($value)) 
continue;
 
  409            $this->assertEquals($value, $newCalendar[
$key]);
 
  412        $sccs = 
'{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
 
  413        $this->assertTrue($newCalendar[$sccs] instanceof Xml\
Property\SupportedCalendarComponentSet);
 
  414        $this->assertEquals([
'VEVENT', 
'VTODO'], $newCalendar[$sccs]->getValue());
 
  420        $request = 
new HTTP\Request(
'MKCALENDAR', 
'/blabla');
 
  421        $body = 
'This is not xml';
 
  424        $this->server->httpRequest = 
$request;
 
  425        $this->server->exec();
 
  427        $this->assertEquals(400, $this->response->status);
 
  433        $httpRequest = 
new HTTP\Request(
'FOO', 
'/blabla', [
'Host' => 
'sabredav.org']);
 
  434        $this->server->httpRequest = $httpRequest;
 
  436        $props = $this->server->getPropertiesForPath(
'/principals/user1', [
 
  444        $this->assertArrayHasKey(0, $props);
 
  445        $this->assertArrayHasKey(200, $props[0]);
 
  448        $this->assertArrayHasKey(
'{urn:ietf:params:xml:ns:caldav}calendar-home-set', $props[0][200]);
 
  449        $prop = $props[0][200][
'{urn:ietf:params:xml:ns:caldav}calendar-home-set'];
 
  450        $this->assertInstanceOf(
'Sabre\\DAV\\Xml\\Property\\Href', $prop);
 
  451        $this->assertEquals(
'calendars/user1/', $prop->getHref());
 
  453        $this->assertArrayHasKey(
'{http://calendarserver.org/ns/}calendar-proxy-read-for', $props[0][200]);
 
  454        $prop = $props[0][200][
'{http://calendarserver.org/ns/}calendar-proxy-read-for'];
 
  455        $this->assertInstanceOf(
'Sabre\\DAV\\Xml\\Property\\Href', $prop);
 
  456        $this->assertEquals([
'principals/admin/'], $prop->getHrefs());
 
  458        $this->assertArrayHasKey(
'{http://calendarserver.org/ns/}calendar-proxy-write-for', $props[0][200]);
 
  459        $prop = $props[0][200][
'{http://calendarserver.org/ns/}calendar-proxy-write-for'];
 
  460        $this->assertInstanceOf(
'Sabre\\DAV\\Xml\\Property\\Href', $prop);
 
  461        $this->assertEquals([
'principals/admin/'], $prop->getHrefs());
 
  465        $this->assertInstanceOf(
'Sabre\\CalDAV\\Xml\\Property\\EmailAddressSet', $prop);
 
  466        $this->assertEquals([
'user1.sabredav@sabredav.org'], $prop->getValue());
 
  472        $props = $this->server->getPropertiesForPath(
'/calendars/user1', [
 
  473            '{DAV:}supported-report-set',
 
  476        $this->assertArrayHasKey(0, $props);
 
  477        $this->assertArrayHasKey(200, $props[0]);
 
  478        $this->assertArrayHasKey(
'{DAV:}supported-report-set', $props[0][200]);
 
  480        $prop = $props[0][200][
'{DAV:}supported-report-set'];
 
  482        $this->assertInstanceOf(
'\\Sabre\\DAV\\Xml\\Property\\SupportedReportSet', $prop);
 
  484            '{DAV:}expand-property',
 
  485            '{DAV:}principal-match',
 
  486            '{DAV:}principal-property-search',
 
  487            '{DAV:}principal-search-property-set',
 
  489        $this->assertEquals($value, $prop->getValue());
 
  498        $props = $this->server->getPropertiesForPath(
'/calendars/user1/UUID-123467', [
 
  499            '{DAV:}supported-report-set',
 
  502        $this->assertArrayHasKey(0, $props);
 
  503        $this->assertArrayHasKey(200, $props[0]);
 
  504        $this->assertArrayHasKey(
'{DAV:}supported-report-set', $props[0][200]);
 
  506        $prop = $props[0][200][
'{DAV:}supported-report-set'];
 
  508        $this->assertInstanceOf(
'\\Sabre\\DAV\\Xml\\Property\\SupportedReportSet', $prop);
 
  510            '{urn:ietf:params:xml:ns:caldav}calendar-multiget',
 
  511            '{urn:ietf:params:xml:ns:caldav}calendar-query',
 
  512            '{urn:ietf:params:xml:ns:caldav}free-busy-query',
 
  513            '{DAV:}expand-property',
 
  514            '{DAV:}principal-match',
 
  515            '{DAV:}principal-property-search',
 
  516            '{DAV:}principal-search-property-set' 
  518        $this->assertEquals($value, $prop->getValue());
 
  524        $this->server->addPlugin(
new \
Sabre\DAV\Sync\
Plugin());
 
  526        $props = $this->server->getPropertiesForPath(
'/calendars/user1', [
 
  527            '{DAV:}supported-report-set',
 
  530        $this->assertArrayHasKey(0, $props);
 
  531        $this->assertArrayHasKey(200, $props[0]);
 
  532        $this->assertArrayHasKey(
'{DAV:}supported-report-set', $props[0][200]);
 
  534        $prop = $props[0][200][
'{DAV:}supported-report-set'];
 
  536        $this->assertInstanceOf(
'\\Sabre\\DAV\\Xml\\Property\\SupportedReportSet', $prop);
 
  538            '{DAV:}sync-collection',
 
  539            '{DAV:}expand-property',
 
  540            '{DAV:}principal-match',
 
  541            '{DAV:}principal-property-search',
 
  542            '{DAV:}principal-search-property-set',
 
  544        $this->assertEquals($value, $prop->getValue());
 
  554            '<?xml version="1.0"?>' .
 
  555            '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
 
  557            '  <c:calendar-data />' .
 
  560            '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' .
 
  561            '</c:calendar-multiget>';
 
  563        $request = 
new HTTP\Request(
'REPORT', 
'/calendars/user1', [
'Depth' => 
'1']);
 
  566        $this->server->httpRequest = 
$request;
 
  567        $this->server->exec();
 
  569        $this->assertEquals(207, $this->response->status, 
'Invalid HTTP status received. Full response body');
 
  575<d:multistatus xmlns:cal=
"urn:ietf:params:xml:ns:caldav" xmlns:cs=
"http://calendarserver.org/ns/" xmlns:d=
"DAV:" xmlns:s=
"http://sabredav.org/ns">
 
  577  <d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>
 
  580      <cal:calendar-
data>$expectedIcal</cal:calendar-
data>
 
  581      <d:getetag>
"e207e33c10e5fb9c12cfb35b5d9116e1"</d:getetag>
 
  583    <d:status>HTTP/1.1 200 OK</d:status>
 
  589        $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString());
 
  599            '<?xml version="1.0"?>' .
 
  600            '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
 
  602            '  <c:calendar-data>' .
 
  603            '     <c:expand start="20110101T000000Z" end="20111231T235959Z" />' .
 
  604            '  </c:calendar-data>' .
 
  607            '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' .
 
  608            '</c:calendar-multiget>';
 
  610        $request = 
new HTTP\Request(
'REPORT', 
'/calendars/user1', [
'Depth' => 
'1']);
 
  613        $this->server->httpRequest = 
$request;
 
  614        $this->server->exec();
 
  616        $this->assertEquals(207, $this->response->status, 
'Invalid HTTP status received. Full response body: ' . $this->response->body);
 
  620        $expectedIcal = $expectedIcal->expand(
 
  621            new DateTime(
'2011-01-01 00:00:00', 
new DateTimeZone(
'UTC')),
 
  622            new DateTime(
'2011-12-31 23:59:59', 
new DateTimeZone(
'UTC'))
 
  624        $expectedIcal = str_replace(
"\r\n", 
"
\n", $expectedIcal->serialize());
 
  628<d:multistatus xmlns:cal=
"urn:ietf:params:xml:ns:caldav" xmlns:cs=
"http://calendarserver.org/ns/" xmlns:d=
"DAV:" xmlns:s=
"http://sabredav.org/ns">
 
  630  <d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>
 
  633      <cal:calendar-
data>$expectedIcal</cal:calendar-
data>
 
  634      <d:getetag>
"e207e33c10e5fb9c12cfb35b5d9116e1"</d:getetag>
 
  636    <d:status>HTTP/1.1 200 OK</d:status>
 
  642        $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString());
 
  653            '<?xml version="1.0"?>' .
 
  654            '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
 
  656            '  <c:calendar-data>' .
 
  657            '     <c:expand start="20000101T000000Z" end="20101231T235959Z" />' .
 
  658            '  </c:calendar-data>' .
 
  662            '  <c:comp-filter name="VCALENDAR">' .
 
  663            '    <c:comp-filter name="VEVENT" />' .
 
  664            '  </c:comp-filter>' .
 
  666            '</c:calendar-query>';
 
  668        $request = 
new HTTP\Request(
'REPORT', 
'/calendars/user1/UUID-123467', [
'Depth' => 
'1']);
 
  671        $this->server->httpRequest = 
$request;
 
  672        $this->server->exec();
 
  674        $this->assertEquals(207, $this->response->status, 
'Received an unexpected status. Full response body: ' . $this->response->body);
 
  678        $expectedIcal = $expectedIcal->expand(
 
  679            new DateTime(
'2000-01-01 00:00:00', 
new DateTimeZone(
'UTC')),
 
  680            new DateTime(
'2010-12-31 23:59:59', 
new DateTimeZone(
'UTC'))
 
  682        $expectedIcal = str_replace(
"\r\n", 
"
\n", $expectedIcal->serialize());
 
  686<d:multistatus xmlns:cal=
"urn:ietf:params:xml:ns:caldav" xmlns:cs=
"http://calendarserver.org/ns/" xmlns:d=
"DAV:" xmlns:s=
"http://sabredav.org/ns">
 
  688  <d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>
 
  691      <cal:calendar-
data>$expectedIcal</cal:calendar-
data>
 
  692      <d:getetag>
"e207e33c10e5fb9c12cfb35b5d9116e1"</d:getetag>
 
  694    <d:status>HTTP/1.1 200 OK</d:status>
 
  700        $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString());
 
  711            '<?xml version="1.0"?>' .
 
  712            '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
 
  714            '  <c:calendar-data>' .
 
  715            '     <c:expand start="20000101T000000Z" end="20101231T235959Z" />' .
 
  716            '  </c:calendar-data>' .
 
  720            '  <c:comp-filter name="VCALENDAR">' .
 
  721            '    <c:comp-filter name="VEVENT" />' .
 
  722            '  </c:comp-filter>' .
 
  724            '</c:calendar-query>';
 
  726        $request = 
new HTTP\Request(
'REPORT', 
'/calendars/user1/UUID-123467', [
 
  728            'User-Agent' => 
'MSFT-WP/8.10.14219 (gzip)',
 
  733        $this->server->httpRequest = 
$request;
 
  734        $this->server->exec();
 
  736        $this->assertEquals(207, $this->response->status, 
'Received an unexpected status. Full response body: ' . $this->response->body);
 
  740        $expectedIcal = $expectedIcal->expand(
 
  741            new DateTime(
'2000-01-01 00:00:00', 
new DateTimeZone(
'UTC')),
 
  742            new DateTime(
'2010-12-31 23:59:59', 
new DateTimeZone(
'UTC'))
 
  744        $expectedIcal = str_replace(
"\r\n", 
"
\n", $expectedIcal->serialize());
 
  748<d:multistatus xmlns:cal=
"urn:ietf:params:xml:ns:caldav" xmlns:cs=
"http://calendarserver.org/ns/" xmlns:d=
"DAV:" xmlns:s=
"http://sabredav.org/ns">
 
  750  <d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>
 
  753      <cal:calendar-
data>$expectedIcal</cal:calendar-
data>
 
  754      <d:getetag>
"e207e33c10e5fb9c12cfb35b5d9116e1"</d:getetag>
 
  756    <d:status>HTTP/1.1 200 OK</d:status>
 
  762        $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString());
 
  773            '<?xml version="1.0"?>' .
 
  774            '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
 
  776            '  <c:calendar-data>' .
 
  777            '     <c:expand start="20000101T000000Z" end="20101231T235959Z" />' .
 
  778            '  </c:calendar-data>' .
 
  782            '  <c:comp-filter name="VCALENDAR">' .
 
  783            '    <c:comp-filter name="VEVENT" />' .
 
  784            '  </c:comp-filter>' .
 
  786            '</c:calendar-query>';
 
  788        $request = 
new HTTP\Request(
'REPORT', 
'/calendars/user1/UUID-123467', [
 
  793        $this->server->httpRequest = 
$request;
 
  794        $this->server->exec();
 
  796        $this->assertEquals(400, $this->response->status, 
'Received an unexpected status. Full response body: ' . $this->response->body);
 
  806            '<?xml version="1.0"?>' .
 
  807            '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
 
  812            '  <c:comp-filter name="VCALENDAR">' .
 
  813            '    <c:comp-filter name="VEVENT" />' .
 
  814            '  </c:comp-filter>' .
 
  816            '</c:calendar-query>';
 
  818        $request = 
new HTTP\Request(
'REPORT', 
'/calendars/user1/UUID-123467', [
 
  823        $this->server->httpRequest = 
$request;
 
  824        $this->server->exec();
 
  826        $this->assertEquals(207, $this->response->status, 
'Received an unexpected status. Full response body: ' . $this->response->body);
 
  830<d:multistatus xmlns:cal=
"urn:ietf:params:xml:ns:caldav" xmlns:cs=
"http://calendarserver.org/ns/" xmlns:d=
"DAV:" xmlns:s=
"http://sabredav.org/ns">
 
  832  <d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>
 
  835      <d:getetag>
"e207e33c10e5fb9c12cfb35b5d9116e1"</d:getetag>
 
  837    <d:status>HTTP/1.1 200 OK</d:status>
 
  843        $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString());
 
  853            '<?xml version="1.0"?>' .
 
  854            '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
 
  856            '  <c:calendar-data />' .
 
  859            '</c:calendar-query>';
 
  861        $request = 
new HTTP\Request(
'REPORT', 
'/calendars/user1/UUID-123467');
 
  864        $this->server->httpRequest = 
$request;
 
  865        $this->server->exec();
 
  867        $this->assertEquals(400, $this->response->status, 
'Received an unexpected status. Full response body: ' . $this->response->body);
 
  878            '<?xml version="1.0"?>' .
 
  879            '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
 
  881            '  <c:calendar-data>' .
 
  882            '     <c:expand start="20000101T000000Z" end="20101231T235959Z" />' .
 
  883            '  </c:calendar-data>' .
 
  887            '  <c:comp-filter name="VCALENDAR">' .
 
  888            '    <c:comp-filter name="VEVENT" />' .
 
  889            '  </c:comp-filter>' .
 
  891            '</c:calendar-query>';
 
  893        $request = 
new HTTP\Request(
'REPORT', 
'/calendars/user1/UUID-123467/UUID-2345', [
'Depth' => 
'0']);
 
  896        $this->server->httpRequest = 
$request;
 
  897        $this->server->exec();
 
  899        $this->assertEquals(207, $this->response->status, 
'Received an unexpected status. Full response body: ' . $this->response->body);
 
  903        $expectedIcal = $expectedIcal->expand(
 
  904            new DateTime(
'2000-01-01 00:00:00', 
new DateTimeZone(
'UTC')),
 
  905            new DateTime(
'2010-12-31 23:59:59', 
new DateTimeZone(
'UTC'))
 
  907        $expectedIcal = str_replace(
"\r\n", 
"
\n", $expectedIcal->serialize());
 
  911<d:multistatus xmlns:cal=
"urn:ietf:params:xml:ns:caldav" xmlns:cs=
"http://calendarserver.org/ns/" xmlns:d=
"DAV:" xmlns:s=
"http://sabredav.org/ns">
 
  913  <d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>
 
  916      <cal:calendar-
data>$expectedIcal</cal:calendar-
data>
 
  917      <d:getetag>
"e207e33c10e5fb9c12cfb35b5d9116e1"</d:getetag>
 
  919    <d:status>HTTP/1.1 200 OK</d:status>
 
  925        $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString());
 
  936            '<?xml version="1.0"?>' .
 
  937            '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
 
  942            '  <c:comp-filter name="VCALENDAR">' .
 
  943            '    <c:comp-filter name="VEVENT" />' .
 
  944            '  </c:comp-filter>' .
 
  946            '</c:calendar-query>';
 
  948        $request = 
new HTTP\Request(
'REPORT', 
'/calendars/user1/UUID-123467/UUID-2345', [
'Depth' => 
'0']);
 
  951        $this->server->httpRequest = 
$request;
 
  952        $this->server->exec();
 
  954        $this->assertEquals(207, $this->response->status, 
'Received an unexpected status. Full response body: ' . $this->response->body);
 
  958<d:multistatus xmlns:cal=
"urn:ietf:params:xml:ns:caldav" xmlns:cs=
"http://calendarserver.org/ns/" xmlns:d=
"DAV:" xmlns:s=
"http://sabredav.org/ns">
 
  960  <d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>
 
  963      <d:getetag>
"e207e33c10e5fb9c12cfb35b5d9116e1"</d:getetag>
 
  965    <d:status>HTTP/1.1 200 OK</d:status>
 
  971        $this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString());
 
  978        $r = $this->server->emit(
'onHTMLActionsPanel', [$this->server->tree->getNodeForPath(
'calendars/user1'), &
$output]);
 
  979        $this->assertFalse(
$r);
 
  981        $this->assertTrue(!!strpos(
$output, 
'Display name'));
 
  991            '<?xml version="1.0"?>' .
 
  992            '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
 
  994            '  <c:calendar-data>' .
 
  995            '     <c:expand start="20110101T000000Z" />' .
 
  996            '  </c:calendar-data>' .
 
  999            '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' .
 
 1000            '</c:calendar-multiget>';
 
 1002        $request = 
new HTTP\Request(
'REPORT', 
'/calendars/user1', [
'Depth' => 
'1']);
 
 1005        $this->server->httpRequest = 
$request;
 
 1006        $this->server->exec();
 
 1008        $this->assertEquals(400, $this->response->status, 
'Invalid HTTP status received. Full response body: ' . $this->response->body);
 
 1018            '<?xml version="1.0"?>' .
 
 1019            '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
 
 1021            '  <c:calendar-data>' .
 
 1022            '     <c:expand end="20110101T000000Z" />' .
 
 1023            '  </c:calendar-data>' .
 
 1026            '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' .
 
 1027            '</c:calendar-multiget>';
 
 1029        $request = 
new HTTP\Request(
'REPORT', 
'/calendars/user1', [
'Depth' => 
'1']);
 
 1032        $this->server->httpRequest = 
$request;
 
 1033        $this->server->exec();
 
 1035        $this->assertEquals(400, $this->response->status, 
'Invalid HTTP status received. Full response body: ' . $this->response->body);
 
 1045            '<?xml version="1.0"?>' .
 
 1046            '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
 
 1048            '  <c:calendar-data>' .
 
 1049            '     <c:expand start="20200101T000000Z" end="20110101T000000Z" />' .
 
 1050            '  </c:calendar-data>' .
 
 1053            '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' .
 
 1054            '</c:calendar-multiget>';
 
 1056        $request = 
new HTTP\Request(
'REPORT', 
'/calendars/user1', [
'Depth' => 
'1']);
 
 1059        $this->server->httpRequest = 
$request;
 
 1060        $this->server->exec();
 
 1062        $this->assertEquals(400, $this->response->status, 
'Invalid HTTP status received. Full response body: ' . $this->response->body);
 
 1071        $ns = 
'{urn:ietf:params:xml:ns:caldav}';
 
 1072        $props = $this->server->getProperties(
'calendars/user1/UUID-123467', [
 
 1073            $ns . 
'max-resource-size',
 
 1074            $ns . 
'supported-calendar-data',
 
 1075            $ns . 
'supported-collation-set',
 
 1078        $this->assertEquals([
 
 1079            $ns . 
'max-resource-size'       => 10000000,
 
 1080            $ns . 
'supported-calendar-data' => 
new Xml\
Property\SupportedCalendarData(),
 
 1081            $ns . 
'supported-collation-set' => 
new Xml\
Property\SupportedCollationSet(),
 
foreach($paths as $path) $request
An exception for terminatinating execution or to throw for unit testing.
testMkCalendarBadLocation()
testCalendarMultiGetReportNoEnd()
@depends testCalendarMultiGetReport
testCalendarQueryReportNoFilters()
@depends testCalendarQueryReport
testMkCalendarNoParentNode()
testSupportedReportSetProperty()
@depends testSupportedReportSetPropertyNonCalendar
testCalendarMultiGetReportEndBeforeStart()
@depends testCalendarMultiGetReport
testCalendarQueryReportWindowsPhone()
@depends testSupportedReportSetProperty @depends testCalendarMultiGetReport
testPrincipalProperties()
testCalendarQueryReportNoCalData()
@depends testCalendarQueryReport
testSupportedReportSetPropertyNonCalendar()
testSupportedReportSetUserCalendars()
testCalendarProperties()
@depends testSupportedReportSetPropertyNonCalendar
testCalendarQueryReportBadDepth()
@depends testSupportedReportSetProperty @depends testCalendarMultiGetReport
testCalendarQueryReport1Object()
@depends testSupportedReportSetProperty @depends testCalendarMultiGetReport
testCalendarMultiGetReportNoStart()
@depends testCalendarMultiGetReport
testCalendarQueryReport1ObjectNoCalData()
@depends testSupportedReportSetProperty @depends testCalendarMultiGetReport
testCalendarMultiGetReport()
@depends testSupportedReportSetProperty
testCalendarQueryReport()
@depends testSupportedReportSetProperty @depends testCalendarMultiGetReport
testMkCalendarEmptyBodySucceed()
testCalendarMultiGetReportExpand()
@depends testCalendarMultiGetReport
testUnknownMethodPassThrough()
testMkCalendarExistingCalendar()
const NS_CALDAV
This is the official CalDAV namespace.
const NS_CALENDARSERVER
This is the namespace for the proprietary calendarserver extensions.
static getTestCalendarData($type=1)
This plugin provides Authentication for a WebDAV server.
The Request class represents a single HTTP request.
This class represents a single HTTP response.
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.