aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php')
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php90
1 files changed, 39 insertions, 51 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php b/vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php
index da28b6979..6c10afa9f 100644
--- a/vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php
@@ -8,7 +8,7 @@ use Sabre\HTTP;
/**
* Tests related to the PUT request.
*
- * @copyright Copyright (C) 2007-2014 fruux GmbH. All rights reserved.
+ * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
@@ -21,13 +21,13 @@ class HttpDeleteTest extends DAVServerTest {
*/
public function setUpTree() {
- $this->tree = new Mock\Collection('root', array(
+ $this->tree = new Mock\Collection('root', [
'file1' => 'foo',
- 'dir' => array(
+ 'dir' => [
'subfile' => 'bar',
'subfile2' => 'baz',
- ),
- ));
+ ],
+ ]);
}
@@ -36,24 +36,22 @@ class HttpDeleteTest extends DAVServerTest {
*/
public function testDelete() {
- $request = new HTTP\Request(array(
- 'REQUEST_URI' => '/file1',
- 'REQUEST_METHOD' => 'DELETE',
- ));
+ $request = new HTTP\Request('DELETE', '/file1');
$response = $this->request($request);
$this->assertEquals(
- 'HTTP/1.1 204 No Content',
- $response->status,
- "Incorrect status code. Response body: " . $response->body
+ 204,
+ $response->getStatus(),
+ "Incorrect status code. Response body: " . $response->getBodyAsString()
);
$this->assertEquals(
- array(
- 'Content-Length' => '0',
- ),
- $response->headers
+ [
+ 'X-Sabre-Version' => [Version::VERSION],
+ 'Content-Length' => ['0'],
+ ],
+ $response->getHeaders()
);
}
@@ -63,24 +61,22 @@ class HttpDeleteTest extends DAVServerTest {
*/
public function testDeleteDirectory() {
- $request = new HTTP\Request(array(
- 'REQUEST_URI' => '/dir',
- 'REQUEST_METHOD' => 'DELETE',
- ));
+ $request = new HTTP\Request('DELETE', '/dir');
$response = $this->request($request);
$this->assertEquals(
- 'HTTP/1.1 204 No Content',
- $response->status,
- "Incorrect status code. Response body: " . $response->body
+ 204,
+ $response->getStatus(),
+ "Incorrect status code. Response body: " . $response->getBodyAsString()
);
$this->assertEquals(
- array(
- 'Content-Length' => '0',
- ),
- $response->headers
+ [
+ 'X-Sabre-Version' => [Version::VERSION],
+ 'Content-Length' => ['0'],
+ ],
+ $response->getHeaders()
);
}
@@ -90,17 +86,13 @@ class HttpDeleteTest extends DAVServerTest {
*/
public function testDeleteNotFound() {
- $request = new HTTP\Request(array(
- 'REQUEST_URI' => '/file2',
- 'REQUEST_METHOD' => 'DELETE',
- ));
-
+ $request = new HTTP\Request('DELETE', '/file2');
$response = $this->request($request);
$this->assertEquals(
- 'HTTP/1.1 404 Not Found',
- $response->status,
- "Incorrect status code. Response body: " . $response->body
+ 404,
+ $response->getStatus(),
+ "Incorrect status code. Response body: " . $response->getBodyAsString()
);
}
@@ -110,18 +102,16 @@ class HttpDeleteTest extends DAVServerTest {
*/
public function testDeletePreconditions() {
- $request = new HTTP\Request(array(
- 'REQUEST_URI' => '/file1',
- 'REQUEST_METHOD' => 'DELETE',
- 'HTTP_IF_MATCH' => '"' . md5('foo') . '"',
- ));
+ $request = new HTTP\Request('DELETE', '/file1', [
+ 'If-Match' => '"' . md5('foo') . '"',
+ ]);
$response = $this->request($request);
$this->assertEquals(
- 'HTTP/1.1 204 No Content',
- $response->status,
- "Incorrect status code. Response body: " . $response->body
+ 204,
+ $response->getStatus(),
+ "Incorrect status code. Response body: " . $response->getBodyAsString()
);
}
@@ -131,18 +121,16 @@ class HttpDeleteTest extends DAVServerTest {
*/
public function testDeletePreconditionsFailed() {
- $request = new HTTP\Request(array(
- 'REQUEST_URI' => '/file1',
- 'REQUEST_METHOD' => 'DELETE',
- 'HTTP_IF_MATCH' => '"' . md5('bar') . '"',
- ));
+ $request = new HTTP\Request('DELETE', '/file1', [
+ 'If-Match' => '"' . md5('bar') . '"',
+ ]);
$response = $this->request($request);
$this->assertEquals(
- 'HTTP/1.1 412 Precondition failed',
- $response->status,
- "Incorrect status code. Response body: " . $response->body
+ 412,
+ $response->getStatus(),
+ "Incorrect status code. Response body: " . $response->getBodyAsString()
);
}