diff options
author | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2014-06-28 22:28:08 +0200 |
---|---|---|
committer | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2014-06-29 01:17:07 +0200 |
commit | 03b31d113ea316c8384a4cbf3d27ca22bb528eac (patch) | |
tree | 92ed87436b09ab806f9effff08145408044d77f4 /vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php | |
parent | f49b74c5f6ebe57937fb6dfea7d2e917f4680ce9 (diff) | |
download | volse-hubzilla-03b31d113ea316c8384a4cbf3d27ca22bb528eac.tar.gz volse-hubzilla-03b31d113ea316c8384a4cbf3d27ca22bb528eac.tar.bz2 volse-hubzilla-03b31d113ea316c8384a4cbf3d27ca22bb528eac.zip |
Update SabreDAV from 1.8.9 to 1.8.10.
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php')
-rw-r--r-- | vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php b/vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php new file mode 100644 index 000000000..da28b6979 --- /dev/null +++ b/vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php @@ -0,0 +1,149 @@ +<?php + +namespace Sabre\DAV; + +use Sabre\DAVServerTest; +use Sabre\HTTP; + +/** + * Tests related to the PUT request. + * + * @copyright Copyright (C) 2007-2014 fruux GmbH. All rights reserved. + * @author Evert Pot (http://evertpot.com/) + * @license http://sabre.io/license/ Modified BSD License + */ +class HttpDeleteTest extends DAVServerTest { + + /** + * Sets up the DAV tree. + * + * @return void + */ + public function setUpTree() { + + $this->tree = new Mock\Collection('root', array( + 'file1' => 'foo', + 'dir' => array( + 'subfile' => 'bar', + 'subfile2' => 'baz', + ), + )); + + } + + /** + * A successful DELETE + */ + public function testDelete() { + + $request = new HTTP\Request(array( + 'REQUEST_URI' => '/file1', + 'REQUEST_METHOD' => 'DELETE', + )); + + $response = $this->request($request); + + $this->assertEquals( + 'HTTP/1.1 204 No Content', + $response->status, + "Incorrect status code. Response body: " . $response->body + ); + + $this->assertEquals( + array( + 'Content-Length' => '0', + ), + $response->headers + ); + + } + + /** + * Deleting a Directory + */ + public function testDeleteDirectory() { + + $request = new HTTP\Request(array( + 'REQUEST_URI' => '/dir', + 'REQUEST_METHOD' => 'DELETE', + )); + + $response = $this->request($request); + + $this->assertEquals( + 'HTTP/1.1 204 No Content', + $response->status, + "Incorrect status code. Response body: " . $response->body + ); + + $this->assertEquals( + array( + 'Content-Length' => '0', + ), + $response->headers + ); + + } + + /** + * DELETE on a node that does not exist + */ + public function testDeleteNotFound() { + + $request = new HTTP\Request(array( + 'REQUEST_URI' => '/file2', + 'REQUEST_METHOD' => 'DELETE', + )); + + $response = $this->request($request); + + $this->assertEquals( + 'HTTP/1.1 404 Not Found', + $response->status, + "Incorrect status code. Response body: " . $response->body + ); + + } + + /** + * DELETE with preconditions + */ + public function testDeletePreconditions() { + + $request = new HTTP\Request(array( + 'REQUEST_URI' => '/file1', + 'REQUEST_METHOD' => 'DELETE', + 'HTTP_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 + ); + + } + + /** + * DELETE with incorrect preconditions + */ + public function testDeletePreconditionsFailed() { + + $request = new HTTP\Request(array( + 'REQUEST_URI' => '/file1', + 'REQUEST_METHOD' => 'DELETE', + 'HTTP_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 + ); + + } +} |