Definition at line 11 of file PluginTest.php.
◆ setup()
Sabre\CalDAV\PluginTest::setup |
( |
| ) |
|
Definition at line 27 of file PluginTest.php.
References $aclPlugin, $authBackend, $authPlugin, $principalBackend, Sabre\CalDAV\PluginTest\$response, $root, and Sabre\CalDAV\TestUtil\getTestCalendarData().
29 $caldavNS =
'{urn:ietf:params:xml:ns:caldav}';
31 $this->caldavBackend =
new Backend\Mock([
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',
72 $root =
new DAV\SimpleCollection(
'root');
73 $root->addChild($calendars);
74 $root->addChild($principals);
76 $this->server =
new DAV\Server(
$root);
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();
static getTestCalendarData($type=1)
◆ testCalendarMultiGetReport()
Sabre\CalDAV\PluginTest::testCalendarMultiGetReport |
( |
| ) |
|
testSupportedReportSetProperty
Definition at line 551 of file PluginTest.php.
References $request, data, and Sabre\CalDAV\TestUtil\getTestCalendarData().
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');
574 <?xml version=
"1.0"?>
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());
foreach($paths as $path) $request
static getTestCalendarData($type=1)
◆ testCalendarMultiGetReportEndBeforeStart()
Sabre\CalDAV\PluginTest::testCalendarMultiGetReportEndBeforeStart |
( |
| ) |
|
testCalendarMultiGetReport
Definition at line 1042 of file PluginTest.php.
References $request.
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);
foreach($paths as $path) $request
◆ testCalendarMultiGetReportExpand()
Sabre\CalDAV\PluginTest::testCalendarMultiGetReportExpand |
( |
| ) |
|
testCalendarMultiGetReport
Definition at line 596 of file PluginTest.php.
References $request, data, Sabre\CalDAV\TestUtil\getTestCalendarData(), and Sabre\VObject\Reader\read().
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(
624 $expectedIcal = str_replace(
"\r\n",
"
\n", $expectedIcal->serialize());
627 <?xml version=
"1.0"?>
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());
foreach($paths as $path) $request
static getTestCalendarData($type=1)
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
◆ testCalendarMultiGetReportNoEnd()
Sabre\CalDAV\PluginTest::testCalendarMultiGetReportNoEnd |
( |
| ) |
|
testCalendarMultiGetReport
Definition at line 988 of file PluginTest.php.
References $request.
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);
foreach($paths as $path) $request
◆ testCalendarMultiGetReportNoStart()
Sabre\CalDAV\PluginTest::testCalendarMultiGetReportNoStart |
( |
| ) |
|
testCalendarMultiGetReport
Definition at line 1015 of file PluginTest.php.
References $request.
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);
foreach($paths as $path) $request
◆ testCalendarProperties()
Sabre\CalDAV\PluginTest::testCalendarProperties |
( |
| ) |
|
testSupportedReportSetPropertyNonCalendar
Definition at line 1069 of file PluginTest.php.
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(),
◆ testCalendarQueryReport()
Sabre\CalDAV\PluginTest::testCalendarQueryReport |
( |
| ) |
|
testSupportedReportSetProperty testCalendarMultiGetReport
Definition at line 650 of file PluginTest.php.
References $request, data, Sabre\CalDAV\TestUtil\getTestCalendarData(), and Sabre\VObject\Reader\read().
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(
682 $expectedIcal = str_replace(
"\r\n",
"
\n", $expectedIcal->serialize());
685 <?xml version=
"1.0"?>
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());
foreach($paths as $path) $request
static getTestCalendarData($type=1)
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
◆ testCalendarQueryReport1Object()
Sabre\CalDAV\PluginTest::testCalendarQueryReport1Object |
( |
| ) |
|
testSupportedReportSetProperty testCalendarMultiGetReport
Definition at line 875 of file PluginTest.php.
References $request, data, Sabre\CalDAV\TestUtil\getTestCalendarData(), and Sabre\VObject\Reader\read().
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(
907 $expectedIcal = str_replace(
"\r\n",
"
\n", $expectedIcal->serialize());
910 <?xml version=
"1.0"?>
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());
foreach($paths as $path) $request
static getTestCalendarData($type=1)
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
◆ testCalendarQueryReport1ObjectNoCalData()
Sabre\CalDAV\PluginTest::testCalendarQueryReport1ObjectNoCalData |
( |
| ) |
|
testSupportedReportSetProperty testCalendarMultiGetReport
Definition at line 933 of file PluginTest.php.
References $request.
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);
957 <?xml version=
"1.0"?>
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());
foreach($paths as $path) $request
◆ testCalendarQueryReportBadDepth()
Sabre\CalDAV\PluginTest::testCalendarQueryReportBadDepth |
( |
| ) |
|
testSupportedReportSetProperty testCalendarMultiGetReport
Definition at line 770 of file PluginTest.php.
References $request.
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);
foreach($paths as $path) $request
◆ testCalendarQueryReportNoCalData()
Sabre\CalDAV\PluginTest::testCalendarQueryReportNoCalData |
( |
| ) |
|
testCalendarQueryReport
Definition at line 803 of file PluginTest.php.
References $request.
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);
829 <?xml version=
"1.0"?>
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());
foreach($paths as $path) $request
◆ testCalendarQueryReportNoFilters()
Sabre\CalDAV\PluginTest::testCalendarQueryReportNoFilters |
( |
| ) |
|
testCalendarQueryReport
Definition at line 850 of file PluginTest.php.
References $request.
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);
foreach($paths as $path) $request
◆ testCalendarQueryReportWindowsPhone()
Sabre\CalDAV\PluginTest::testCalendarQueryReportWindowsPhone |
( |
| ) |
|
testSupportedReportSetProperty testCalendarMultiGetReport
Definition at line 708 of file PluginTest.php.
References $request, data, Sabre\CalDAV\TestUtil\getTestCalendarData(), and Sabre\VObject\Reader\read().
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(
744 $expectedIcal = str_replace(
"\r\n",
"
\n", $expectedIcal->serialize());
747 <?xml version=
"1.0"?>
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());
foreach($paths as $path) $request
static getTestCalendarData($type=1)
static read($data, $options=0, $charset='UTF-8')
Parses a vCard or iCalendar object, and returns the top component.
◆ testHTMLActionsPanel()
Sabre\CalDAV\PluginTest::testHTMLActionsPanel |
( |
| ) |
|
Definition at line 975 of file PluginTest.php.
References Sabre\VObject\$output, and $r.
978 $r = $this->server->emit(
'onHTMLActionsPanel', [$this->server->tree->getNodeForPath(
'calendars/user1'), &
$output]);
979 $this->assertFalse(
$r);
981 $this->assertTrue(!!strpos(
$output,
'Display name'));
◆ testMkCalendarBadLocation()
Sabre\CalDAV\PluginTest::testMkCalendarBadLocation |
( |
| ) |
|
Definition at line 137 of file PluginTest.php.
References $request.
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);
foreach($paths as $path) $request
◆ testMkCalendarBadXml()
Sabre\CalDAV\PluginTest::testMkCalendarBadXml |
( |
| ) |
|
Definition at line 418 of file PluginTest.php.
References $request.
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);
foreach($paths as $path) $request
◆ testMkCalendarEmptyBodySucceed()
Sabre\CalDAV\PluginTest::testMkCalendarEmptyBodySucceed |
( |
| ) |
|
Definition at line 375 of file PluginTest.php.
References $calendar, $key, $keys, and $request.
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());
foreach($paths as $path) $request
◆ testMkCalendarExistingCalendar()
Sabre\CalDAV\PluginTest::testMkCalendarExistingCalendar |
( |
| ) |
|
Definition at line 237 of file PluginTest.php.
References $request, and Sabre\HTTP\Sapi\createFromServerArray().
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);
foreach($paths as $path) $request
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
◆ testMkCalendarNoParentNode()
Sabre\CalDAV\PluginTest::testMkCalendarNoParentNode |
( |
| ) |
|
Definition at line 187 of file PluginTest.php.
References $request.
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);
foreach($paths as $path) $request
◆ testMkCalendarSucceed()
Sabre\CalDAV\PluginTest::testMkCalendarSucceed |
( |
| ) |
|
Definition at line 290 of file PluginTest.php.
References $calendar, $key, $keys, and $request.
292 $request =
new HTTP\Request(
'MKCALENDAR',
'/calendars/user1/NEWCALENDAR');
294 $timezone =
'BEGIN:VCALENDAR 295 PRODID:-//Example Corp.//CalDAV Client//EN 299 LAST-MODIFIED:19870101T000000Z 301 DTSTART:19671029T020000 302 RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 305 TZNAME:Eastern Standard Time (US & Canada) 308 DTSTART:19870405T020000 309 RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 312 TZNAME: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());
foreach($paths as $path) $request
◆ testPrincipalProperties()
Sabre\CalDAV\PluginTest::testPrincipalProperties |
( |
| ) |
|
Definition at line 431 of file PluginTest.php.
References Sabre\CalDAV\Plugin\NS_CALDAV, and Sabre\CalDAV\Plugin\NS_CALENDARSERVER.
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());
const NS_CALENDARSERVER
This is the namespace for the proprietary calendarserver extensions.
const NS_CALDAV
This is the official CalDAV namespace.
◆ testReportPassThrough()
Sabre\CalDAV\PluginTest::testReportPassThrough |
( |
| ) |
|
Definition at line 125 of file PluginTest.php.
References $request.
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);
foreach($paths as $path) $request
◆ testSimple()
Sabre\CalDAV\PluginTest::testSimple |
( |
| ) |
|
Definition at line 103 of file PluginTest.php.
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']
◆ testSupportedReportSetProperty()
Sabre\CalDAV\PluginTest::testSupportedReportSetProperty |
( |
| ) |
|
testSupportedReportSetPropertyNonCalendar
Definition at line 496 of file PluginTest.php.
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());
◆ testSupportedReportSetPropertyNonCalendar()
Sabre\CalDAV\PluginTest::testSupportedReportSetPropertyNonCalendar |
( |
| ) |
|
Definition at line 470 of file PluginTest.php.
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());
◆ testSupportedReportSetUserCalendars()
Sabre\CalDAV\PluginTest::testSupportedReportSetUserCalendars |
( |
| ) |
|
Definition at line 522 of file PluginTest.php.
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());
◆ testUnknownMethodPassThrough()
Sabre\CalDAV\PluginTest::testUnknownMethodPassThrough |
( |
| ) |
|
Definition at line 114 of file PluginTest.php.
References $request.
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);
foreach($paths as $path) $request
◆ $caldavBackend
Sabre\CalDAV\PluginTest::$caldavBackend |
|
protected |
◆ $plugin
Sabre\CalDAV\PluginTest::$plugin |
|
protected |
◆ $response
Sabre\CalDAV\PluginTest::$response |
|
protected |
◆ $server
Sabre\CalDAV\PluginTest::$server |
|
protected |
The documentation for this class was generated from the following file: