diff options
author | Mario <mario@mariovavti.com> | 2019-11-10 14:18:18 +0100 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2019-11-10 14:18:18 +0100 |
commit | e1b923ab7d9070631b9bcf24fe1c42678f827169 (patch) | |
tree | 402fc0be56a0000701d969697ba1f271a66b8413 /vendor/sabre/dav/tests/Sabre/DAVServerTest.php | |
parent | bed9876d68ac72a27f3c05fa3ed5c4ccad39b72e (diff) | |
parent | 580c3f4ffe9608d2beb56d418c68b3b112420e76 (diff) | |
download | volse-hubzilla-e1b923ab7d9070631b9bcf24fe1c42678f827169.tar.gz volse-hubzilla-e1b923ab7d9070631b9bcf24fe1c42678f827169.tar.bz2 volse-hubzilla-e1b923ab7d9070631b9bcf24fe1c42678f827169.zip |
Merge branch 'cherry-pick-6685381f' into 'dev'
another bulk of composer updates
See merge request hubzilla/core!1781
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAVServerTest.php')
-rw-r--r-- | vendor/sabre/dav/tests/Sabre/DAVServerTest.php | 70 |
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); } - } |