aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/DAVServerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAVServerTest.php')
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAVServerTest.php70
1 files changed, 32 insertions, 38 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAVServerTest.php b/vendor/sabre/dav/tests/Sabre/DAVServerTest.php
index 35f240d23..982090d23 100644
--- a/vendor/sabre/dav/tests/Sabre/DAVServerTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAVServerTest.php
@@ -1,10 +1,11 @@
<?php
+declare(strict_types=1);
+
namespace Sabre;
use Sabre\HTTP\Request;
use Sabre\HTTP\Response;
-use Sabre\HTTP\Sapi;
/**
* This class may be used as a basis for other webdav-related unittests.
@@ -16,8 +17,8 @@ use Sabre\HTTP\Sapi;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-abstract class DAVServerTest extends \PHPUnit_Framework_TestCase {
-
+abstract class DAVServerTest extends \PHPUnit\Framework\TestCase
+{
protected $setupCalDAV = false;
protected $setupCardDAV = false;
protected $setupACL = false;
@@ -33,7 +34,7 @@ abstract class DAVServerTest extends \PHPUnit_Framework_TestCase {
/**
* An array with calendars. Every calendar should have
* - principaluri
- * - uri
+ * - uri.
*/
protected $caldavCalendars = [];
protected $caldavCalendarObjects = [];
@@ -54,27 +55,27 @@ abstract class DAVServerTest extends \PHPUnit_Framework_TestCase {
protected $propertyStorageBackend;
/**
- * @var Sabre\CalDAV\Plugin
+ * @var \Sabre\CalDAV\Plugin
*/
protected $caldavPlugin;
/**
- * @var Sabre\CardDAV\Plugin
+ * @var \Sabre\CardDAV\Plugin
*/
protected $carddavPlugin;
/**
- * @var Sabre\DAVACL\Plugin
+ * @var \Sabre\DAVACL\Plugin
*/
protected $aclPlugin;
/**
- * @var Sabre\CalDAV\SharingPlugin
+ * @var \Sabre\CalDAV\SharingPlugin
*/
protected $caldavSharingPlugin;
/**
- * CalDAV scheduling plugin
+ * CalDAV scheduling plugin.
*
* @var CalDAV\Schedule\Plugin
*/
@@ -108,14 +109,13 @@ abstract class DAVServerTest extends \PHPUnit_Framework_TestCase {
*/
protected $autoLogin = null;
- function setUp() {
-
+ public function setUp()
+ {
$this->initializeEverything();
-
}
- function initializeEverything() {
-
+ public function initializeEverything()
+ {
$this->setUpBackends();
$this->setUpTree();
@@ -173,7 +173,6 @@ abstract class DAVServerTest extends \PHPUnit_Framework_TestCase {
$this->aclPlugin->adminPrincipals = ['principals/admin'];
$this->server->addPlugin($this->aclPlugin);
}
-
}
/**
@@ -187,11 +186,12 @@ abstract class DAVServerTest extends \PHPUnit_Framework_TestCase {
* the test.
*
* @param array|\Sabre\HTTP\Request $request
- * @param int $expectedStatus
+ * @param int $expectedStatus
+ *
* @return \Sabre\HTTP\Response
*/
- function request($request, $expectedStatus = null) {
-
+ public function request($request, $expectedStatus = null)
+ {
if (is_array($request)) {
$request = HTTP\Request::createFromServerArray($request);
}
@@ -203,10 +203,10 @@ abstract class DAVServerTest extends \PHPUnit_Framework_TestCase {
if ($expectedStatus) {
$responseBody = $expectedStatus !== $response->getStatus() ? $response->getBodyAsString() : '';
- $this->assertEquals($expectedStatus, $response->getStatus(), 'Incorrect HTTP status received for request. Response body: ' . $responseBody);
+ $this->assertEquals($expectedStatus, $response->getStatus(), 'Incorrect HTTP status received for request. Response body: '.$responseBody);
}
- return $this->server->httpResponse;
+ return $this->server->httpResponse;
}
/**
@@ -215,9 +215,10 @@ abstract class DAVServerTest extends \PHPUnit_Framework_TestCase {
*
* @param string $userName
*/
- function autoLogin($userName) {
+ public function autoLogin($userName)
+ {
$authBackend = new DAV\Auth\Backend\Mock();
- $authBackend->setPrincipal('principals/' . $userName);
+ $authBackend->setPrincipal('principals/'.$userName);
$this->authPlugin = new DAV\Auth\Plugin($authBackend);
// If the auth plugin already exists, we're removing its hooks:
@@ -227,14 +228,14 @@ abstract class DAVServerTest extends \PHPUnit_Framework_TestCase {
$this->server->addPlugin($this->authPlugin);
// This will trigger the actual login procedure
- $this->authPlugin->beforeMethod(new Request(), new Response());
+ $this->authPlugin->beforeMethod(new Request('GET', '/'), new Response());
}
/**
* Override this to provide your own Tree for your test-case.
*/
- function setUpTree() {
-
+ public function setUpTree()
+ {
if ($this->setupCalDAV) {
$this->tree[] = new CalDAV\CalendarRoot(
$this->principalBackend,
@@ -258,15 +259,12 @@ abstract class DAVServerTest extends \PHPUnit_Framework_TestCase {
);
}
if ($this->setupFiles) {
-
$this->tree[] = new DAV\Mock\Collection('files');
-
}
-
}
- function setUpBackends() {
-
+ public function setUpBackends()
+ {
if ($this->setupCalDAVSharing && is_null($this->caldavBackend)) {
$this->caldavBackend = new CalDAV\Backend\MockSharing($this->caldavCalendars, $this->caldavCalendarObjects);
}
@@ -289,18 +287,14 @@ abstract class DAVServerTest extends \PHPUnit_Framework_TestCase {
if ($this->setupLocks) {
$this->locksBackend = new DAV\Locks\Backend\Mock();
}
- if ($this->setupPropertyStorage) {
+ if ($this->setupPropertyStorage) {
$this->propertyStorageBackend = new DAV\PropertyStorage\Backend\Mock();
}
-
}
-
- function assertHttpStatus($expectedStatus, HTTP\Request $req) {
-
+ public function assertHttpStatus($expectedStatus, HTTP\Request $req)
+ {
$resp = $this->request($req);
- $this->assertEquals((int)$expectedStatus, (int)$resp->status, 'Incorrect HTTP status received: ' . $resp->body);
-
+ $this->assertEquals((int) $expectedStatus, (int) $resp->status, 'Incorrect HTTP status received: '.$resp->body);
}
-
}