diff options
author | Mario <mario@mariovavti.com> | 2020-05-07 23:35:02 +0200 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2020-05-07 23:35:02 +0200 |
commit | fae70bf0a7f1b566d25e30064f60d58ab150951a (patch) | |
tree | 1714511edb85ed0e28034ed9371d5fc515504fd6 /vendor/sabre/dav/tests/Sabre/DAV | |
parent | ffd2faf8a09a870e8dbecb3ad168e0a9b25941d3 (diff) | |
download | volse-hubzilla-fae70bf0a7f1b566d25e30064f60d58ab150951a.tar.gz volse-hubzilla-fae70bf0a7f1b566d25e30064f60d58ab150951a.tar.bz2 volse-hubzilla-fae70bf0a7f1b566d25e30064f60d58ab150951a.zip |
Revert "composer updates"
This reverts commit dbfe748d274f6843fc91a3071df7be45c4ab5b00
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAV')
31 files changed, 413 insertions, 54 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php b/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php index 807b66382..bf1e22aea 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php @@ -19,7 +19,7 @@ abstract class AbstractServer extends \PHPUnit\Framework\TestCase protected $server; protected $tempDir = SABRE_TEMPDIR; - public function setup(): void + public function setUp() { $this->response = new HTTP\ResponseMock(); $this->server = new Server($this->getRootNode()); @@ -32,7 +32,7 @@ abstract class AbstractServer extends \PHPUnit\Framework\TestCase file_put_contents(SABRE_TEMPDIR.'/dir/child.txt', 'Child contents'); } - public function teardown(): void + public function tearDown() { $this->deleteTree(SABRE_TEMPDIR, false); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php index a751efdc2..d9af326fe 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php @@ -35,9 +35,11 @@ class AbstractDigestTest extends \PHPUnit\Framework\TestCase ); } + /** + * @expectedException \Sabre\DAV\Exception + */ public function testCheckBadGetUserInfoResponse2() { - $this->expectException('Sabre\DAV\Exception'); $header = 'username=array, realm=myRealm, nonce=12345, uri=/, response=HASH, opaque=1, qop=auth, nc=1, cnonce=1'; $request = HTTP\Sapi::createFromServerArray([ 'REQUEST_METHOD' => 'GET', diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php index 8b874f884..5e34f9c49 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php @@ -8,7 +8,7 @@ abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase { use \Sabre\DAV\DbTestHelperTrait; - public function setup(): void + public function setUp() { $this->dropTables('users'); $this->createSchema('users'); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php index 31a86f9ed..0297b17f9 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php @@ -6,7 +6,7 @@ namespace Sabre\DAV\Auth\Backend; class FileTest extends \PHPUnit\Framework\TestCase { - public function teardown(): void + public function tearDown() { if (file_exists(SABRE_TEMPDIR.'/filebackend')) { unlink(SABRE_TEMPDIR.'/filebackend'); @@ -19,9 +19,11 @@ class FileTest extends \PHPUnit\Framework\TestCase $this->assertTrue($file instanceof File); } + /** + * @expectedException \Sabre\DAV\Exception + */ public function testLoadFileBroken() { - $this->expectException('Sabre\DAV\Exception'); file_put_contents(SABRE_TEMPDIR.'/backend', 'user:realm:hash'); $file = new File(SABRE_TEMPDIR.'/backend'); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php index fca7f722f..730f2a975 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php @@ -44,6 +44,9 @@ class Mock implements BackendInterface * * principals/users/[username] * + * @param RequestInterface $request + * @param ResponseInterface $response + * * @return array */ public function check(RequestInterface $request, ResponseInterface $response) @@ -74,6 +77,9 @@ class Mock implements BackendInterface * WWW-Authenticate headers may already have been set, and you'll want to * append your own WWW-Authenticate header instead of overwriting the * existing one. + * + * @param RequestInterface $request + * @param ResponseInterface $response */ public function challenge(RequestInterface $request, ResponseInterface $response) { diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php index f4810d524..03c8a4624 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php @@ -16,7 +16,7 @@ class PluginTest extends \PHPUnit\Framework\TestCase $this->assertTrue($plugin instanceof Plugin); $fakeServer->addPlugin($plugin); $this->assertEquals($plugin, $fakeServer->getPlugin('auth')); - $this->assertIsArray($plugin->getPluginInfo()); + $this->assertInternalType('array', $plugin->getPluginInfo()); } /** @@ -34,10 +34,10 @@ class PluginTest extends \PHPUnit\Framework\TestCase /** * @depends testInit + * @expectedException \Sabre\DAV\Exception\NotAuthenticated */ public function testAuthenticateFail() { - $this->expectException('Sabre\DAV\Exception\NotAuthenticated'); $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); $backend = new Backend\Mock(); $backend->fail = true; @@ -87,10 +87,10 @@ class PluginTest extends \PHPUnit\Framework\TestCase /** * @depends testInit + * @expectedException \Sabre\DAV\Exception */ public function testNoAuthBackend() { - $this->expectException('Sabre\DAV\Exception'); $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); $plugin = new Plugin(); @@ -100,10 +100,10 @@ class PluginTest extends \PHPUnit\Framework\TestCase /** * @depends testInit + * @expectedException \Sabre\DAV\Exception */ public function testInvalidCheckResponse() { - $this->expectException('Sabre\DAV\Exception'); $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); $backend = new Backend\Mock(); $backend->invalidCheckResponse = true; diff --git a/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php index e9a8eddad..60fcc73fc 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php @@ -6,16 +6,20 @@ namespace Sabre\DAV; class BasicNodeTest extends \PHPUnit\Framework\TestCase { + /** + * @expectedException \Sabre\DAV\Exception\Forbidden + */ public function testPut() { - $this->expectException('Sabre\DAV\Exception\Forbidden'); $file = new FileMock(); $file->put('hi'); } + /** + * @expectedException \Sabre\DAV\Exception\Forbidden + */ public function testGet() { - $this->expectException('Sabre\DAV\Exception\Forbidden'); $file = new FileMock(); $file->get(); } @@ -38,16 +42,20 @@ class BasicNodeTest extends \PHPUnit\Framework\TestCase $this->assertNull($file->getContentType()); } + /** + * @expectedException \Sabre\DAV\Exception\Forbidden + */ public function testDelete() { - $this->expectException('Sabre\DAV\Exception\Forbidden'); $file = new FileMock(); $file->delete(); } + /** + * @expectedException \Sabre\DAV\Exception\Forbidden + */ public function testSetName() { - $this->expectException('Sabre\DAV\Exception\Forbidden'); $file = new FileMock(); $file->setName('hi'); } @@ -80,23 +88,29 @@ class BasicNodeTest extends \PHPUnit\Framework\TestCase $this->assertFalse($dir->childExists('mockfile2')); } + /** + * @expectedException \Sabre\DAV\Exception\NotFound + */ public function testGetChild404() { - $this->expectException('Sabre\DAV\Exception\NotFound'); $dir = new DirectoryMock(); $file = $dir->getChild('blabla'); } + /** + * @expectedException \Sabre\DAV\Exception\Forbidden + */ public function testCreateFile() { - $this->expectException('Sabre\DAV\Exception\Forbidden'); $dir = new DirectoryMock(); $dir->createFile('hello', 'data'); } + /** + * @expectedException \Sabre\DAV\Exception\Forbidden + */ public function testCreateDirectory() { - $this->expectException('Sabre\DAV\Exception\Forbidden'); $dir = new DirectoryMock(); $dir->createDirectory('hello'); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php index cb4d3ce03..1f48256e0 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php @@ -6,9 +6,10 @@ namespace Sabre\DAV\Browser; use Sabre\DAV; +require_once 'Sabre/DAV/AbstractServer.php'; class GuessContentTypeTest extends DAV\AbstractServer { - public function setUp(): void + public function setUp() { parent::setUp(); \Sabre\TestUtil::clearTempDir(); @@ -16,7 +17,7 @@ class GuessContentTypeTest extends DAV\AbstractServer file_put_contents(SABRE_TEMPDIR.'/somefile.hoi', 'blabla'); } - public function tearDown(): void + public function tearDown() { \Sabre\TestUtil::clearTempDir(); parent::tearDown(); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php index 00b2661ac..f51f5546c 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php @@ -7,9 +7,11 @@ namespace Sabre\DAV\Browser; use Sabre\DAV; use Sabre\HTTP; +require_once 'Sabre/DAV/AbstractServer.php'; + class MapGetToPropFindTest extends DAV\AbstractServer { - public function setUp(): void + public function setUp() { parent::setUp(); $this->server->addPlugin(new MapGetToPropFind()); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php index a987525c0..f28661ca7 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php @@ -7,11 +7,13 @@ namespace Sabre\DAV\Browser; use Sabre\DAV; use Sabre\HTTP; +require_once 'Sabre/DAV/AbstractServer.php'; + class PluginTest extends DAV\AbstractServer { protected $plugin; - public function setUp(): void + public function setUp() { parent::setUp(); $this->server->addPlugin($this->plugin = new Plugin()); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php index 85a95c90e..e9362c8e4 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php @@ -6,9 +6,11 @@ namespace Sabre\DAV; use Sabre\HTTP\Response; +require_once 'Sabre/DAV/ClientMock.php'; + class ClientTest extends \PHPUnit\Framework\TestCase { - public function setup(): void + public function setUp() { if (!function_exists('curl_init')) { $this->markTestSkipped('CURL must be installed to test the client'); @@ -23,9 +25,11 @@ class ClientTest extends \PHPUnit\Framework\TestCase $this->assertInstanceOf('Sabre\DAV\ClientMock', $client); } + /** + * @expectedException \InvalidArgumentException + */ public function testConstructNoBaseUri() { - $this->expectException('InvalidArgumentException'); $client = new ClientMock([]); } @@ -135,9 +139,11 @@ XML; ], $request->getHeaders()); } + /** + * @expectedException \Sabre\HTTP\ClientHttpException + */ public function testPropFindError() { - $this->expectException('Sabre\HTTP\ClientHttpException'); $client = new ClientMock([ 'baseUri' => '/', ]); @@ -219,10 +225,10 @@ XML; /** * @depends testPropPatch + * @expectedException \Sabre\HTTP\ClientHttpException */ public function testPropPatchHTTPError() { - $this->expectException('Sabre\HTTP\ClientHttpException'); $client = new ClientMock([ 'baseUri' => '/', ]); @@ -233,10 +239,10 @@ XML; /** * @depends testPropPatch + * @expectedException \Sabre\HTTP\ClientException */ public function testPropPatchMultiStatusError() { - $this->expectException('Sabre\HTTP\ClientException'); $client = new ClientMock([ 'baseUri' => '/', ]); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php index 2b759e5d0..4bc79b597 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php @@ -4,14 +4,16 @@ declare(strict_types=1); namespace Sabre\DAV\FSExt; +require_once 'Sabre/TestUtil.php'; + class FileTest extends \PHPUnit\Framework\TestCase { - public function setup(): void + public function setUp() { file_put_contents(SABRE_TEMPDIR.'/file.txt', 'Contents'); } - public function teardown(): void + public function tearDown() { \Sabre\TestUtil::clearTempDir(); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php index 79ffb0186..f53807e6c 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php @@ -7,6 +7,8 @@ namespace Sabre\DAV\FSExt; use Sabre\DAV; use Sabre\HTTP; +require_once 'Sabre/DAV/AbstractServer.php'; + class ServerTest extends DAV\AbstractServer { protected function getRootNode() diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php b/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php index 36b182c44..500ad6147 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php @@ -6,9 +6,11 @@ namespace Sabre\DAV; use Sabre\HTTP; +require_once 'Sabre/TestUtil.php'; + class Issue33Test extends \PHPUnit\Framework\TestCase { - public function setup(): void + public function setUp() { \Sabre\TestUtil::clearTempDir(); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/FileTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/FileTest.php index 57a3255c7..50f17a7dd 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/FileTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/FileTest.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Sabre\DAV\Locks\Backend; +require_once 'Sabre/TestUtil.php'; + class FileTest extends AbstractTest { public function getBackend() @@ -14,7 +16,7 @@ class FileTest extends AbstractTest return $backend; } - public function teardown(): void + public function tearDown() { \Sabre\TestUtil::clearTempDir(); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php index 02c3d39ba..a2a31e87f 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php @@ -7,9 +7,12 @@ namespace Sabre\DAV\Locks; use Sabre\DAV; use Sabre\HTTP; +require_once 'Sabre/HTTP/ResponseMock.php'; +require_once 'Sabre/TestUtil.php'; + class MSWordTest extends \PHPUnit\Framework\TestCase { - public function teardown(): void + public function tearDown() { \Sabre\TestUtil::clearTempDir(); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php index 96e3939d0..a9c6cc1bc 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php @@ -7,6 +7,8 @@ namespace Sabre\DAV\Locks; use Sabre\DAV; use Sabre\HTTP; +require_once 'Sabre/DAV/AbstractServer.php'; + class PluginTest extends DAV\AbstractServer { /** @@ -14,7 +16,7 @@ class PluginTest extends DAV\AbstractServer */ protected $locksPlugin; - public function setup(): void + public function setUp() { parent::setUp(); $locksBackend = new Backend\File(SABRE_TEMPDIR.'/locksdb'); @@ -849,9 +851,11 @@ class PluginTest extends DAV\AbstractServer $this->assertEquals(LockInfo::TIMEOUT_INFINITE, $this->locksPlugin->getTimeoutHeader()); } + /** + * @expectedException \Sabre\DAV\Exception\BadRequest + */ public function testGetTimeoutHeaderInvalid() { - $this->expectException('Sabre\DAV\Exception\BadRequest'); $request = new HTTP\Request('GET', '/', ['Timeout' => 'yourmom']); $this->server->httpRequest = $request; diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php b/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php index 041274706..e0bdecc09 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php @@ -31,6 +31,7 @@ class Collection extends DAV\Collection * Creates the object. * * @param string $name + * @param array $children * @param Collection $parent */ public function __construct($name, array $children = [], Collection $parent = null) @@ -87,11 +88,8 @@ class Collection extends DAV\Collection * * @return string|null */ - public function createFile($name, $data = null) + public function createFile($name, $data = '') { - if (null === $data) { - $data = ''; - } if (is_resource($data)) { $data = stream_get_contents($data); } @@ -122,6 +120,8 @@ class Collection extends DAV\Collection /** * Adds an already existing node to this collection. + * + * @param \Sabre\DAV\INode $node */ public function addNode(\Sabre\DAV\INode $node) { diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php index 54f7e4cb4..0e3123b35 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php @@ -7,9 +7,11 @@ namespace Sabre\DAV\Mount; use Sabre\DAV; use Sabre\HTTP; +require_once 'Sabre/DAV/AbstractServer.php'; + class PluginTest extends DAV\AbstractServer { - public function setup(): void + public function setUp() { parent::setUp(); $this->server->addPlugin(new Plugin()); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php index 7066c49fc..6b6652967 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php @@ -4,11 +4,13 @@ declare(strict_types=1); namespace Sabre\DAV; +require_once 'Sabre/TestUtil.php'; + class ObjectTreeTest extends \PHPUnit\Framework\TestCase { protected $tree; - public function setup(): void + public function setup() { \Sabre\TestUtil::clearTempDir(); mkdir(SABRE_TEMPDIR.'/root'); @@ -19,7 +21,7 @@ class ObjectTreeTest extends \PHPUnit\Framework\TestCase $this->tree = new Tree($rootNode); } - public function teardown(): void + public function teardown() { \Sabre\TestUtil::clearTempDir(); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/PluginTest.php index 4d99aee7d..0cf6dc4e4 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/PluginTest.php @@ -6,12 +6,14 @@ namespace Sabre\DAV\PartialUpdate; use Sabre\HTTP; +require_once 'Sabre/DAV/PartialUpdate/FileMock.php'; + class PluginTest extends \Sabre\DAVServerTest { protected $node; protected $plugin; - public function setup(): void + public function setUp() { $this->node = new FileMock(); $this->tree[] = $this->node; diff --git a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php index a727a13e2..56b2d576f 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php @@ -18,7 +18,7 @@ class SpecificationTest extends \PHPUnit\Framework\TestCase { protected $server; - public function setup(): void + public function setUp() { $tree = [ new File(SABRE_TEMPDIR.'/foobar.txt'), @@ -32,7 +32,7 @@ class SpecificationTest extends \PHPUnit\Framework\TestCase $this->server = $server; } - public function teardown(): void + public function tearDown() { \Sabre\TestUtil::clearTempDir(); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php index b1f6754ea..7d55ea02e 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php @@ -6,6 +6,8 @@ namespace Sabre\DAV; use Sabre\HTTP; +require_once 'Sabre/DAV/AbstractServer.php'; + class ServerEventsTest extends AbstractServer { private $tempPath; diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php index 47e1e6b4c..bbf820eb5 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php @@ -6,6 +6,9 @@ namespace Sabre\DAV; use Sabre\HTTP; +require_once 'Sabre/DAV/AbstractServer.php'; +require_once 'Sabre/DAV/TestPlugin.php'; + class ServerPluginTest extends AbstractServer { /** @@ -13,7 +16,7 @@ class ServerPluginTest extends AbstractServer */ protected $testPlugin; - public function setup(): void + public function setUp() { parent::setUp(); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php new file mode 100644 index 000000000..fa88e9095 --- /dev/null +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php @@ -0,0 +1,283 @@ +<?php + +declare(strict_types=1); + +namespace Sabre\DAV; + +use Sabre\HTTP; + +require_once 'Sabre/HTTP/ResponseMock.php'; + +class ServerPreconditionsTest extends \PHPUnit\Framework\TestCase +{ + /** + * @expectedException \Sabre\DAV\Exception\PreconditionFailed + */ + public function testIfMatchNoNode() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('GET', '/bar', ['If-Match' => '*']); + $httpResponse = new HTTP\Response(); + $server->checkPreconditions($httpRequest, $httpResponse); + } + + public function testIfMatchHasNode() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('GET', '/foo', ['If-Match' => '*']); + $httpResponse = new HTTP\Response(); + $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); + } + + /** + * @expectedException \Sabre\DAV\Exception\PreconditionFailed + */ + public function testIfMatchWrongEtag() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('GET', '/foo', ['If-Match' => '1234']); + $httpResponse = new HTTP\Response(); + $server->checkPreconditions($httpRequest, $httpResponse); + } + + public function testIfMatchCorrectEtag() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('GET', '/foo', ['If-Match' => '"abc123"']); + $httpResponse = new HTTP\Response(); + $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); + } + + /** + * Evolution sometimes uses \" instead of " for If-Match headers. + * + * @depends testIfMatchCorrectEtag + */ + public function testIfMatchEvolutionEtag() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('GET', '/foo', ['If-Match' => '\\"abc123\\"']); + $httpResponse = new HTTP\Response(); + $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); + } + + public function testIfMatchMultiple() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('GET', '/foo', ['If-Match' => '"hellothere", "abc123"']); + $httpResponse = new HTTP\Response(); + $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); + } + + public function testIfNoneMatchNoNode() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('GET', '/bar', ['If-None-Match' => '*']); + $httpResponse = new HTTP\Response(); + $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); + } + + /** + * @expectedException \Sabre\DAV\Exception\PreconditionFailed + */ + public function testIfNoneMatchHasNode() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('POST', '/foo', ['If-None-Match' => '*']); + $httpResponse = new HTTP\Response(); + $server->checkPreconditions($httpRequest, $httpResponse); + } + + public function testIfNoneMatchWrongEtag() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('POST', '/foo', ['If-None-Match' => '"1234"']); + $httpResponse = new HTTP\Response(); + $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); + } + + public function testIfNoneMatchWrongEtagMultiple() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('POST', '/foo', ['If-None-Match' => '"1234", "5678"']); + $httpResponse = new HTTP\Response(); + $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); + } + + /** + * @expectedException \Sabre\DAV\Exception\PreconditionFailed + */ + public function testIfNoneMatchCorrectEtag() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('POST', '/foo', ['If-None-Match' => '"abc123"']); + $httpResponse = new HTTP\Response(); + $server->checkPreconditions($httpRequest, $httpResponse); + } + + /** + * @expectedException \Sabre\DAV\Exception\PreconditionFailed + */ + public function testIfNoneMatchCorrectEtagMultiple() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('POST', '/foo', ['If-None-Match' => '"1234, "abc123"']); + $httpResponse = new HTTP\Response(); + $server->checkPreconditions($httpRequest, $httpResponse); + } + + public function testIfNoneMatchCorrectEtagAsGet() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('GET', '/foo', ['If-None-Match' => '"abc123"']); + $server->httpResponse = new HTTP\ResponseMock(); + + $this->assertFalse($server->checkPreconditions($httpRequest, $server->httpResponse)); + $this->assertEquals(304, $server->httpResponse->getStatus()); + $this->assertEquals(['ETag' => ['"abc123"']], $server->httpResponse->getHeaders()); + } + + /** + * This was a test written for issue #515. + */ + public function testNoneMatchCorrectEtagEnsureSapiSent() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $server->sapi = new HTTP\SapiMock(); + HTTP\SapiMock::$sent = 0; + $httpRequest = new HTTP\Request('GET', '/foo', ['If-None-Match' => '"abc123"']); + $server->httpRequest = $httpRequest; + $server->httpResponse = new HTTP\ResponseMock(); + + $server->exec(); + + $this->assertFalse($server->checkPreconditions($httpRequest, $server->httpResponse)); + $this->assertEquals(304, $server->httpResponse->getStatus()); + $this->assertEquals([ + 'ETag' => ['"abc123"'], + 'X-Sabre-Version' => [Version::VERSION], + ], $server->httpResponse->getHeaders()); + $this->assertEquals(1, HTTP\SapiMock::$sent); + } + + public function testIfModifiedSinceUnModified() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('GET', '/foo', [ + 'If-Modified-Since' => 'Sun, 06 Nov 1994 08:49:37 GMT', + ]); + $server->httpResponse = new HTTP\ResponseMock(); + $this->assertFalse($server->checkPreconditions($httpRequest, $server->httpResponse)); + + $this->assertEquals(304, $server->httpResponse->status); + $this->assertEquals([ + 'Last-Modified' => ['Sat, 06 Apr 1985 23:30:00 GMT'], + ], $server->httpResponse->getHeaders()); + } + + public function testIfModifiedSinceModified() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('GET', '/foo', [ + 'If-Modified-Since' => 'Tue, 06 Nov 1984 08:49:37 GMT', + ]); + + $httpResponse = new HTTP\ResponseMock(); + $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); + } + + public function testIfModifiedSinceInvalidDate() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('GET', '/foo', [ + 'If-Modified-Since' => 'Your mother', + ]); + $httpResponse = new HTTP\ResponseMock(); + + // Invalid dates must be ignored, so this should return true + $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); + } + + public function testIfModifiedSinceInvalidDate2() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('GET', '/foo', [ + 'If-Unmodified-Since' => 'Sun, 06 Nov 1994 08:49:37 EST', + ]); + $httpResponse = new HTTP\ResponseMock(); + $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); + } + + public function testIfUnmodifiedSinceUnModified() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('GET', '/foo', [ + 'If-Unmodified-Since' => 'Sun, 06 Nov 1994 08:49:37 GMT', + ]); + $httpResponse = new HTTP\Response(); + $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); + } + + /** + * @expectedException \Sabre\DAV\Exception\PreconditionFailed + */ + public function testIfUnmodifiedSinceModified() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('GET', '/foo', [ + 'If-Unmodified-Since' => 'Tue, 06 Nov 1984 08:49:37 GMT', + ]); + $httpResponse = new HTTP\ResponseMock(); + $server->checkPreconditions($httpRequest, $httpResponse); + } + + public function testIfUnmodifiedSinceInvalidDate() + { + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); + $server = new Server($root); + $httpRequest = new HTTP\Request('GET', '/foo', [ + 'If-Unmodified-Since' => 'Sun, 06 Nov 1984 08:49:37 CET', + ]); + $httpResponse = new HTTP\ResponseMock(); + $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); + } +} + +class ServerPreconditionsNode extends File +{ + public function getETag() + { + return '"abc123"'; + } + + public function getLastModified() + { + /* my birthday & time, I believe */ + return strtotime('1985-04-07 01:30 +02:00'); + } + + public function getName() + { + return 'foo'; + } +} diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php index cd1ccfa53..def9a9cfb 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php @@ -6,6 +6,9 @@ namespace Sabre\DAV; use Sabre\HTTP; +require_once 'Sabre/HTTP/ResponseMock.php'; +require_once 'Sabre/DAV/AbstractServer.php'; + class ServerPropsTest extends AbstractServer { protected function getRootNode() @@ -13,7 +16,7 @@ class ServerPropsTest extends AbstractServer return new FSExt\Directory(SABRE_TEMPDIR); } - public function setup(): void + public function setUp() { if (file_exists(SABRE_TEMPDIR.'../.sabredav')) { unlink(SABRE_TEMPDIR.'../.sabredav'); @@ -25,7 +28,7 @@ class ServerPropsTest extends AbstractServer $this->server->addPlugin(new Locks\Plugin(new Locks\Backend\File(SABRE_TEMPDIR.'/.locksdb'))); } - public function teardown(): void + public function tearDown() { parent::tearDown(); if (file_exists(SABRE_TEMPDIR.'../.locksdb')) { diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php index 6d5be4608..93ea083d8 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php @@ -23,7 +23,7 @@ class ServerRangeTest extends \Sabre\DAVServerTest */ protected $lastModified; - public function setup(): void + public function setUp() { parent::setUp(); $this->server->createFile('files/test.txt', 'Test contents'); @@ -133,7 +133,7 @@ class ServerRangeTest extends \Sabre\DAVServerTest $request = new HTTP\Request('GET', '/files/no-seeking.txt', ['Range' => 'bytes=2-5']); $response = $this->request($request); - $this->assertEquals(206, $response->getStatus()); + $this->assertEquals(206, $response->getStatus(), $response); $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], 'Content-Type' => ['application/octet-stream'], diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php index e4dd3cdb6..563f558eb 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php @@ -18,9 +18,11 @@ class ServerSimpleTest extends AbstractServer $this->assertEquals($nodes[0], $server->tree->getNodeForPath('hello')); } + /** + * @expectedException \Sabre\DAV\Exception + */ public function testConstructInvalidArg() { - $this->expectException('Sabre\DAV\Exception'); $server = new Server(1); } @@ -187,9 +189,11 @@ class ServerSimpleTest extends AbstractServer } } + /** + * @expectedException \Sabre\DAV\Exception\Forbidden + */ public function testCalculateUriBreakout() { - $this->expectException('Sabre\DAV\Exception\Forbidden'); $uri = '/path1/'; $this->server->setBaseUri('/path2/'); @@ -307,10 +311,10 @@ class ServerSimpleTest extends AbstractServer /** * @depends testGuessBaseUri + * @expectedException \Sabre\DAV\Exception */ public function testGuessBaseUriBadConfig() { - $this->expectException('Sabre\DAV\Exception'); $serverVars = [ 'REQUEST_METHOD' => 'GET', 'REQUEST_URI' => '/index.php/root/heyyy', diff --git a/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php b/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php index bc36c6b78..1e4b92197 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php @@ -72,15 +72,19 @@ class StringUtilTest extends \PHPUnit\Framework\TestCase ]; } + /** + * @expectedException \Sabre\DAV\Exception\BadRequest + */ public function testBadCollation() { - $this->expectException('Sabre\DAV\Exception\BadRequest'); StringUtil::textMatch('foobar', 'foo', 'blabla', 'contains'); } + /** + * @expectedException \Sabre\DAV\Exception\BadRequest + */ public function testBadMatchType() { - $this->expectException('Sabre\DAV\Exception\BadRequest'); StringUtil::textMatch('foobar', 'foo', 'i;octet', 'booh'); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php b/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php index 951078bf0..bae5b58bf 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php @@ -8,7 +8,7 @@ use Sabre\HTTP; class TemporaryFileFilterTest extends AbstractServer { - public function setup(): void + public function setUp() { parent::setUp(); $plugin = new TemporaryFileFilterPlugin(SABRE_TEMPDIR.'/tff'); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php index e3f04ea3a..51ff5ccde 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php @@ -203,6 +203,8 @@ class TreeFileTester extends File implements IProperties * * To update specific properties, call the 'handle' method on this object. * Read the PropPatch documentation for more information. + * + * @param PropPatch $propPatch */ public function propPatch(PropPatch $propPatch) { @@ -219,6 +221,8 @@ class TreeMultiGetTester extends TreeDirectoryTester implements IMultiGet * * If any children are not found, you do not have to return them. * + * @param array $paths + * * @return array */ public function getMultipleChildren(array $paths) |