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) --- vendor/sabre/dav/tests/Sabre/DAV/HttpPutTest.php | 111 ++++++++++------------- 1 file changed, 49 insertions(+), 62 deletions(-) (limited to 'vendor/sabre/dav/tests/Sabre/DAV/HttpPutTest.php') diff --git a/vendor/sabre/dav/tests/Sabre/DAV/HttpPutTest.php b/vendor/sabre/dav/tests/Sabre/DAV/HttpPutTest.php index 86480b1c2..d3932a4c6 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/HttpPutTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/HttpPutTest.php @@ -1,5 +1,7 @@ tree = new Mock\Collection('root', [ 'file1' => 'foo', ]); - } /** * A successful PUT of a new file. */ - function testPut() { - + public function testPut() + { $request = new HTTP\Request('PUT', '/file2', [], 'hello'); $response = $this->request($request); - $this->assertEquals(201, $response->getStatus(), 'Incorrect status code received. Full response body:' . $response->getBodyAsString()); + $this->assertEquals(201, $response->getStatus(), 'Incorrect status code received. Full response body:'.$response->getBodyAsString()); $this->assertEquals( 'hello', @@ -46,12 +45,11 @@ class HttpPutTest extends DAVServerTest { $this->assertEquals( [ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"' . md5('hello') . '"'] + 'Content-Length' => ['0'], + 'ETag' => ['"'.md5('hello').'"'], ], $response->getHeaders() ); - } /** @@ -59,8 +57,8 @@ class HttpPutTest extends DAVServerTest { * * @depends testPut */ - function testPutExisting() { - + public function testPutExisting() + { $request = new HTTP\Request('PUT', '/file1', [], 'bar'); $response = $this->request($request); @@ -75,21 +73,20 @@ class HttpPutTest extends DAVServerTest { $this->assertEquals( [ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"' . md5('bar') . '"'] + 'Content-Length' => ['0'], + 'ETag' => ['"'.md5('bar').'"'], ], $response->getHeaders() ); - } /** - * PUT on existing file with If-Match: * + * PUT on existing file with If-Match: *. * * @depends testPutExisting */ - function testPutExistingIfMatchStar() { - + public function testPutExistingIfMatchStar() + { $request = new HTTP\Request( 'PUT', '/file1', @@ -109,25 +106,24 @@ class HttpPutTest extends DAVServerTest { $this->assertEquals( [ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"' . md5('hello') . '"'] + 'Content-Length' => ['0'], + 'ETag' => ['"'.md5('hello').'"'], ], $response->getHeaders() ); - } /** - * PUT on existing file with If-Match: with a correct etag + * PUT on existing file with If-Match: with a correct etag. * * @depends testPutExisting */ - function testPutExistingIfMatchCorrect() { - + public function testPutExistingIfMatchCorrect() + { $request = new HTTP\Request( 'PUT', '/file1', - ['If-Match' => '"' . md5('foo') . '"'], + ['If-Match' => '"'.md5('foo').'"'], 'hello' ); @@ -143,12 +139,11 @@ class HttpPutTest extends DAVServerTest { $this->assertEquals( [ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"' . md5('hello') . '"'], + 'Content-Length' => ['0'], + 'ETag' => ['"'.md5('hello').'"'], ], $response->getHeaders() ); - } /** @@ -156,8 +151,8 @@ class HttpPutTest extends DAVServerTest { * * @depends testPut */ - function testPutContentRange() { - + public function testPutContentRange() + { $request = new HTTP\Request( 'PUT', '/file2', @@ -167,7 +162,6 @@ class HttpPutTest extends DAVServerTest { $response = $this->request($request); $this->assertEquals(400, $response->getStatus()); - } /** @@ -175,8 +169,8 @@ class HttpPutTest extends DAVServerTest { * * @depends testPut */ - function testPutIfNoneMatchStar() { - + public function testPutIfNoneMatchStar() + { $request = new HTTP\Request( 'PUT', '/file2', @@ -196,12 +190,11 @@ class HttpPutTest extends DAVServerTest { $this->assertEquals( [ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"' . md5('hello') . '"'] + 'Content-Length' => ['0'], + 'ETag' => ['"'.md5('hello').'"'], ], $response->getHeaders() ); - } /** @@ -209,8 +202,8 @@ class HttpPutTest extends DAVServerTest { * * @depends testPut */ - function testPutIfMatchStar() { - + public function testPutIfMatchStar() + { $request = new HTTP\Request( 'PUT', '/file2', @@ -221,7 +214,6 @@ class HttpPutTest extends DAVServerTest { $response = $this->request($request); $this->assertEquals(412, $response->getStatus()); - } /** @@ -229,8 +221,8 @@ class HttpPutTest extends DAVServerTest { * * @depends testPut */ - function testPutExistingIfNoneMatchStar() { - + public function testPutExistingIfNoneMatchStar() + { $request = new HTTP\Request( 'PUT', '/file1', @@ -242,7 +234,6 @@ class HttpPutTest extends DAVServerTest { $response = $this->request($request); $this->assertEquals(412, $response->getStatus()); - } /** @@ -250,8 +241,8 @@ class HttpPutTest extends DAVServerTest { * * @depends testPut */ - function testPutNoParent() { - + public function testPutNoParent() + { $request = new HTTP\Request( 'PUT', '/file1/file2', @@ -261,7 +252,6 @@ class HttpPutTest extends DAVServerTest { $response = $this->request($request); $this->assertEquals(409, $response->getStatus()); - } /** @@ -271,8 +261,8 @@ class HttpPutTest extends DAVServerTest { * * @depends testPut */ - function testFinderPutSuccess() { - + public function testFinderPutSuccess() + { $request = new HTTP\Request( 'PUT', '/file2', @@ -291,12 +281,11 @@ class HttpPutTest extends DAVServerTest { $this->assertEquals( [ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"' . md5('hello') . '"'], + 'Content-Length' => ['0'], + 'ETag' => ['"'.md5('hello').'"'], ], $response->getHeaders() ); - } /** @@ -304,8 +293,8 @@ class HttpPutTest extends DAVServerTest { * * @depends testFinderPutSuccess */ - function testFinderPutFail() { - + public function testFinderPutFail() + { $request = new HTTP\Request( 'PUT', '/file2', @@ -316,7 +305,6 @@ class HttpPutTest extends DAVServerTest { $response = $this->request($request); $this->assertEquals(403, $response->getStatus()); - } /** @@ -324,17 +312,18 @@ class HttpPutTest extends DAVServerTest { * * @depends testPut */ - function testPutIntercept() { - - $this->server->on('beforeBind', function($uri) { + public function testPutIntercept() + { + $this->server->on('beforeBind', function ($uri) { $this->server->httpResponse->setStatus(418); + return false; }); $request = new HTTP\Request('PUT', '/file2', [], 'hello'); $response = $this->request($request); - $this->assertEquals(418, $response->getStatus(), 'Incorrect status code received. Full response body: ' . $response->getBodyAsString()); + $this->assertEquals(418, $response->getStatus(), 'Incorrect status code received. Full response body: '.$response->getBodyAsString()); $this->assertFalse( $this->server->tree->nodeExists('file2') @@ -343,7 +332,5 @@ class HttpPutTest extends DAVServerTest { $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], ], $response->getHeaders()); - } - } -- cgit v1.2.3