aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-11-10 12:49:51 +0000
committerMario <mario@mariovavti.com>2019-11-10 14:10:03 +0100
commit580c3f4ffe9608d2beb56d418c68b3b112420e76 (patch)
tree82335d01179ac361d3f547a4b8e8c598d302e9f3 /vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php
parentd22766f458a8539a40a57f3946459a9be1f21cd6 (diff)
downloadvolse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.gz
volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.bz2
volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.zip
another bulk of composer updates
(cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce)
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php')
-rw-r--r--vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php535
1 files changed, 257 insertions, 278 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php b/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php
index 859f6aa0c..711cc0ac7 100644
--- a/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CalDAV/PluginTest.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CalDAV;
use DateTime;
@@ -8,8 +10,8 @@ use Sabre\DAV;
use Sabre\DAVACL;
use Sabre\HTTP;
-class PluginTest extends \PHPUnit_Framework_TestCase {
-
+class PluginTest extends \PHPUnit\Framework\TestCase
+{
/**
* @var DAV\Server
*/
@@ -24,37 +26,37 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
*/
protected $caldavBackend;
- function setup() {
-
+ public function setup()
+ {
$caldavNS = '{urn:ietf:params:xml:ns:caldav}';
$this->caldavBackend = new Backend\Mock([
[
- 'id' => 1,
- 'uri' => 'UUID-123467',
- 'principaluri' => 'principals/user1',
- '{DAV:}displayname' => 'user1 calendar',
- $caldavNS . 'calendar-description' => 'Calendar description',
- '{http://apple.com/ns/ical/}calendar-order' => '1',
- '{http://apple.com/ns/ical/}calendar-color' => '#FF0000',
- $caldavNS . 'supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO']),
+ 'id' => 1,
+ 'uri' => 'UUID-123467',
+ 'principaluri' => 'principals/user1',
+ '{DAV:}displayname' => 'user1 calendar',
+ $caldavNS.'calendar-description' => 'Calendar description',
+ '{http://apple.com/ns/ical/}calendar-order' => '1',
+ '{http://apple.com/ns/ical/}calendar-color' => '#FF0000',
+ $caldavNS.'supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO']),
],
[
- 'id' => 2,
- 'uri' => 'UUID-123468',
- 'principaluri' => 'principals/user1',
- '{DAV:}displayname' => 'user1 calendar2',
- $caldavNS . 'calendar-description' => 'Calendar description',
- '{http://apple.com/ns/ical/}calendar-order' => '1',
- '{http://apple.com/ns/ical/}calendar-color' => '#FF0000',
- $caldavNS . 'supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO']),
- ]
+ 'id' => 2,
+ 'uri' => 'UUID-123468',
+ 'principaluri' => 'principals/user1',
+ '{DAV:}displayname' => 'user1 calendar2',
+ $caldavNS.'calendar-description' => 'Calendar description',
+ '{http://apple.com/ns/ical/}calendar-order' => '1',
+ '{http://apple.com/ns/ical/}calendar-color' => '#FF0000',
+ $caldavNS.'supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VEVENT', 'VTODO']),
+ ],
], [
1 => [
'UUID-2345' => [
'calendardata' => TestUtil::getTestCalendarData(),
- ]
- ]
+ ],
+ ],
]);
$principalBackend = new DAVACL\PrincipalBackend\Mock();
$principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-read', ['principals/user1']);
@@ -89,41 +91,45 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
$authBackend = new DAV\Auth\Backend\Mock();
$authBackend->setPrincipal('principals/user1');
$authPlugin = new DAV\Auth\Plugin($authBackend);
- $authPlugin->beforeMethod(new \Sabre\HTTP\Request(), new \Sabre\HTTP\Response());
+ $authPlugin->beforeMethod(new \Sabre\HTTP\Request('GET', '/'), new \Sabre\HTTP\Response());
$this->server->addPlugin($authPlugin);
// This forces a login
- $authPlugin->beforeMethod(new HTTP\Request(), new HTTP\Response());
+ $authPlugin->beforeMethod(new HTTP\Request('GET', '/'), new HTTP\Response());
$this->response = new HTTP\ResponseMock();
$this->server->httpResponse = $this->response;
-
}
- function testSimple() {
-
+ public function testSimple()
+ {
$this->assertEquals(['MKCALENDAR'], $this->plugin->getHTTPMethods('calendars/user1/randomnewcalendar'));
$this->assertEquals(['calendar-access', 'calendar-proxy'], $this->plugin->getFeatures());
$this->assertEquals(
'caldav',
$this->plugin->getPluginInfo()['name']
);
-
}
- function testUnknownMethodPassThrough() {
-
+ public function testUnknownMethodPassThrough()
+ {
$request = new HTTP\Request('MKBREAKFAST', '/');
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(501, $this->response->status, 'Incorrect status returned. Full response body:' . $this->response->body);
-
+ $this->assertEquals(501, $this->response->status, 'Incorrect status returned. Full response body:'.$this->response->body);
}
- function testReportPassThrough() {
+ public function testGetWithoutContentType()
+ {
+ $request = new HTTP\Request('GET', '/');
+ $this->plugin->httpAfterGet($request, $this->response);
+ $this->assertTrue(true);
+ }
+ public function testReportPassThrough()
+ {
$request = new HTTP\Request('REPORT', '/', ['Content-Type' => 'application/xml']);
$request->setBody('<?xml version="1.0"?><s:somereport xmlns:s="http://www.rooftopsolutions.nl/NS/example" />');
@@ -131,11 +137,10 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
$this->server->exec();
$this->assertEquals(415, $this->response->status);
-
}
- function testMkCalendarBadLocation() {
-
+ public function testMkCalendarBadLocation()
+ {
$request = new HTTP\Request('MKCALENDAR', '/blabla');
$body = '<?xml version="1.0" encoding="utf-8" ?>
@@ -181,11 +186,10 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
$this->server->exec();
$this->assertEquals(403, $this->response->status);
-
}
- function testMkCalendarNoParentNode() {
-
+ public function testMkCalendarNoParentNode()
+ {
$request = new HTTP\Request('MKCALENDAR', '/doesntexist/calendar');
$body = '<?xml version="1.0" encoding="utf-8" ?>
@@ -231,14 +235,13 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
$this->server->exec();
$this->assertEquals(409, $this->response->status);
-
}
- function testMkCalendarExistingCalendar() {
-
+ public function testMkCalendarExistingCalendar()
+ {
$request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'MKCALENDAR',
- 'REQUEST_URI' => '/calendars/user1/UUID-123467',
+ 'REQUEST_URI' => '/calendars/user1/UUID-123467',
]);
$body = '<?xml version="1.0" encoding="utf-8" ?>
@@ -284,11 +287,10 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
$this->server->exec();
$this->assertEquals(405, $this->response->status);
-
}
- function testMkCalendarSucceed() {
-
+ public function testMkCalendarSucceed()
+ {
$request = new HTTP\Request('MKCALENDAR', '/calendars/user1/NEWCALENDAR');
$timezone = 'BEGIN:VCALENDAR
@@ -325,7 +327,7 @@ END:VCALENDAR';
<C:supported-calendar-component-set>
<C:comp name="VEVENT"/>
</C:supported-calendar-component-set>
- <C:calendar-timezone><![CDATA[' . $timezone . ']]></C:calendar-timezone>
+ <C:calendar-timezone><![CDATA['.$timezone.']]></C:calendar-timezone>
</D:prop>
</D:set>
</C:mkcalendar>';
@@ -334,89 +336,87 @@ END:VCALENDAR';
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(201, $this->response->status, 'Invalid response code received. Full response body: ' . $this->response->body);
+ $this->assertEquals(201, $this->response->status, 'Invalid response code received. Full response body: '.$this->response->body);
$calendars = $this->caldavBackend->getCalendarsForUser('principals/user1');
$this->assertEquals(3, count($calendars));
$newCalendar = null;
foreach ($calendars as $calendar) {
- if ($calendar['uri'] === 'NEWCALENDAR') {
+ if ('NEWCALENDAR' === $calendar['uri']) {
$newCalendar = $calendar;
break;
- }
+ }
}
$this->assertInternalType('array', $newCalendar);
$keys = [
- 'uri' => 'NEWCALENDAR',
- 'id' => null,
- '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar restricted to events.',
- '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => $timezone,
- '{DAV:}displayname' => 'Lisa\'s Events',
+ 'uri' => 'NEWCALENDAR',
+ 'id' => null,
+ '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar restricted to events.',
+ '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => $timezone,
+ '{DAV:}displayname' => 'Lisa\'s Events',
'{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => null,
];
foreach ($keys as $key => $value) {
-
$this->assertArrayHasKey($key, $newCalendar);
- if (is_null($value)) continue;
+ if (is_null($value)) {
+ continue;
+ }
$this->assertEquals($value, $newCalendar[$key]);
-
}
$sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
$this->assertTrue($newCalendar[$sccs] instanceof Xml\Property\SupportedCalendarComponentSet);
$this->assertEquals(['VEVENT'], $newCalendar[$sccs]->getValue());
-
}
- function testMkCalendarEmptyBodySucceed() {
-
+ public function testMkCalendarEmptyBodySucceed()
+ {
$request = new HTTP\Request('MKCALENDAR', '/calendars/user1/NEWCALENDAR');
$request->setBody('');
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(201, $this->response->status, 'Invalid response code received. Full response body: ' . $this->response->body);
+ $this->assertEquals(201, $this->response->status, 'Invalid response code received. Full response body: '.$this->response->body);
$calendars = $this->caldavBackend->getCalendarsForUser('principals/user1');
$this->assertEquals(3, count($calendars));
$newCalendar = null;
foreach ($calendars as $calendar) {
- if ($calendar['uri'] === 'NEWCALENDAR') {
+ if ('NEWCALENDAR' === $calendar['uri']) {
$newCalendar = $calendar;
break;
- }
+ }
}
$this->assertInternalType('array', $newCalendar);
$keys = [
- 'uri' => 'NEWCALENDAR',
- 'id' => null,
+ 'uri' => 'NEWCALENDAR',
+ 'id' => null,
'{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => null,
];
foreach ($keys as $key => $value) {
-
$this->assertArrayHasKey($key, $newCalendar);
- if (is_null($value)) continue;
+ if (is_null($value)) {
+ continue;
+ }
$this->assertEquals($value, $newCalendar[$key]);
-
}
$sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
$this->assertTrue($newCalendar[$sccs] instanceof Xml\Property\SupportedCalendarComponentSet);
$this->assertEquals(['VEVENT', 'VTODO'], $newCalendar[$sccs]->getValue());
-
}
- function testMkCalendarBadXml() {
-
+ public function testMkCalendarBadXml()
+ {
$request = new HTTP\Request('MKCALENDAR', '/blabla');
$body = 'This is not xml';
@@ -425,26 +425,24 @@ END:VCALENDAR';
$this->server->exec();
$this->assertEquals(400, $this->response->status);
-
}
- function testPrincipalProperties() {
-
+ public function testPrincipalProperties()
+ {
$httpRequest = new HTTP\Request('FOO', '/blabla', ['Host' => 'sabredav.org']);
$this->server->httpRequest = $httpRequest;
$props = $this->server->getPropertiesForPath('/principals/user1', [
- '{' . Plugin::NS_CALDAV . '}calendar-home-set',
- '{' . Plugin::NS_CALENDARSERVER . '}calendar-proxy-read-for',
- '{' . Plugin::NS_CALENDARSERVER . '}calendar-proxy-write-for',
- '{' . Plugin::NS_CALENDARSERVER . '}notification-URL',
- '{' . Plugin::NS_CALENDARSERVER . '}email-address-set',
+ '{'.Plugin::NS_CALDAV.'}calendar-home-set',
+ '{'.Plugin::NS_CALENDARSERVER.'}calendar-proxy-read-for',
+ '{'.Plugin::NS_CALENDARSERVER.'}calendar-proxy-write-for',
+ '{'.Plugin::NS_CALENDARSERVER.'}notification-URL',
+ '{'.Plugin::NS_CALENDARSERVER.'}email-address-set',
]);
$this->assertArrayHasKey(0, $props);
$this->assertArrayHasKey(200, $props[0]);
-
$this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}calendar-home-set', $props[0][200]);
$prop = $props[0][200]['{urn:ietf:params:xml:ns:caldav}calendar-home-set'];
$this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $prop);
@@ -460,15 +458,14 @@ END:VCALENDAR';
$this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $prop);
$this->assertEquals(['principals/admin/'], $prop->getHrefs());
- $this->assertArrayHasKey('{' . Plugin::NS_CALENDARSERVER . '}email-address-set', $props[0][200]);
- $prop = $props[0][200]['{' . Plugin::NS_CALENDARSERVER . '}email-address-set'];
+ $this->assertArrayHasKey('{'.Plugin::NS_CALENDARSERVER.'}email-address-set', $props[0][200]);
+ $prop = $props[0][200]['{'.Plugin::NS_CALENDARSERVER.'}email-address-set'];
$this->assertInstanceOf('Sabre\\CalDAV\\Xml\\Property\\EmailAddressSet', $prop);
$this->assertEquals(['user1.sabredav@sabredav.org'], $prop->getValue());
-
}
- function testSupportedReportSetPropertyNonCalendar() {
-
+ public function testSupportedReportSetPropertyNonCalendar()
+ {
$props = $this->server->getPropertiesForPath('/calendars/user1', [
'{DAV:}supported-report-set',
]);
@@ -487,14 +484,13 @@ END:VCALENDAR';
'{DAV:}principal-search-property-set',
];
$this->assertEquals($value, $prop->getValue());
-
}
/**
* @depends testSupportedReportSetPropertyNonCalendar
*/
- function testSupportedReportSetProperty() {
-
+ public function testSupportedReportSetProperty()
+ {
$props = $this->server->getPropertiesForPath('/calendars/user1/UUID-123467', [
'{DAV:}supported-report-set',
]);
@@ -513,14 +509,13 @@ END:VCALENDAR';
'{DAV:}expand-property',
'{DAV:}principal-match',
'{DAV:}principal-property-search',
- '{DAV:}principal-search-property-set'
+ '{DAV:}principal-search-property-set',
];
$this->assertEquals($value, $prop->getValue());
-
}
- function testSupportedReportSetUserCalendars() {
-
+ public function testSupportedReportSetUserCalendars()
+ {
$this->server->addPlugin(new \Sabre\DAV\Sync\Plugin());
$props = $this->server->getPropertiesForPath('/calendars/user1', [
@@ -542,22 +537,21 @@ END:VCALENDAR';
'{DAV:}principal-search-property-set',
];
$this->assertEquals($value, $prop->getValue());
-
}
/**
* @depends testSupportedReportSetProperty
*/
- function testCalendarMultiGetReport() {
-
+ public function testCalendarMultiGetReport()
+ {
$body =
- '<?xml version="1.0"?>' .
- '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
- '<d:prop>' .
- ' <c:calendar-data />' .
- ' <d:getetag />' .
- '</d:prop>' .
- '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' .
+ '<?xml version="1.0"?>'.
+ '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'.
+ '<d:prop>'.
+ ' <c:calendar-data />'.
+ ' <d:getetag />'.
+ '</d:prop>'.
+ '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>'.
'</c:calendar-multiget>';
$request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']);
@@ -587,24 +581,23 @@ END:VCALENDAR';
XML;
$this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString());
-
}
/**
* @depends testCalendarMultiGetReport
*/
- function testCalendarMultiGetReportExpand() {
-
+ public function testCalendarMultiGetReportExpand()
+ {
$body =
- '<?xml version="1.0"?>' .
- '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
- '<d:prop>' .
- ' <c:calendar-data>' .
- ' <c:expand start="20110101T000000Z" end="20111231T235959Z" />' .
- ' </c:calendar-data>' .
- ' <d:getetag />' .
- '</d:prop>' .
- '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' .
+ '<?xml version="1.0"?>'.
+ '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'.
+ '<d:prop>'.
+ ' <c:calendar-data>'.
+ ' <c:expand start="20110101T000000Z" end="20111231T235959Z" />'.
+ ' </c:calendar-data>'.
+ ' <d:getetag />'.
+ '</d:prop>'.
+ '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>'.
'</c:calendar-multiget>';
$request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']);
@@ -613,7 +606,7 @@ XML;
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(207, $this->response->status, 'Invalid HTTP status received. Full response body: ' . $this->response->body);
+ $this->assertEquals(207, $this->response->status, 'Invalid HTTP status received. Full response body: '.$this->response->body);
$expectedIcal = TestUtil::getTestCalendarData();
$expectedIcal = \Sabre\VObject\Reader::read($expectedIcal);
@@ -640,29 +633,28 @@ XML;
XML;
$this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString());
-
}
/**
* @depends testSupportedReportSetProperty
* @depends testCalendarMultiGetReport
*/
- function testCalendarQueryReport() {
-
+ public function testCalendarQueryReport()
+ {
$body =
- '<?xml version="1.0"?>' .
- '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
- '<d:prop>' .
- ' <c:calendar-data>' .
- ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />' .
- ' </c:calendar-data>' .
- ' <d:getetag />' .
- '</d:prop>' .
- '<c:filter>' .
- ' <c:comp-filter name="VCALENDAR">' .
- ' <c:comp-filter name="VEVENT" />' .
- ' </c:comp-filter>' .
- '</c:filter>' .
+ '<?xml version="1.0"?>'.
+ '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'.
+ '<d:prop>'.
+ ' <c:calendar-data>'.
+ ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />'.
+ ' </c:calendar-data>'.
+ ' <d:getetag />'.
+ '</d:prop>'.
+ '<c:filter>'.
+ ' <c:comp-filter name="VCALENDAR">'.
+ ' <c:comp-filter name="VEVENT" />'.
+ ' </c:comp-filter>'.
+ '</c:filter>'.
'</c:calendar-query>';
$request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', ['Depth' => '1']);
@@ -671,7 +663,7 @@ XML;
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: ' . $this->response->body);
+ $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body);
$expectedIcal = TestUtil::getTestCalendarData();
$expectedIcal = \Sabre\VObject\Reader::read($expectedIcal);
@@ -698,33 +690,32 @@ XML;
XML;
$this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString());
-
}
/**
* @depends testSupportedReportSetProperty
* @depends testCalendarMultiGetReport
*/
- function testCalendarQueryReportWindowsPhone() {
-
+ public function testCalendarQueryReportWindowsPhone()
+ {
$body =
- '<?xml version="1.0"?>' .
- '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
- '<d:prop>' .
- ' <c:calendar-data>' .
- ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />' .
- ' </c:calendar-data>' .
- ' <d:getetag />' .
- '</d:prop>' .
- '<c:filter>' .
- ' <c:comp-filter name="VCALENDAR">' .
- ' <c:comp-filter name="VEVENT" />' .
- ' </c:comp-filter>' .
- '</c:filter>' .
+ '<?xml version="1.0"?>'.
+ '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'.
+ '<d:prop>'.
+ ' <c:calendar-data>'.
+ ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />'.
+ ' </c:calendar-data>'.
+ ' <d:getetag />'.
+ '</d:prop>'.
+ '<c:filter>'.
+ ' <c:comp-filter name="VCALENDAR">'.
+ ' <c:comp-filter name="VEVENT" />'.
+ ' </c:comp-filter>'.
+ '</c:filter>'.
'</c:calendar-query>';
$request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', [
- 'Depth' => '0',
+ 'Depth' => '0',
'User-Agent' => 'MSFT-WP/8.10.14219 (gzip)',
]);
@@ -733,7 +724,7 @@ XML;
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: ' . $this->response->body);
+ $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body);
$expectedIcal = TestUtil::getTestCalendarData();
$expectedIcal = \Sabre\VObject\Reader::read($expectedIcal);
@@ -760,29 +751,28 @@ XML;
XML;
$this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString());
-
}
/**
* @depends testSupportedReportSetProperty
* @depends testCalendarMultiGetReport
*/
- function testCalendarQueryReportBadDepth() {
-
+ public function testCalendarQueryReportBadDepth()
+ {
$body =
- '<?xml version="1.0"?>' .
- '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
- '<d:prop>' .
- ' <c:calendar-data>' .
- ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />' .
- ' </c:calendar-data>' .
- ' <d:getetag />' .
- '</d:prop>' .
- '<c:filter>' .
- ' <c:comp-filter name="VCALENDAR">' .
- ' <c:comp-filter name="VEVENT" />' .
- ' </c:comp-filter>' .
- '</c:filter>' .
+ '<?xml version="1.0"?>'.
+ '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'.
+ '<d:prop>'.
+ ' <c:calendar-data>'.
+ ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />'.
+ ' </c:calendar-data>'.
+ ' <d:getetag />'.
+ '</d:prop>'.
+ '<c:filter>'.
+ ' <c:comp-filter name="VCALENDAR">'.
+ ' <c:comp-filter name="VEVENT" />'.
+ ' </c:comp-filter>'.
+ '</c:filter>'.
'</c:calendar-query>';
$request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', [
@@ -793,26 +783,25 @@ XML;
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(400, $this->response->status, 'Received an unexpected status. Full response body: ' . $this->response->body);
-
+ $this->assertEquals(400, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body);
}
/**
* @depends testCalendarQueryReport
*/
- function testCalendarQueryReportNoCalData() {
-
+ public function testCalendarQueryReportNoCalData()
+ {
$body =
- '<?xml version="1.0"?>' .
- '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
- '<d:prop>' .
- ' <d:getetag />' .
- '</d:prop>' .
- '<c:filter>' .
- ' <c:comp-filter name="VCALENDAR">' .
- ' <c:comp-filter name="VEVENT" />' .
- ' </c:comp-filter>' .
- '</c:filter>' .
+ '<?xml version="1.0"?>'.
+ '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'.
+ '<d:prop>'.
+ ' <d:getetag />'.
+ '</d:prop>'.
+ '<c:filter>'.
+ ' <c:comp-filter name="VCALENDAR">'.
+ ' <c:comp-filter name="VEVENT" />'.
+ ' </c:comp-filter>'.
+ '</c:filter>'.
'</c:calendar-query>';
$request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', [
@@ -823,7 +812,7 @@ XML;
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: ' . $this->response->body);
+ $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body);
$expected = <<<XML
<?xml version="1.0"?>
@@ -841,21 +830,20 @@ XML;
XML;
$this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString());
-
}
/**
* @depends testCalendarQueryReport
*/
- function testCalendarQueryReportNoFilters() {
-
+ public function testCalendarQueryReportNoFilters()
+ {
$body =
- '<?xml version="1.0"?>' .
- '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
- '<d:prop>' .
- ' <c:calendar-data />' .
- ' <d:getetag />' .
- '</d:prop>' .
+ '<?xml version="1.0"?>'.
+ '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'.
+ '<d:prop>'.
+ ' <c:calendar-data />'.
+ ' <d:getetag />'.
+ '</d:prop>'.
'</c:calendar-query>';
$request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467');
@@ -864,30 +852,29 @@ XML;
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(400, $this->response->status, 'Received an unexpected status. Full response body: ' . $this->response->body);
-
+ $this->assertEquals(400, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body);
}
/**
* @depends testSupportedReportSetProperty
* @depends testCalendarMultiGetReport
*/
- function testCalendarQueryReport1Object() {
-
+ public function testCalendarQueryReport1Object()
+ {
$body =
- '<?xml version="1.0"?>' .
- '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
- '<d:prop>' .
- ' <c:calendar-data>' .
- ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />' .
- ' </c:calendar-data>' .
- ' <d:getetag />' .
- '</d:prop>' .
- '<c:filter>' .
- ' <c:comp-filter name="VCALENDAR">' .
- ' <c:comp-filter name="VEVENT" />' .
- ' </c:comp-filter>' .
- '</c:filter>' .
+ '<?xml version="1.0"?>'.
+ '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'.
+ '<d:prop>'.
+ ' <c:calendar-data>'.
+ ' <c:expand start="20000101T000000Z" end="20101231T235959Z" />'.
+ ' </c:calendar-data>'.
+ ' <d:getetag />'.
+ '</d:prop>'.
+ '<c:filter>'.
+ ' <c:comp-filter name="VCALENDAR">'.
+ ' <c:comp-filter name="VEVENT" />'.
+ ' </c:comp-filter>'.
+ '</c:filter>'.
'</c:calendar-query>';
$request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467/UUID-2345', ['Depth' => '0']);
@@ -896,7 +883,7 @@ XML;
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: ' . $this->response->body);
+ $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body);
$expectedIcal = TestUtil::getTestCalendarData();
$expectedIcal = \Sabre\VObject\Reader::read($expectedIcal);
@@ -923,26 +910,25 @@ XML;
XML;
$this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString());
-
}
/**
* @depends testSupportedReportSetProperty
* @depends testCalendarMultiGetReport
*/
- function testCalendarQueryReport1ObjectNoCalData() {
-
+ public function testCalendarQueryReport1ObjectNoCalData()
+ {
$body =
- '<?xml version="1.0"?>' .
- '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
- '<d:prop>' .
- ' <d:getetag />' .
- '</d:prop>' .
- '<c:filter>' .
- ' <c:comp-filter name="VCALENDAR">' .
- ' <c:comp-filter name="VEVENT" />' .
- ' </c:comp-filter>' .
- '</c:filter>' .
+ '<?xml version="1.0"?>'.
+ '<c:calendar-query xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'.
+ '<d:prop>'.
+ ' <d:getetag />'.
+ '</d:prop>'.
+ '<c:filter>'.
+ ' <c:comp-filter name="VCALENDAR">'.
+ ' <c:comp-filter name="VEVENT" />'.
+ ' </c:comp-filter>'.
+ '</c:filter>'.
'</c:calendar-query>';
$request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467/UUID-2345', ['Depth' => '0']);
@@ -951,7 +937,7 @@ XML;
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: ' . $this->response->body);
+ $this->assertEquals(207, $this->response->status, 'Received an unexpected status. Full response body: '.$this->response->body);
$expected = <<<XML
<?xml version="1.0"?>
@@ -969,34 +955,32 @@ XML;
XML;
$this->assertXmlStringEqualsXmlString($expected, $this->response->getBodyAsString());
-
}
- function testHTMLActionsPanel() {
-
+ public function testHTMLActionsPanel()
+ {
$output = '';
$r = $this->server->emit('onHTMLActionsPanel', [$this->server->tree->getNodeForPath('calendars/user1'), &$output]);
$this->assertFalse($r);
- $this->assertTrue(!!strpos($output, 'Display name'));
-
+ $this->assertTrue((bool) strpos($output, 'Display name'));
}
/**
* @depends testCalendarMultiGetReport
*/
- function testCalendarMultiGetReportNoEnd() {
-
+ public function testCalendarMultiGetReportNoEnd()
+ {
$body =
- '<?xml version="1.0"?>' .
- '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
- '<d:prop>' .
- ' <c:calendar-data>' .
- ' <c:expand start="20110101T000000Z" />' .
- ' </c:calendar-data>' .
- ' <d:getetag />' .
- '</d:prop>' .
- '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' .
+ '<?xml version="1.0"?>'.
+ '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'.
+ '<d:prop>'.
+ ' <c:calendar-data>'.
+ ' <c:expand start="20110101T000000Z" />'.
+ ' </c:calendar-data>'.
+ ' <d:getetag />'.
+ '</d:prop>'.
+ '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>'.
'</c:calendar-multiget>';
$request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']);
@@ -1005,25 +989,24 @@ XML;
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: ' . $this->response->body);
-
+ $this->assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: '.$this->response->body);
}
/**
* @depends testCalendarMultiGetReport
*/
- function testCalendarMultiGetReportNoStart() {
-
+ public function testCalendarMultiGetReportNoStart()
+ {
$body =
- '<?xml version="1.0"?>' .
- '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
- '<d:prop>' .
- ' <c:calendar-data>' .
- ' <c:expand end="20110101T000000Z" />' .
- ' </c:calendar-data>' .
- ' <d:getetag />' .
- '</d:prop>' .
- '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' .
+ '<?xml version="1.0"?>'.
+ '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'.
+ '<d:prop>'.
+ ' <c:calendar-data>'.
+ ' <c:expand end="20110101T000000Z" />'.
+ ' </c:calendar-data>'.
+ ' <d:getetag />'.
+ '</d:prop>'.
+ '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>'.
'</c:calendar-multiget>';
$request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']);
@@ -1032,25 +1015,24 @@ XML;
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: ' . $this->response->body);
-
+ $this->assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: '.$this->response->body);
}
/**
* @depends testCalendarMultiGetReport
*/
- function testCalendarMultiGetReportEndBeforeStart() {
-
+ public function testCalendarMultiGetReportEndBeforeStart()
+ {
$body =
- '<?xml version="1.0"?>' .
- '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">' .
- '<d:prop>' .
- ' <c:calendar-data>' .
- ' <c:expand start="20200101T000000Z" end="20110101T000000Z" />' .
- ' </c:calendar-data>' .
- ' <d:getetag />' .
- '</d:prop>' .
- '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' .
+ '<?xml version="1.0"?>'.
+ '<c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">'.
+ '<d:prop>'.
+ ' <c:calendar-data>'.
+ ' <c:expand start="20200101T000000Z" end="20110101T000000Z" />'.
+ ' </c:calendar-data>'.
+ ' <d:getetag />'.
+ '</d:prop>'.
+ '<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>'.
'</c:calendar-multiget>';
$request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']);
@@ -1059,28 +1041,25 @@ XML;
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: ' . $this->response->body);
-
+ $this->assertEquals(400, $this->response->status, 'Invalid HTTP status received. Full response body: '.$this->response->body);
}
/**
* @depends testSupportedReportSetPropertyNonCalendar
*/
- function testCalendarProperties() {
-
+ public function testCalendarProperties()
+ {
$ns = '{urn:ietf:params:xml:ns:caldav}';
$props = $this->server->getProperties('calendars/user1/UUID-123467', [
- $ns . 'max-resource-size',
- $ns . 'supported-calendar-data',
- $ns . 'supported-collation-set',
+ $ns.'max-resource-size',
+ $ns.'supported-calendar-data',
+ $ns.'supported-collation-set',
]);
$this->assertEquals([
- $ns . 'max-resource-size' => 10000000,
- $ns . 'supported-calendar-data' => new Xml\Property\SupportedCalendarData(),
- $ns . 'supported-collation-set' => new Xml\Property\SupportedCollationSet(),
+ $ns.'max-resource-size' => 10000000,
+ $ns.'supported-calendar-data' => new Xml\Property\SupportedCalendarData(),
+ $ns.'supported-collation-set' => new Xml\Property\SupportedCollationSet(),
], $props);
-
}
-
}