diff options
author | Mario <mario@mariovavti.com> | 2020-11-05 08:46:42 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2020-11-05 08:46:42 +0000 |
commit | bafbf0416462c6f18c3fb6c8c06a063c8d6fdae6 (patch) | |
tree | 8929845be585b09d0f420621281c5531e1efad3e /vendor/sabre/dav/tests/Sabre/DAV | |
parent | 6f93d9848c43019d43ea76c27d42d657ba031cd7 (diff) | |
parent | fdefa101d84dc2a9424eaedbdb003a4c30ec5d01 (diff) | |
download | volse-hubzilla-5.0.tar.gz volse-hubzilla-5.0.tar.bz2 volse-hubzilla-5.0.zip |
Merge branch '5.0RC'5.0
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAV')
33 files changed, 149 insertions, 481 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php b/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php index 5f5d666f9..49fedf062 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php @@ -9,17 +9,17 @@ use Sabre\HTTP; abstract class AbstractServer extends \PHPUnit\Framework\TestCase { /** - * @var Sabre\HTTP\ResponseMock + * @var \Sabre\HTTP\ResponseMock */ protected $response; protected $request; /** - * @var Sabre\DAV\Server + * @var \Sabre\DAV\Server */ protected $server; protected $tempDir = SABRE_TEMPDIR; - public function setUp() + public function setup(): void { $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() + public function teardown(): void { $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 d9af326fe..a751efdc2 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php @@ -35,11 +35,9 @@ 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 5e34f9c49..8b874f884 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() + public function setup(): void { $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 0297b17f9..31a86f9ed 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() + public function teardown(): void { if (file_exists(SABRE_TEMPDIR.'/filebackend')) { unlink(SABRE_TEMPDIR.'/filebackend'); @@ -19,11 +19,9 @@ 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 730f2a975..fca7f722f 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php @@ -44,9 +44,6 @@ class Mock implements BackendInterface * * principals/users/[username] * - * @param RequestInterface $request - * @param ResponseInterface $response - * * @return array */ public function check(RequestInterface $request, ResponseInterface $response) @@ -77,9 +74,6 @@ 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 03c8a4624..f4810d524 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->assertInternalType('array', $plugin->getPluginInfo()); + $this->assertIsArray($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 60fcc73fc..e9a8eddad 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php @@ -6,20 +6,16 @@ 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(); } @@ -42,20 +38,16 @@ 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'); } @@ -88,29 +80,23 @@ 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 1f48256e0..cb4d3ce03 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php @@ -6,10 +6,9 @@ namespace Sabre\DAV\Browser; use Sabre\DAV; -require_once 'Sabre/DAV/AbstractServer.php'; class GuessContentTypeTest extends DAV\AbstractServer { - public function setUp() + public function setUp(): void { parent::setUp(); \Sabre\TestUtil::clearTempDir(); @@ -17,7 +16,7 @@ class GuessContentTypeTest extends DAV\AbstractServer file_put_contents(SABRE_TEMPDIR.'/somefile.hoi', 'blabla'); } - public function tearDown() + public function tearDown(): void { \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 de7b85f32..00b2661ac 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php @@ -7,11 +7,9 @@ namespace Sabre\DAV\Browser; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/DAV/AbstractServer.php'; - class MapGetToPropFindTest extends DAV\AbstractServer { - public function setUp() + public function setUp(): void { parent::setUp(); $this->server->addPlugin(new MapGetToPropFind()); @@ -29,7 +27,7 @@ class MapGetToPropFindTest extends DAV\AbstractServer $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Incorrect status response received. Full response body: '.$this->response->body); + $this->assertEquals(207, $this->response->status, 'Incorrect status response received. Full response body: '.$this->response->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php index fb7c63d46..a987525c0 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php @@ -7,13 +7,11 @@ 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() + public function setUp(): void { parent::setUp(); $this->server->addPlugin($this->plugin = new Plugin()); @@ -148,7 +146,7 @@ class PluginTest extends DAV\AbstractServer $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(200, $this->response->getStatus(), 'Error: '.$this->response->body); + $this->assertEquals(200, $this->response->getStatus(), 'Error: '.$this->response->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Type' => ['image/vnd.microsoft.icon'], @@ -164,7 +162,7 @@ class PluginTest extends DAV\AbstractServer $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(404, $this->response->getStatus(), 'Error: '.$this->response->body); + $this->assertEquals(404, $this->response->getStatus(), 'Error: '.$this->response->getBodyAsString()); } public function testGetAssetEscapeBasePath() @@ -173,6 +171,6 @@ class PluginTest extends DAV\AbstractServer $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(404, $this->response->getStatus(), 'Error: '.$this->response->body); + $this->assertEquals(404, $this->response->getStatus(), 'Error: '.$this->response->getBodyAsString()); } } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php index e9362c8e4..85a95c90e 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php @@ -6,11 +6,9 @@ namespace Sabre\DAV; use Sabre\HTTP\Response; -require_once 'Sabre/DAV/ClientMock.php'; - class ClientTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setup(): void { if (!function_exists('curl_init')) { $this->markTestSkipped('CURL must be installed to test the client'); @@ -25,11 +23,9 @@ class ClientTest extends \PHPUnit\Framework\TestCase $this->assertInstanceOf('Sabre\DAV\ClientMock', $client); } - /** - * @expectedException \InvalidArgumentException - */ public function testConstructNoBaseUri() { + $this->expectException('InvalidArgumentException'); $client = new ClientMock([]); } @@ -139,11 +135,9 @@ XML; ], $request->getHeaders()); } - /** - * @expectedException \Sabre\HTTP\ClientHttpException - */ public function testPropFindError() { + $this->expectException('Sabre\HTTP\ClientHttpException'); $client = new ClientMock([ 'baseUri' => '/', ]); @@ -225,10 +219,10 @@ XML; /** * @depends testPropPatch - * @expectedException \Sabre\HTTP\ClientHttpException */ public function testPropPatchHTTPError() { + $this->expectException('Sabre\HTTP\ClientHttpException'); $client = new ClientMock([ 'baseUri' => '/', ]); @@ -239,10 +233,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 4bc79b597..2b759e5d0 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php @@ -4,16 +4,14 @@ declare(strict_types=1); namespace Sabre\DAV\FSExt; -require_once 'Sabre/TestUtil.php'; - class FileTest extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setup(): void { file_put_contents(SABRE_TEMPDIR.'/file.txt', 'Contents'); } - public function tearDown() + public function teardown(): void { \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 daa04c354..79ffb0186 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php @@ -7,8 +7,6 @@ namespace Sabre\DAV\FSExt; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/DAV/AbstractServer.php'; - class ServerTest extends DAV\AbstractServer { protected function getRootNode() @@ -34,7 +32,7 @@ class ServerTest extends DAV\AbstractServer $this->response->getHeaders() ); - $this->assertEquals('Test contents', stream_get_contents($this->response->body)); + $this->assertEquals('Test contents', $this->response->getBodyAsString()); } public function testHEAD() @@ -55,7 +53,7 @@ class ServerTest extends DAV\AbstractServer ); $this->assertEquals(200, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); } public function testPut() @@ -73,7 +71,7 @@ class ServerTest extends DAV\AbstractServer ], $this->response->getHeaders()); $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals('Testing new file', file_get_contents($filename)); } @@ -105,7 +103,7 @@ class ServerTest extends DAV\AbstractServer ], $this->response->getHeaders()); $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertTrue(is_dir($this->tempDir.'/testcol')); } @@ -119,7 +117,7 @@ class ServerTest extends DAV\AbstractServer $this->assertEquals('0', $this->response->getHeader('Content-Length')); $this->assertEquals(204, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals('Testing updated file', file_get_contents($this->tempDir.'/test.txt')); } @@ -135,7 +133,7 @@ class ServerTest extends DAV\AbstractServer ], $this->response->getHeaders()); $this->assertEquals(204, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertFalse(file_exists($this->tempDir.'/test.txt')); } @@ -153,7 +151,7 @@ class ServerTest extends DAV\AbstractServer 'Content-Length' => ['0'], ], $this->response->getHeaders()); $this->assertEquals(204, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertFalse(file_exists($this->tempDir.'/testcol')); } @@ -173,7 +171,7 @@ class ServerTest extends DAV\AbstractServer ], $this->response->getHeaders()); $this->assertEquals(200, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); } public function testMove() @@ -185,7 +183,7 @@ class ServerTest extends DAV\AbstractServer $this->server->exec(); $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals([ 'Content-Length' => ['0'], @@ -220,7 +218,7 @@ class ServerTest extends DAV\AbstractServer $this->server->exec(); $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals([ 'Content-Length' => ['0'], @@ -241,7 +239,7 @@ class ServerTest extends DAV\AbstractServer $this->server->exec(); $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals([ 'Content-Length' => ['0'], diff --git a/vendor/sabre/dav/tests/Sabre/DAV/HTTPPreferParsingTest.php b/vendor/sabre/dav/tests/Sabre/DAV/HTTPPreferParsingTest.php index d0ff77eb4..7d6825612 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/HTTPPreferParsingTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/HTTPPreferParsingTest.php @@ -145,7 +145,7 @@ BLA $response = $this->request($request); - $this->assertEquals('', $response->getBodyAsString(), 'Expected empty body: '.$response->body); + $this->assertEquals('', $response->getBodyAsString(), 'Expected empty body: '.$response->getBodyAsString()); $this->assertEquals(204, $response->status); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php b/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php index 500ad6147..36b182c44 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php @@ -6,11 +6,9 @@ namespace Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/TestUtil.php'; - class Issue33Test extends \PHPUnit\Framework\TestCase { - public function setUp() + public function setup(): void { \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 50f17a7dd..57a3255c7 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/FileTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/FileTest.php @@ -4,8 +4,6 @@ declare(strict_types=1); namespace Sabre\DAV\Locks\Backend; -require_once 'Sabre/TestUtil.php'; - class FileTest extends AbstractTest { public function getBackend() @@ -16,7 +14,7 @@ class FileTest extends AbstractTest return $backend; } - public function tearDown() + public function teardown(): void { \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 a2a31e87f..02c3d39ba 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php @@ -7,12 +7,9 @@ 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() + public function teardown(): void { \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 b3a0ac9af..9279afb5a 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php @@ -7,8 +7,6 @@ namespace Sabre\DAV\Locks; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/DAV/AbstractServer.php'; - class PluginTest extends DAV\AbstractServer { /** @@ -16,7 +14,7 @@ class PluginTest extends DAV\AbstractServer */ protected $locksPlugin; - public function setUp() + public function setup(): void { parent::setUp(); $locksBackend = new Backend\File(SABRE_TEMPDIR.'/locksdb'); @@ -77,9 +75,9 @@ class PluginTest extends DAV\AbstractServer $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); $this->assertTrue(1 === preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')), 'We did not get a valid Locktoken back ('.$this->response->getHeader('Lock-Token').')'); - $this->assertEquals(200, $this->response->status, 'Got an incorrect status back. Response body: '.$this->response->body); + $this->assertEquals(200, $this->response->status, 'Got an incorrect status back. Response body: '.$this->response->getBodyAsString()); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body); + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); $xml = simplexml_load_string($body); $xml->registerXPathNamespace('d', 'urn:DAV'); @@ -102,7 +100,7 @@ class PluginTest extends DAV\AbstractServer foreach ($elements as $elem) { $data = $xml->xpath($elem); - $this->assertEquals(1, count($data), 'We expected 1 match for the xpath expression "'.$elem.'". '.count($data).' were found. Full response body: '.$this->response->body); + $this->assertEquals(1, count($data), 'We expected 1 match for the xpath expression "'.$elem.'". '.count($data).' were found. Full response body: '.$this->response->getBodyAsString()); } $depth = $xml->xpath('/d:prop/d:lockdiscovery/d:activelock/d:depth'); @@ -112,6 +110,32 @@ class PluginTest extends DAV\AbstractServer $this->assertEquals($this->response->getHeader('Lock-Token'), '<'.(string) $token[0].'>', 'Token in response body didn\'t match token in response header.'); } + public function testLockWithContext() + { + $request = new HTTP\Request('LOCK', '/baseuri/test.txt'); + $request->setBody('<?xml version="1.0"?> +<D:lockinfo xmlns:D="DAV:"> + <D:lockscope><D:exclusive/></D:lockscope> + <D:locktype><D:write/></D:locktype> + <D:owner> + <D:href>http://example.org/~ejw/contact.html</D:href> + </D:owner> +</D:lockinfo>'); + + $this->server->setBaseUri('baseuri'); + $this->server->httpRequest = $request; + $this->server->exec(); + + $this->assertEquals(200, $this->response->status, 'Got an incorrect status back. Response body: '.$this->response->getBodyAsString()); + + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); + $xml = simplexml_load_string($body); + $xml->registerXPathNamespace('d', 'urn:DAV'); + + $lockRoot = $xml->xpath('/d:prop/d:lockdiscovery/d:activelock/d:lockroot/d:href'); + $this->assertEquals('baseuri/test.txt', (string) $lockRoot[0]); + } + /** * @depends testLock */ @@ -137,7 +161,7 @@ class PluginTest extends DAV\AbstractServer $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertEquals(423, $this->response->status, 'Full response: '.$this->response->body); + $this->assertEquals(423, $this->response->status, 'Full response: '.$this->response->getBodyAsString()); } /** @@ -267,7 +291,7 @@ class PluginTest extends DAV\AbstractServer $this->response->getHeaders() ); - $this->assertEquals(409, $this->response->status, 'Got an incorrect status code. Full response body: '.$this->response->body); + $this->assertEquals(409, $this->response->status, 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); } /** @@ -329,7 +353,7 @@ class PluginTest extends DAV\AbstractServer $this->server->httpResponse = new HTTP\ResponseMock(); $this->server->invokeMethod($request, $this->server->httpResponse); - $this->assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: '.$this->response->body); + $this->assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Length' => ['0'], @@ -366,7 +390,7 @@ class PluginTest extends DAV\AbstractServer $this->server->httpResponse = new HTTP\ResponseMock(); $this->server->invokeMethod($request, $this->server->httpResponse); - $this->assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: '.$this->response->body); + $this->assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: '.$this->response->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Length' => ['0'], @@ -629,7 +653,7 @@ class PluginTest extends DAV\AbstractServer $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(201, $this->response->status, 'A valid lock-token was provided for the source, so this MOVE operation must succeed. Full response body: '.$this->response->body); + $this->assertEquals(201, $this->response->status, 'A valid lock-token was provided for the source, so this MOVE operation must succeed. Full response body: '.$this->response->getBodyAsString()); } /** @@ -809,7 +833,7 @@ class PluginTest extends DAV\AbstractServer $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(204, $this->response->status, 'Incorrect status received. Full response body:'.$this->response->body); + $this->assertEquals(204, $this->response->status, 'Incorrect status received. Full response body:'.$this->response->getBodyAsString()); } public function testDeleteWithETagOnCollection() @@ -851,11 +875,9 @@ 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 e0bdecc09..041274706 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Mock/Collection.php @@ -31,7 +31,6 @@ 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) @@ -88,8 +87,11 @@ class Collection extends DAV\Collection * * @return string|null */ - public function createFile($name, $data = '') + public function createFile($name, $data = null) { + if (null === $data) { + $data = ''; + } if (is_resource($data)) { $data = stream_get_contents($data); } @@ -120,8 +122,6 @@ 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 c993e609d..54f7e4cb4 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php @@ -7,11 +7,9 @@ namespace Sabre\DAV\Mount; use Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/DAV/AbstractServer.php'; - class PluginTest extends DAV\AbstractServer { - public function setUp() + public function setup(): void { parent::setUp(); $this->server->addPlugin(new Plugin()); @@ -28,7 +26,7 @@ class PluginTest extends DAV\AbstractServer $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(501, $this->response->status, 'We expected GET to not be implemented for Directories. Response body: '.$this->response->body); + $this->assertEquals(501, $this->response->status, 'We expected GET to not be implemented for Directories. Response body: '.$this->response->getBodyAsString()); } public function testMountResponse() @@ -46,8 +44,8 @@ class PluginTest extends DAV\AbstractServer $this->assertEquals(200, $this->response->status); - $xml = simplexml_load_string($this->response->body); - $this->assertInstanceOf('SimpleXMLElement', $xml, 'Response was not a valid xml document. The list of errors:'.print_r(libxml_get_errors(), true).'. xml body: '.$this->response->body.'. What type we got: '.gettype($xml).' class, if object: '.get_class($xml)); + $xml = simplexml_load_string($this->response->getBodyAsString()); + $this->assertInstanceOf('SimpleXMLElement', $xml, 'Response was not a valid xml document. The list of errors:'.print_r(libxml_get_errors(), true).'. xml body: '.$this->response->getBodyAsString().'. What type we got: '.gettype($xml).' class, if object: '.get_class($xml)); $xml->registerXPathNamespace('dm', 'http://purl.org/NET/webdav/mount'); $url = $xml->xpath('//dm:url'); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php index 6b6652967..7066c49fc 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php @@ -4,13 +4,11 @@ declare(strict_types=1); namespace Sabre\DAV; -require_once 'Sabre/TestUtil.php'; - class ObjectTreeTest extends \PHPUnit\Framework\TestCase { protected $tree; - public function setup() + public function setup(): void { \Sabre\TestUtil::clearTempDir(); mkdir(SABRE_TEMPDIR.'/root'); @@ -21,7 +19,7 @@ class ObjectTreeTest extends \PHPUnit\Framework\TestCase $this->tree = new Tree($rootNode); } - public function teardown() + public function teardown(): void { \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 63d692ec9..4d99aee7d 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/PluginTest.php @@ -6,14 +6,12 @@ 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() + public function setup(): void { $this->node = new FileMock(); $this->tree[] = $this->node; @@ -44,7 +42,7 @@ class PluginTest extends \Sabre\DAVServerTest ]); $response = $this->request($request); - $this->assertEquals(400, $response->status, 'Full response body:'.$response->body); + $this->assertEquals(400, $response->status, 'Full response body:'.$response->getBodyAsString()); } public function testPatchNotSupported() @@ -56,7 +54,7 @@ class PluginTest extends \Sabre\DAVServerTest ); $response = $this->request($request); - $this->assertEquals(405, $response->status, 'Full response body:'.$response->body); + $this->assertEquals(405, $response->status, 'Full response body:'.$response->getBodyAsString()); } public function testPatchNoContentType() @@ -68,7 +66,7 @@ class PluginTest extends \Sabre\DAVServerTest ); $response = $this->request($request); - $this->assertEquals(415, $response->status, 'Full response body:'.$response->body); + $this->assertEquals(415, $response->status, 'Full response body:'.$response->getBodyAsString()); } public function testPatchBadRange() @@ -80,7 +78,7 @@ class PluginTest extends \Sabre\DAVServerTest ); $response = $this->request($request); - $this->assertEquals(416, $response->status, 'Full response body:'.$response->body); + $this->assertEquals(416, $response->status, 'Full response body:'.$response->getBodyAsString()); } public function testPatchNoLength() @@ -92,7 +90,7 @@ class PluginTest extends \Sabre\DAVServerTest ); $response = $this->request($request); - $this->assertEquals(411, $response->status, 'Full response body:'.$response->body); + $this->assertEquals(411, $response->status, 'Full response body:'.$response->getBodyAsString()); } public function testPatchSuccess() @@ -104,7 +102,7 @@ class PluginTest extends \Sabre\DAVServerTest ); $response = $this->request($request); - $this->assertEquals(204, $response->status, 'Full response body:'.$response->body); + $this->assertEquals(204, $response->status, 'Full response body:'.$response->getBodyAsString()); $this->assertEquals('aaabbbaa', $this->node->get()); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php index 56b2d576f..a727a13e2 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() + public function setup(): void { $tree = [ new File(SABRE_TEMPDIR.'/foobar.txt'), @@ -32,7 +32,7 @@ class SpecificationTest extends \PHPUnit\Framework\TestCase $this->server = $server; } - public function tearDown() + public function teardown(): void { \Sabre\TestUtil::clearTempDir(); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php index 7d55ea02e..b1f6754ea 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php @@ -6,8 +6,6 @@ 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/ServerMKCOLTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerMKCOLTest.php index 8e5bc6a64..02c6a4633 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerMKCOLTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerMKCOLTest.php @@ -26,7 +26,7 @@ class ServerMKCOLTest extends AbstractServer ], $this->response->getHeaders()); $this->assertEquals(201, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertTrue(is_dir($this->tempDir.'/testcol')); } @@ -129,7 +129,7 @@ class ServerMKCOLTest extends AbstractServer 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - $this->assertEquals(400, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->body); + $this->assertEquals(400, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -160,7 +160,7 @@ class ServerMKCOLTest extends AbstractServer 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - $this->assertEquals(403, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->body); + $this->assertEquals(403, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -191,7 +191,7 @@ class ServerMKCOLTest extends AbstractServer 'Content-Length' => ['0'], ], $this->response->getHeaders()); - $this->assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->body); + $this->assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -224,7 +224,7 @@ class ServerMKCOLTest extends AbstractServer 'Content-Length' => ['0'], ], $this->response->getHeaders()); - $this->assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->body); + $this->assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -248,7 +248,7 @@ class ServerMKCOLTest extends AbstractServer 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - $this->assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->body); + $this->assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -272,7 +272,7 @@ class ServerMKCOLTest extends AbstractServer 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - $this->assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->body); + $this->assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -297,7 +297,7 @@ class ServerMKCOLTest extends AbstractServer 'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT'], ], $this->response->getHeaders()); - $this->assertEquals(405, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->body); + $this->assertEquals(405, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->getBodyAsString()); } /** @@ -323,15 +323,14 @@ class ServerMKCOLTest extends AbstractServer $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Wrong statuscode received. Full response body: '.$this->response->body); + $bodyAsString = $this->response->getBodyAsString(); + $this->assertEquals(207, $this->response->status, 'Wrong statuscode received. Full response body: '.$bodyAsString); $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - $responseBody = $this->response->getBodyAsString(); - $expected = <<<XML <?xml version="1.0"?> <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> @@ -349,7 +348,7 @@ XML; $this->assertXmlStringEqualsXmlString( $expected, - $responseBody + $bodyAsString ); } } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php index 35de59e37..47e1e6b4c 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php @@ -6,9 +6,6 @@ namespace Sabre\DAV; use Sabre\HTTP; -require_once 'Sabre/DAV/AbstractServer.php'; -require_once 'Sabre/DAV/TestPlugin.php'; - class ServerPluginTest extends AbstractServer { /** @@ -16,7 +13,7 @@ class ServerPluginTest extends AbstractServer */ protected $testPlugin; - public function setUp() + public function setup(): void { parent::setUp(); @@ -60,7 +57,7 @@ class ServerPluginTest extends AbstractServer ], $this->response->getHeaders()); $this->assertEquals(200, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals('OPTIONS', $this->testPlugin->beforeMethod); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php deleted file mode 100644 index fa88e9095..000000000 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php +++ /dev/null @@ -1,283 +0,0 @@ -<?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 462fba664..cd1ccfa53 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerPropsTest.php @@ -6,9 +6,6 @@ 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() @@ -16,7 +13,7 @@ class ServerPropsTest extends AbstractServer return new FSExt\Directory(SABRE_TEMPDIR); } - public function setUp() + public function setup(): void { if (file_exists(SABRE_TEMPDIR.'../.sabredav')) { unlink(SABRE_TEMPDIR.'../.sabredav'); @@ -28,7 +25,7 @@ class ServerPropsTest extends AbstractServer $this->server->addPlugin(new Locks\Plugin(new Locks\Backend\File(SABRE_TEMPDIR.'/.locksdb'))); } - public function tearDown() + public function teardown(): void { parent::tearDown(); if (file_exists(SABRE_TEMPDIR.'../.locksdb')) { @@ -58,7 +55,7 @@ class ServerPropsTest extends AbstractServer $this->response->getHeaders() ); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body); + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); $xml = simplexml_load_string($body); $xml->registerXPathNamespace('d', 'urn:DAV'); @@ -83,7 +80,7 @@ class ServerPropsTest extends AbstractServer $this->response->getHeaders() ); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body); + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); $xml = simplexml_load_string($body); $xml->registerXPathNamespace('d', 'urn:DAV'); @@ -105,7 +102,7 @@ class ServerPropsTest extends AbstractServer $this->sendRequest($xml); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body); + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); $xml = simplexml_load_string($body); $xml->registerXPathNamespace('d', 'urn:DAV'); @@ -139,7 +136,7 @@ class ServerPropsTest extends AbstractServer $this->sendRequest($xml); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body); + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); $xml = simplexml_load_string($body); $xml->registerXPathNamespace('d', 'urn:DAV'); @@ -157,7 +154,7 @@ class ServerPropsTest extends AbstractServer </d:propfind>'; $this->sendRequest($xml); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body); + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->getBodyAsString()); $xml = simplexml_load_string($body); $xml->registerXPathNamespace('d', 'urn:DAV'); $pathTests = [ diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php index 93ea083d8..6d5be4608 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() + public function setup(): void { 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(), $response); + $this->assertEquals(206, $response->getStatus()); $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 53153151b..e4dd3cdb6 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php @@ -18,11 +18,9 @@ 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); } @@ -42,7 +40,7 @@ class ServerSimpleTest extends AbstractServer ], $this->response->getHeaders()); $this->assertEquals(200, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); } public function testOptionsUnmapped() @@ -62,7 +60,7 @@ class ServerSimpleTest extends AbstractServer ], $this->response->getHeaders()); $this->assertEquals(200, $this->response->status); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); } public function testNonExistantMethod() @@ -189,11 +187,9 @@ class ServerSimpleTest extends AbstractServer } } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ public function testCalculateUriBreakout() { + $this->expectException('Sabre\DAV\Exception\Forbidden'); $uri = '/path1/'; $this->server->setBaseUri('/path2/'); @@ -311,10 +307,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', @@ -371,7 +367,7 @@ class ServerSimpleTest extends AbstractServer $this->response->getHeaders() ); - $this->assertEquals(415, $this->response->status, 'We got an incorrect status back. Full response body follows: '.$this->response->body); + $this->assertEquals(415, $this->response->status, 'We got an incorrect status back. Full response body follows: '.$this->response->getBodyAsString()); } public function testReportIntercepted() @@ -394,7 +390,7 @@ class ServerSimpleTest extends AbstractServer $this->response->getHeaders() ); - $this->assertEquals(418, $this->response->status, 'We got an incorrect status back. Full response body follows: '.$this->response->body); + $this->assertEquals(418, $this->response->status, 'We got an incorrect status back. Full response body follows: '.$this->response->getBodyAsString()); } public function reportHandler($reportName, $result, $path) diff --git a/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php b/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php index 1e4b92197..bc36c6b78 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php @@ -72,19 +72,15 @@ 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 352c8a3e7..951078bf0 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() + public function setup(): void { parent::setUp(); $plugin = new TemporaryFileFilterPlugin(SABRE_TEMPDIR.'/tff'); @@ -22,7 +22,7 @@ class TemporaryFileFilterTest extends AbstractServer $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals(201, $this->response->status); $this->assertEquals('0', $this->response->getHeader('Content-Length')); @@ -37,7 +37,7 @@ class TemporaryFileFilterTest extends AbstractServer $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals(201, $this->response->status); $this->assertEquals([ 'X-Sabre-Temp' => ['true'], @@ -54,7 +54,7 @@ class TemporaryFileFilterTest extends AbstractServer $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals(201, $this->response->status); $this->assertEquals([ 'X-Sabre-Temp' => ['true'], @@ -78,7 +78,7 @@ class TemporaryFileFilterTest extends AbstractServer $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals(201, $this->response->status); $this->assertEquals([ 'X-Sabre-Temp' => ['true'], @@ -147,7 +147,7 @@ class TemporaryFileFilterTest extends AbstractServer $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); $this->assertEquals(201, $this->response->status); $this->assertEquals([ 'X-Sabre-Temp' => ['true'], @@ -157,12 +157,12 @@ class TemporaryFileFilterTest extends AbstractServer $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(204, $this->response->status, "Incorrect status code received. Full body:\n".$this->response->body); + $this->assertEquals(204, $this->response->status, "Incorrect status code received. Full body:\n".$this->response->getBodyAsString()); $this->assertEquals([ 'X-Sabre-Temp' => ['true'], ], $this->response->getHeaders()); - $this->assertEquals('', $this->response->body); + $this->assertEquals('', $this->response->getBodyAsString()); } public function testPutPropfind() @@ -172,7 +172,8 @@ class TemporaryFileFilterTest extends AbstractServer $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('', $this->response->body); + $bodyAsString = $this->response->getBodyAsString(); + $this->assertEquals('', $bodyAsString); $this->assertEquals(201, $this->response->status); $this->assertEquals([ 'X-Sabre-Temp' => ['true'], @@ -183,13 +184,14 @@ class TemporaryFileFilterTest extends AbstractServer $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Incorrect status code returned. Body: '.$this->response->body); + $bodyAsString = $this->response->getBodyAsString(); + $this->assertEquals(207, $this->response->status, 'Incorrect status code returned. Body: '.$bodyAsString); $this->assertEquals([ 'X-Sabre-Temp' => ['true'], 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders()); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $this->response->body); + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", 'xmlns\\1="urn:DAV"', $bodyAsString); $xml = simplexml_load_string($body); $xml->registerXPathNamespace('d', 'urn:DAV'); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php index 51ff5ccde..e3f04ea3a 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php @@ -203,8 +203,6 @@ 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) { @@ -221,8 +219,6 @@ 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) |