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) --- .../sabre/dav/tests/Sabre/DAV/ServerRangeTest.php | 150 ++++++++++----------- 1 file changed, 70 insertions(+), 80 deletions(-) (limited to 'vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php') diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php index 81224d687..93ea083d8 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerRangeTest.php @@ -1,5 +1,7 @@ server->createFile('files/test.txt', 'Test contents'); - $this->lastModified = HTTP\Util::toHTTPDate( - new DateTime('@' . $this->server->tree->getNodeForPath('files/test.txt')->getLastModified()) + $this->lastModified = HTTP\toDate( + new DateTime('@'.$this->server->tree->getNodeForPath('files/test.txt')->getLastModified()) ); $stream = popen('echo "Test contents"', 'r'); @@ -37,112 +39,106 @@ class ServerRangeTest extends \Sabre\DAVServerTest { ); $streamingFile->setSize(12); $this->server->tree->getNodeForPath('files')->addNode($streamingFile); - } - function testRange() { - + public function testRange() + { $request = new HTTP\Request('GET', '/files/test.txt', ['Range' => 'bytes=2-5']); $response = $this->request($request); $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [4], - 'Content-Range' => ['bytes 2-5/13'], - 'ETag' => ['"' . md5('Test contents') . '"'], - 'Last-Modified' => [$this->lastModified], + 'Content-Type' => ['application/octet-stream'], + 'Content-Length' => [4], + 'Content-Range' => ['bytes 2-5/13'], + 'ETag' => ['"'.md5('Test contents').'"'], + 'Last-Modified' => [$this->lastModified], ], $response->getHeaders() ); $this->assertEquals(206, $response->getStatus()); $this->assertEquals('st c', $response->getBodyAsString()); - } /** * @depends testRange */ - function testStartRange() { - + public function testStartRange() + { $request = new HTTP\Request('GET', '/files/test.txt', ['Range' => 'bytes=2-']); $response = $this->request($request); $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [11], - 'Content-Range' => ['bytes 2-12/13'], - 'ETag' => ['"' . md5('Test contents') . '"'], - 'Last-Modified' => [$this->lastModified], + 'Content-Type' => ['application/octet-stream'], + 'Content-Length' => [11], + 'Content-Range' => ['bytes 2-12/13'], + 'ETag' => ['"'.md5('Test contents').'"'], + 'Last-Modified' => [$this->lastModified], ], $response->getHeaders() ); $this->assertEquals(206, $response->getStatus()); $this->assertEquals('st contents', $response->getBodyAsString()); - } /** * @depends testRange */ - function testEndRange() { - + public function testEndRange() + { $request = new HTTP\Request('GET', '/files/test.txt', ['Range' => 'bytes=-8']); $response = $this->request($request); $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [8], - 'Content-Range' => ['bytes 5-12/13'], - 'ETag' => ['"' . md5('Test contents') . '"'], - 'Last-Modified' => [$this->lastModified], + 'Content-Type' => ['application/octet-stream'], + 'Content-Length' => [8], + 'Content-Range' => ['bytes 5-12/13'], + 'ETag' => ['"'.md5('Test contents').'"'], + 'Last-Modified' => [$this->lastModified], ], $response->getHeaders() ); $this->assertEquals(206, $response->getStatus()); $this->assertEquals('contents', $response->getBodyAsString()); - } /** * @depends testRange */ - function testTooHighRange() { - + public function testTooHighRange() + { $request = new HTTP\Request('GET', '/files/test.txt', ['Range' => 'bytes=100-200']); $response = $this->request($request); $this->assertEquals(416, $response->getStatus()); - } /** * @depends testRange */ - function testCrazyRange() { - + public function testCrazyRange() + { $request = new HTTP\Request('GET', '/files/test.txt', ['Range' => 'bytes=8-4']); $response = $this->request($request); $this->assertEquals(416, $response->getStatus()); - } - function testNonSeekableStream() { - + public function testNonSeekableStream() + { $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([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [4], - 'Content-Range' => ['bytes 2-5/12'], + 'Content-Type' => ['application/octet-stream'], + 'Content-Length' => [4], + 'Content-Range' => ['bytes 2-5/12'], // 'ETag' => ['"' . md5('Test contents') . '"'], 'Last-Modified' => [$this->lastModified], ], @@ -150,113 +146,107 @@ class ServerRangeTest extends \Sabre\DAVServerTest { ); $this->assertEquals('st c', $response->getBodyAsString()); - } /** * @depends testRange */ - function testIfRangeEtag() { - + public function testIfRangeEtag() + { $request = new HTTP\Request('GET', '/files/test.txt', [ - 'Range' => 'bytes=2-5', - 'If-Range' => '"' . md5('Test contents') . '"', + 'Range' => 'bytes=2-5', + 'If-Range' => '"'.md5('Test contents').'"', ]); $response = $this->request($request); $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [4], - 'Content-Range' => ['bytes 2-5/13'], - 'ETag' => ['"' . md5('Test contents') . '"'], - 'Last-Modified' => [$this->lastModified], + 'Content-Type' => ['application/octet-stream'], + 'Content-Length' => [4], + 'Content-Range' => ['bytes 2-5/13'], + 'ETag' => ['"'.md5('Test contents').'"'], + 'Last-Modified' => [$this->lastModified], ], $response->getHeaders() ); $this->assertEquals(206, $response->getStatus()); $this->assertEquals('st c', $response->getBodyAsString()); - } /** * @depends testIfRangeEtag */ - function testIfRangeEtagIncorrect() { - + public function testIfRangeEtagIncorrect() + { $request = new HTTP\Request('GET', '/files/test.txt', [ - 'Range' => 'bytes=2-5', + 'Range' => 'bytes=2-5', 'If-Range' => '"foobar"', ]); $response = $this->request($request); $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [13], - 'ETag' => ['"' . md5('Test contents') . '"'], - 'Last-Modified' => [$this->lastModified], + 'Content-Type' => ['application/octet-stream'], + 'Content-Length' => [13], + 'ETag' => ['"'.md5('Test contents').'"'], + 'Last-Modified' => [$this->lastModified], ], $response->getHeaders() ); $this->assertEquals(200, $response->getStatus()); $this->assertEquals('Test contents', $response->getBodyAsString()); - } /** * @depends testIfRangeEtag */ - function testIfRangeModificationDate() { - + public function testIfRangeModificationDate() + { $request = new HTTP\Request('GET', '/files/test.txt', [ - 'Range' => 'bytes=2-5', + 'Range' => 'bytes=2-5', 'If-Range' => 'tomorrow', ]); $response = $this->request($request); $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [4], - 'Content-Range' => ['bytes 2-5/13'], - 'ETag' => ['"' . md5('Test contents') . '"'], - 'Last-Modified' => [$this->lastModified], + 'Content-Type' => ['application/octet-stream'], + 'Content-Length' => [4], + 'Content-Range' => ['bytes 2-5/13'], + 'ETag' => ['"'.md5('Test contents').'"'], + 'Last-Modified' => [$this->lastModified], ], $response->getHeaders() ); $this->assertEquals(206, $response->getStatus()); $this->assertEquals('st c', $response->getBodyAsString()); - } /** * @depends testIfRangeModificationDate */ - function testIfRangeModificationDateModified() { - + public function testIfRangeModificationDateModified() + { $request = new HTTP\Request('GET', '/files/test.txt', [ - 'Range' => 'bytes=2-5', + 'Range' => 'bytes=2-5', 'If-Range' => '-2 years', ]); $response = $this->request($request); $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/octet-stream'], - 'Content-Length' => [13], - 'ETag' => ['"' . md5('Test contents') . '"'], - 'Last-Modified' => [$this->lastModified], + 'Content-Type' => ['application/octet-stream'], + 'Content-Length' => [13], + 'ETag' => ['"'.md5('Test contents').'"'], + 'Last-Modified' => [$this->lastModified], ], $response->getHeaders() ); $this->assertEquals(200, $response->getStatus()); $this->assertEquals('Test contents', $response->getBodyAsString()); - } - } -- cgit v1.2.3