35 $request =
new HTTP\Request(
'PUT',
'/file2', [],
'hello');
39 $this->assertEquals(201,
$response->getStatus(),
'Incorrect status code received. Full response body:' .
$response->getBodyAsString());
43 $this->server->tree->getNodeForPath(
'file2')->get()
49 'Content-Length' => [
'0'],
50 'ETag' => [
'"' . md5(
'hello') .
'"']
64 $request =
new HTTP\Request(
'PUT',
'/file1', [],
'bar');
68 $this->assertEquals(204,
$response->getStatus());
72 $this->server->tree->getNodeForPath(
'file1')->get()
78 'Content-Length' => [
'0'],
79 'ETag' => [
'"' . md5(
'bar') .
'"']
102 $this->assertEquals(204,
$response->getStatus());
106 $this->server->tree->getNodeForPath(
'file1')->get()
112 'Content-Length' => [
'0'],
113 'ETag' => [
'"' . md5(
'hello') .
'"']
130 [
'If-Match' =>
'"' . md5(
'foo') .
'"'],
136 $this->assertEquals(204,
$response->status);
140 $this->server->tree->getNodeForPath(
'file1')->get()
146 'Content-Length' => [
'0'],
147 'ETag' => [
'"' . md5(
'hello') .
'"'],
164 [
'Content-Range' =>
'bytes/100-200'],
169 $this->assertEquals(400,
$response->getStatus());
183 [
'If-None-Match' =>
'*'],
189 $this->assertEquals(201,
$response->getStatus());
193 $this->server->tree->getNodeForPath(
'file2')->get()
199 'Content-Length' => [
'0'],
200 'ETag' => [
'"' . md5(
'hello') .
'"']
223 $this->assertEquals(412,
$response->getStatus());
237 [
'If-None-Match' =>
'*'],
244 $this->assertEquals(412,
$response->getStatus());
263 $this->assertEquals(409,
$response->getStatus());
279 [
'X-Expected-Entity-Length' =>
'5'],
284 $this->assertEquals(201,
$response->getStatus());
288 $this->server->tree->getNodeForPath(
'file2')->get()
294 'Content-Length' => [
'0'],
295 'ETag' => [
'"' . md5(
'hello') .
'"'],
312 [
'X-Expected-Entity-Length' =>
'5'],
318 $this->assertEquals(403,
$response->getStatus());
329 $this->server->on(
'beforeBind',
function($uri) {
330 $this->server->httpResponse->setStatus(418);
334 $request =
new HTTP\Request(
'PUT',
'/file2', [],
'hello');
337 $this->assertEquals(418,
$response->getStatus(),
'Incorrect status code received. Full response body: ' .
$response->getBodyAsString());
340 $this->server->tree->nodeExists(
'file2')
343 $this->assertEquals([
testFinderPutFail()
Same as the last one, but in this case we're mimicing a failed request.
testPutNoParent()
PUT thats created in a non-collection should be rejected.
foreach($paths as $path) $request
Tests related to the PUT request.
testPutExisting()
A successful PUT on an existing file.
testPutIntercept()
Plugins can intercept PUT.
const VERSION
Full version number.
testFinderPutSuccess()
Finder may sometimes make a request, which gets its content-body stripped.
testPutExistingIfNoneMatchStar()
PUT on existing file with If-None-Match: * should fail.
testPutExistingIfMatchStar()
PUT on existing file with If-Match: *.
This class may be used as a basis for other webdav-related unittests.
testPutIfNoneMatchStar()
PUT on non-existing file with If-None-Match: * should work.
testPut()
A successful PUT of a new file.
testPutIfMatchStar()
PUT on non-existing file with If-Match: * should fail.
request($request, $expectedStatus=null)
Makes a request, and returns a response object.
testPutExistingIfMatchCorrect()
PUT on existing file with If-Match: with a correct etag.
testPutContentRange()
PUT with Content-Range should be rejected.
setUpTree()
Sets up the DAV tree.