From 580c3f4ffe9608d2beb56d418c68b3b112420e76 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 10 Nov 2019 12:49:51 +0000 Subject: another bulk of composer updates (cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce) --- .../dav/tests/Sabre/DAV/ServerPreconditionTest.php | 211 ++++++++------------- 1 file changed, 75 insertions(+), 136 deletions(-) (limited to 'vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php') diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php index 203cf26d9..fa88e9095 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php @@ -1,61 +1,55 @@ '*']); $httpResponse = new HTTP\Response(); $server->checkPreconditions($httpRequest, $httpResponse); - } - /** - */ - function testIfMatchHasNode() { - + 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 + * @expectedException \Sabre\DAV\Exception\PreconditionFailed */ - function testIfMatchWrongEtag() { - + 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); - } - /** - */ - function testIfMatchCorrectEtag() { - + 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)); - } /** @@ -63,107 +57,89 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { * * @depends testIfMatchCorrectEtag */ - function testIfMatchEvolutionEtag() { - + 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)); - } - /** - */ - function testIfMatchMultiple() { - + 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)); - } - /** - */ - function testIfNoneMatchNoNode() { - + 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 + * @expectedException \Sabre\DAV\Exception\PreconditionFailed */ - function testIfNoneMatchHasNode() { - + 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); - } - /** - */ - function testIfNoneMatchWrongEtag() { - + 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)); - } - /** - */ - function testIfNoneMatchWrongEtagMultiple() { - + 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 + * @expectedException \Sabre\DAV\Exception\PreconditionFailed */ - function testIfNoneMatchCorrectEtag() { - + 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 + * @expectedException \Sabre\DAV\Exception\PreconditionFailed */ - function testIfNoneMatchCorrectEtagMultiple() { - + 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); - } - /** - */ - function testIfNoneMatchCorrectEtagAsGet() { - + public function testIfNoneMatchCorrectEtagAsGet() + { $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); $httpRequest = new HTTP\Request('GET', '/foo', ['If-None-Match' => '"abc123"']); @@ -172,14 +148,13 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { $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. */ - function testNoneMatchCorrectEtagEnsureSapiSent() { - + public function testNoneMatchCorrectEtagEnsureSapiSent() + { $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); $server->sapi = new HTTP\SapiMock(); @@ -193,22 +168,18 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { $this->assertFalse($server->checkPreconditions($httpRequest, $server->httpResponse)); $this->assertEquals(304, $server->httpResponse->getStatus()); $this->assertEquals([ - 'ETag' => ['"abc123"'], + 'ETag' => ['"abc123"'], 'X-Sabre-Version' => [Version::VERSION], ], $server->httpResponse->getHeaders()); $this->assertEquals(1, HTTP\SapiMock::$sent); - } - /** - */ - function testIfModifiedSinceUnModified() { - + public function testIfModifiedSinceUnModified() + { $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); - $httpRequest = HTTP\Sapi::createFromServerArray([ - 'HTTP_IF_MODIFIED_SINCE' => 'Sun, 06 Nov 1994 08:49:37 GMT', - 'REQUEST_URI' => '/foo' + $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)); @@ -217,128 +188,96 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { $this->assertEquals([ 'Last-Modified' => ['Sat, 06 Apr 1985 23:30:00 GMT'], ], $server->httpResponse->getHeaders()); - } - - /** - */ - function testIfModifiedSinceModified() { - + public function testIfModifiedSinceModified() + { $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); - $httpRequest = HTTP\Sapi::createFromServerArray([ - 'HTTP_IF_MODIFIED_SINCE' => 'Tue, 06 Nov 1984 08:49:37 GMT', - 'REQUEST_URI' => '/foo' + $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)); - } - /** - */ - function testIfModifiedSinceInvalidDate() { - + public function testIfModifiedSinceInvalidDate() + { $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); - $httpRequest = HTTP\Sapi::createFromServerArray([ - 'HTTP_IF_MODIFIED_SINCE' => 'Your mother', - 'REQUEST_URI' => '/foo' + $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)); - } - /** - */ - function testIfModifiedSinceInvalidDate2() { - + public function testIfModifiedSinceInvalidDate2() + { $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); - $httpRequest = HTTP\Sapi::createFromServerArray([ - 'HTTP_IF_MODIFIED_SINCE' => 'Sun, 06 Nov 1994 08:49:37 EST', - 'REQUEST_URI' => '/foo' + $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)); - } - - /** - */ - function testIfUnmodifiedSinceUnModified() { - + public function testIfUnmodifiedSinceUnModified() + { $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); - $httpRequest = HTTP\Sapi::createFromServerArray([ - 'HTTP_IF_UNMODIFIED_SINCE' => 'Sun, 06 Nov 1994 08:49:37 GMT', - 'REQUEST_URI' => '/foo' + $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 + * @expectedException \Sabre\DAV\Exception\PreconditionFailed */ - function testIfUnmodifiedSinceModified() { - + public function testIfUnmodifiedSinceModified() + { $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); - $httpRequest = HTTP\Sapi::createFromServerArray([ - 'HTTP_IF_UNMODIFIED_SINCE' => 'Tue, 06 Nov 1984 08:49:37 GMT', - 'REQUEST_URI' => '/foo' + $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); - } - /** - */ - function testIfUnmodifiedSinceInvalidDate() { - + public function testIfUnmodifiedSinceInvalidDate() + { $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); - $httpRequest = HTTP\Sapi::createFromServerArray([ - 'HTTP_IF_UNMODIFIED_SINCE' => 'Sun, 06 Nov 1984 08:49:37 CET', - 'REQUEST_URI' => '/foo' + $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 { - - function getETag() { - +class ServerPreconditionsNode extends File +{ + public function getETag() + { return '"abc123"'; - } - function getLastModified() { - + public function getLastModified() + { /* my birthday & time, I believe */ return strtotime('1985-04-07 01:30 +02:00'); - } - function getName() { - + public function getName() + { return 'foo'; - } - } -- cgit v1.2.3