[Pkg-owncloud-commits] [php-sabredav] 29/36: Modernizing the caldav plugin test.
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 13:35:25 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabredav.
commit bb5da593ce20821282d330c02d86256cf660929f
Author: Evert Pot <me at evertpot.com>
Date: Sun Jul 19 19:18:37 2015 -0400
Modernizing the caldav plugin test.
---
tests/Sabre/CalDAV/PluginTest.php | 349 ++++++++++++++++----------------------
1 file changed, 142 insertions(+), 207 deletions(-)
diff --git a/tests/Sabre/CalDAV/PluginTest.php b/tests/Sabre/CalDAV/PluginTest.php
index f5d2fd0..126c376 100644
--- a/tests/Sabre/CalDAV/PluginTest.php
+++ b/tests/Sabre/CalDAV/PluginTest.php
@@ -2,12 +2,11 @@
namespace Sabre\CalDAV;
-use
- Sabre\DAVACL,
- Sabre\DAV,
- Sabre\HTTP,
- DateTime,
- DateTimeZone;
+use Sabre\DAVACL;
+use Sabre\DAV;
+use Sabre\HTTP;
+use DateTime;
+use DateTimeZone;
class PluginTest extends \PHPUnit_Framework_TestCase {
@@ -27,45 +26,47 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
function setup() {
- $this->caldavBackend = new Backend\Mock(array(
- array(
- 'id' => 1,
- 'uri' => 'UUID-123467',
- 'principaluri' => 'principals/user1',
- '{DAV:}displayname' => 'user1 calendar',
- '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar description',
- '{http://apple.com/ns/ical/}calendar-order' => '1',
- '{http://apple.com/ns/ical/}calendar-color' => '#FF0000',
- '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VEVENT','VTODO']),
- ),
- array(
- 'id' => 2,
- 'uri' => 'UUID-123468',
- 'principaluri' => 'principals/user1',
- '{DAV:}displayname' => 'user1 calendar2',
- '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar description',
- '{http://apple.com/ns/ical/}calendar-order' => '1',
- '{http://apple.com/ns/ical/}calendar-color' => '#FF0000',
- '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Xml\Property\SupportedCalendarComponentSet(['VEVENT','VTODO']),
- )
- ), array(
- 1 => array(
- 'UUID-2345' => array(
+ $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' => 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',array('principals/user1'));
- $principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-write',array('principals/user1'));
- $principalBackend->addPrincipal(array(
+ $principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-read', ['principals/user1']);
+ $principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-write', ['principals/user1']);
+ $principalBackend->addPrincipal([
'uri' => 'principals/admin/calendar-proxy-read',
- ));
- $principalBackend->addPrincipal(array(
+ ]);
+ $principalBackend->addPrincipal([
'uri' => 'principals/admin/calendar-proxy-write',
- ));
+ ]);
- $calendars = new CalendarRoot($principalBackend,$this->caldavBackend);
+ $calendars = new CalendarRoot($principalBackend, $this->caldavBackend);
$principals = new Principal\Collection($principalBackend);
$root = new DAV\SimpleCollection('root');
@@ -99,8 +100,8 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
function testSimple() {
- $this->assertEquals(array('MKCALENDAR'), $this->plugin->getHTTPMethods('calendars/user1/randomnewcalendar'));
- $this->assertEquals(array('calendar-access','calendar-proxy'), $this->plugin->getFeatures());
+ $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']
@@ -110,25 +111,18 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
function testUnknownMethodPassThrough() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'MKBREAKFAST',
- 'REQUEST_URI' => '/',
- ));
+ $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() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
- 'HTTP_CONTENT_TYPE' => 'application/xml',
- 'REQUEST_URI' => '/',
- ));
+ $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" />');
$this->server->httpRequest = $request;
@@ -140,10 +134,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
function testMkCalendarBadLocation() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'MKCALENDAR',
- 'REQUEST_URI' => '/blabla',
- ));
+ $request = new HTTP\Request('MKCALENDAR', '/blabla');
$body = '<?xml version="1.0" encoding="utf-8" ?>
<C:mkcalendar xmlns:D="DAV:"
@@ -193,10 +184,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
function testMkCalendarNoParentNode() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'MKCALENDAR',
- 'REQUEST_URI' => '/doesntexist/calendar',
- ));
+ $request = new HTTP\Request('MKCALENDAR', '/doesntexist/calendar');
$body = '<?xml version="1.0" encoding="utf-8" ?>
<C:mkcalendar xmlns:D="DAV:"
@@ -246,10 +234,10 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
function testMkCalendarExistingCalendar() {
- $request = HTTP\Sapi::createFromServerArray(array(
+ $request = HTTP\Sapi::createFromServerArray([
'REQUEST_METHOD' => 'MKCALENDAR',
'REQUEST_URI' => '/calendars/user1/UUID-123467',
- ));
+ ]);
$body = '<?xml version="1.0" encoding="utf-8" ?>
<C:mkcalendar xmlns:D="DAV:"
@@ -299,10 +287,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
function testMkCalendarSucceed() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'MKCALENDAR',
- 'REQUEST_URI' => '/calendars/user1/NEWCALENDAR',
- ));
+ $request = new HTTP\Request('MKCALENDAR', '/calendars/user1/NEWCALENDAR');
$timezone = 'BEGIN:VCALENDAR
PRODID:-//Example Corp.//CalDAV Client//EN
@@ -347,31 +332,31 @@ 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) {
+ foreach ($calendars as $calendar) {
if ($calendar['uri'] === 'NEWCALENDAR') {
$newCalendar = $calendar;
break;
}
}
- $this->assertInternalType('array',$newCalendar);
+ $this->assertInternalType('array', $newCalendar);
- $keys = array(
- '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',
+ $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',
'{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => null,
- );
+ ];
- foreach($keys as $key=>$value) {
+ foreach ($keys as $key => $value) {
$this->assertArrayHasKey($key, $newCalendar);
@@ -381,43 +366,40 @@ END:VCALENDAR';
}
$sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
$this->assertTrue($newCalendar[$sccs] instanceof Xml\Property\SupportedCalendarComponentSet);
- $this->assertEquals(array('VEVENT'),$newCalendar[$sccs]->getValue());
+ $this->assertEquals(['VEVENT'], $newCalendar[$sccs]->getValue());
}
function testMkCalendarEmptyBodySucceed() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'MKCALENDAR',
- 'REQUEST_URI' => '/calendars/user1/NEWCALENDAR',
- ));
+ $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) {
+ foreach ($calendars as $calendar) {
if ($calendar['uri'] === 'NEWCALENDAR') {
$newCalendar = $calendar;
break;
}
}
- $this->assertInternalType('array',$newCalendar);
+ $this->assertInternalType('array', $newCalendar);
- $keys = array(
- 'uri' => 'NEWCALENDAR',
- 'id' => null,
+ $keys = [
+ 'uri' => 'NEWCALENDAR',
+ 'id' => null,
'{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => null,
- );
+ ];
- foreach($keys as $key=>$value) {
+ foreach ($keys as $key => $value) {
$this->assertArrayHasKey($key, $newCalendar);
@@ -427,17 +409,13 @@ END:VCALENDAR';
}
$sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
$this->assertTrue($newCalendar[$sccs] instanceof Xml\Property\SupportedCalendarComponentSet);
- $this->assertEquals(array('VEVENT','VTODO'),$newCalendar[$sccs]->getValue());
+ $this->assertEquals(['VEVENT', 'VTODO'], $newCalendar[$sccs]->getValue());
}
function testMkCalendarBadXml() {
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'MKCALENDAR',
- 'REQUEST_URI' => '/blabla',
- ));
-
+ $request = new HTTP\Request('MKCALENDAR', '/blabla');
$body = 'This is not xml';
$request->setBody($body);
@@ -450,64 +428,62 @@ END:VCALENDAR';
function testPrincipalProperties() {
- $httpRequest = HTTP\Sapi::createFromServerArray(array(
- 'HTTP_HOST' => 'sabredav.org',
- ));
+ $httpRequest = new HTTP\Request('FOO', '/blabla', ['Host' => 'sabredav.org']);
$this->server->httpRequest = $httpRequest;
- $props = $this->server->getPropertiesForPath('/principals/user1',array(
+ $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',
- ));
+ ]);
- $this->assertArrayHasKey(0,$props);
- $this->assertArrayHasKey(200,$props[0]);
+ $this->assertArrayHasKey(0, $props);
+ $this->assertArrayHasKey(200, $props[0]);
- $this->assertArrayHasKey('{urn:ietf:params:xml:ns:caldav}calendar-home-set',$props[0][200]);
+ $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);
- $this->assertEquals('calendars/user1/',$prop->getHref());
+ $this->assertEquals('calendars/user1/', $prop->getHref());
$this->assertArrayHasKey('{http://calendarserver.org/ns/}calendar-proxy-read-for', $props[0][200]);
$prop = $props[0][200]['{http://calendarserver.org/ns/}calendar-proxy-read-for'];
$this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $prop);
- $this->assertEquals(array('principals/admin/'), $prop->getHrefs());
+ $this->assertEquals(['principals/admin/'], $prop->getHrefs());
$this->assertArrayHasKey('{http://calendarserver.org/ns/}calendar-proxy-write-for', $props[0][200]);
$prop = $props[0][200]['{http://calendarserver.org/ns/}calendar-proxy-write-for'];
$this->assertInstanceOf('Sabre\\DAV\\Xml\\Property\\Href', $prop);
- $this->assertEquals(array('principals/admin/'), $prop->getHrefs());
+ $this->assertEquals(['principals/admin/'], $prop->getHrefs());
- $this->assertArrayHasKey('{' . Plugin::NS_CALENDARSERVER . '}email-address-set',$props[0][200]);
+ $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 at sabredav.org'],$prop->getValue());
+ $this->assertEquals(['user1.sabredav at sabredav.org'], $prop->getValue());
}
function testSupportedReportSetPropertyNonCalendar() {
- $props = $this->server->getPropertiesForPath('/calendars/user1',array(
+ $props = $this->server->getPropertiesForPath('/calendars/user1', [
'{DAV:}supported-report-set',
- ));
+ ]);
- $this->assertArrayHasKey(0,$props);
- $this->assertArrayHasKey(200,$props[0]);
- $this->assertArrayHasKey('{DAV:}supported-report-set',$props[0][200]);
+ $this->assertArrayHasKey(0, $props);
+ $this->assertArrayHasKey(200, $props[0]);
+ $this->assertArrayHasKey('{DAV:}supported-report-set', $props[0][200]);
$prop = $props[0][200]['{DAV:}supported-report-set'];
$this->assertInstanceOf('\\Sabre\\DAV\\Xml\\Property\\SupportedReportSet', $prop);
- $value = array(
+ $value = [
'{DAV:}expand-property',
'{DAV:}principal-property-search',
'{DAV:}principal-search-property-set'
- );
- $this->assertEquals($value,$prop->getValue());
+ ];
+ $this->assertEquals($value, $prop->getValue());
}
@@ -516,26 +492,26 @@ END:VCALENDAR';
*/
function testSupportedReportSetProperty() {
- $props = $this->server->getPropertiesForPath('/calendars/user1/UUID-123467',array(
+ $props = $this->server->getPropertiesForPath('/calendars/user1/UUID-123467', [
'{DAV:}supported-report-set',
- ));
+ ]);
- $this->assertArrayHasKey(0,$props);
- $this->assertArrayHasKey(200,$props[0]);
- $this->assertArrayHasKey('{DAV:}supported-report-set',$props[0][200]);
+ $this->assertArrayHasKey(0, $props);
+ $this->assertArrayHasKey(200, $props[0]);
+ $this->assertArrayHasKey('{DAV:}supported-report-set', $props[0][200]);
$prop = $props[0][200]['{DAV:}supported-report-set'];
$this->assertInstanceOf('\\Sabre\\DAV\\Xml\\Property\\SupportedReportSet', $prop);
- $value = array(
+ $value = [
'{urn:ietf:params:xml:ns:caldav}calendar-multiget',
'{urn:ietf:params:xml:ns:caldav}calendar-query',
'{urn:ietf:params:xml:ns:caldav}free-busy-query',
'{DAV:}expand-property',
'{DAV:}principal-property-search',
'{DAV:}principal-search-property-set'
- );
- $this->assertEquals($value,$prop->getValue());
+ ];
+ $this->assertEquals($value, $prop->getValue());
}
@@ -543,24 +519,24 @@ END:VCALENDAR';
$this->server->addPlugin(new \Sabre\DAV\Sync\Plugin());
- $props = $this->server->getPropertiesForPath('/calendars/user1',array(
+ $props = $this->server->getPropertiesForPath('/calendars/user1', [
'{DAV:}supported-report-set',
- ));
+ ]);
- $this->assertArrayHasKey(0,$props);
- $this->assertArrayHasKey(200,$props[0]);
- $this->assertArrayHasKey('{DAV:}supported-report-set',$props[0][200]);
+ $this->assertArrayHasKey(0, $props);
+ $this->assertArrayHasKey(200, $props[0]);
+ $this->assertArrayHasKey('{DAV:}supported-report-set', $props[0][200]);
$prop = $props[0][200]['{DAV:}supported-report-set'];
$this->assertInstanceOf('\\Sabre\\DAV\\Xml\\Property\\SupportedReportSet', $prop);
- $value = array(
+ $value = [
'{DAV:}sync-collection',
'{DAV:}expand-property',
'{DAV:}principal-property-search',
'{DAV:}principal-search-property-set',
- );
- $this->assertEquals($value,$prop->getValue());
+ ];
+ $this->assertEquals($value, $prop->getValue());
}
@@ -579,17 +555,13 @@ END:VCALENDAR';
'<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' .
'</c:calendar-multiget>';
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
- 'REQUEST_URI' => '/calendars/user1',
- 'HTTP_DEPTH' => '1',
- ));
+ $request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']);
$request->setBody($body);
$this->server->httpRequest = $request;
$this->server->exec();
- $this->assertEquals(207, $this->response->status,'Invalid HTTP status received. Full response body');
+ $this->assertEquals(207, $this->response->status, 'Invalid HTTP status received. Full response body');
$expectedIcal = TestUtil::getTestCalendarData();
@@ -630,17 +602,13 @@ XML;
'<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' .
'</c:calendar-multiget>';
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
- 'REQUEST_URI' => '/calendars/user1',
- 'HTTP_DEPTH' => '1',
- ));
+ $request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']);
$request->setBody($body);
$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);
@@ -692,17 +660,13 @@ XML;
'</c:filter>' .
'</c:calendar-query>';
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
- 'REQUEST_URI' => '/calendars/user1/UUID-123467',
- 'HTTP_DEPTH' => '1',
- ));
+ $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', ['Depth' => '1']);
$request->setBody($body);
$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);
@@ -754,18 +718,16 @@ XML;
'</c:filter>' .
'</c:calendar-query>';
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
- 'REQUEST_URI' => '/calendars/user1/UUID-123467',
- 'HTTP_USER_AGENT' => 'MSFT-WP/8.10.14219 (gzip)',
- 'HTTP_DEPTH' => '0',
- ));
+ $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', [
+ 'Depth' => '0',
+ 'User-Agent' => 'MSFT-WP/8.10.14219 (gzip)',
+ ]);
$request->setBody($body);
$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);
@@ -817,17 +779,15 @@ XML;
'</c:filter>' .
'</c:calendar-query>';
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
- 'REQUEST_URI' => '/calendars/user1/UUID-123467',
- 'HTTP_DEPTH' => '0',
- ));
+ $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', [
+ 'Depth' => '0',
+ ]);
$request->setBody($body);
$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);
}
@@ -849,17 +809,15 @@ XML;
'</c:filter>' .
'</c:calendar-query>';
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
- 'REQUEST_URI' => '/calendars/user1//UUID-123467',
- 'HTTP_DEPTH' => '1',
- ));
+ $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467', [
+ 'Depth' => '1',
+ ]);
$request->setBody($body);
$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"?>
@@ -894,16 +852,13 @@ XML;
'</d:prop>' .
'</c:calendar-query>';
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
- 'REQUEST_URI' => '/calendars/user1//UUID-123467',
- ));
+ $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467');
$request->setBody($body);
$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);
}
@@ -929,17 +884,13 @@ XML;
'</c:filter>' .
'</c:calendar-query>';
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
- 'REQUEST_URI' => '/calendars/user1/UUID-123467/UUID-2345',
- 'HTTP_DEPTH' => '0',
- ));
+ $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467/UUID-2345', ['Depth' => '0']);
$request->setBody($body);
$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);
@@ -988,17 +939,13 @@ XML;
'</c:filter>' .
'</c:calendar-query>';
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
- 'REQUEST_URI' => '/calendars/user1/UUID-123467/UUID-2345',
- 'HTTP_DEPTH' => '0',
- ));
+ $request = new HTTP\Request('REPORT', '/calendars/user1/UUID-123467/UUID-2345', ['Depth' => '0']);
$request->setBody($body);
$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"?>
@@ -1025,7 +972,7 @@ XML;
$r = $this->server->emit('onHTMLActionsPanel', [$this->server->tree->getNodeForPath('calendars/user1'), &$output]);
$this->assertFalse($r);
- $this->assertTrue(!!strpos($output,'Display name'));
+ $this->assertTrue(!!strpos($output, 'Display name'));
}
@@ -1046,17 +993,13 @@ XML;
'<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' .
'</c:calendar-multiget>';
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
- 'REQUEST_URI' => '/calendars/user1',
- 'HTTP_DEPTH' => '1',
- ));
+ $request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']);
$request->setBody($body);
$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);
}
@@ -1077,17 +1020,13 @@ XML;
'<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' .
'</c:calendar-multiget>';
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
- 'REQUEST_URI' => '/calendars/user1',
- 'HTTP_DEPTH' => '1',
- ));
+ $request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']);
$request->setBody($body);
$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);
}
@@ -1108,17 +1047,13 @@ XML;
'<d:href>/calendars/user1/UUID-123467/UUID-2345</d:href>' .
'</c:calendar-multiget>';
- $request = HTTP\Sapi::createFromServerArray(array(
- 'REQUEST_METHOD' => 'REPORT',
- 'REQUEST_URI' => '/calendars/user1',
- 'HTTP_DEPTH' => '1',
- ));
+ $request = new HTTP\Request('REPORT', '/calendars/user1', ['Depth' => '1']);
$request->setBody($body);
$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);
}
@@ -1135,7 +1070,7 @@ XML;
]);
$this->assertEquals([
- $ns . 'max-resource-size' => 10000000,
+ $ns . 'max-resource-size' => 10000000,
$ns . 'supported-calendar-data' => new Xml\Property\SupportedCalendarData(),
$ns . 'supported-collation-set' => new Xml\Property\SupportedCollationSet(),
], $props);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git
More information about the Pkg-owncloud-commits
mailing list