25 'file1' =>
'content1',
26 'file2' =>
'content2',
28 'file3' =>
'content3',
29 'file4' =>
'content4',
37 $request =
new HTTP\Request(
'COPY',
'/file1', [
38 'Destination' =>
'/file5' 41 $this->assertEquals(201,
$response->getStatus());
42 $this->assertEquals(
'content1', $this->tree->getChild(
'file5')->get());
48 $request =
new HTTP\Request(
'COPY',
'/file1', [
49 'Destination' =>
'/file1' 52 $this->assertEquals(403,
$response->getStatus());
58 $request =
new HTTP\Request(
'COPY',
'/file1', [
59 'Destination' =>
'/file2' 62 $this->assertEquals(204,
$response->getStatus());
63 $this->assertEquals(
'content1', $this->tree->getChild(
'file2')->get());
69 $request =
new HTTP\Request(
'COPY',
'/file1', [
70 'Destination' =>
'/file2',
74 $this->assertEquals(204,
$response->getStatus());
75 $this->assertEquals(
'content1', $this->tree->getChild(
'file2')->get());
81 $request =
new HTTP\Request(
'COPY',
'/file1', [
82 'Destination' =>
'/file2',
86 $this->assertEquals(400,
$response->getStatus());
92 $request =
new HTTP\Request(
'COPY',
'/file1', [
93 'Destination' =>
'/notfound/file2',
96 $this->assertEquals(409,
$response->getStatus());
102 $request =
new HTTP\Request(
'COPY',
'/file1', [
103 'Destination' =>
'/file2',
107 $this->assertEquals(412,
$response->getStatus());
108 $this->assertEquals(
'content2', $this->tree->getChild(
'file2')->get());
114 $this->server->on(
'beforeBind',
function(
$path) {
116 if (
$path ===
'file2') {
121 $request =
new HTTP\Request(
'COPY',
'/file1', [
122 'Destination' =>
'/file2',
128 $this->assertEquals(
'content2', $this->tree->getChild(
'file2')->get());
134 $request =
new HTTP\Request(
'COPY',
'/coll1', [
135 'Destination' =>
'/coll2' 138 $this->assertEquals(201,
$response->getStatus());
139 $this->assertEquals(
'content3', $this->tree->getChild(
'coll2')->getChild(
'file3')->get());
145 $request =
new HTTP\Request(
'COPY',
'/coll1', [
146 'Destination' =>
'/coll1' 149 $this->assertEquals(403,
$response->getStatus());
155 $request =
new HTTP\Request(
'COPY',
'/coll1', [
156 'Destination' =>
'/file2' 159 $this->assertEquals(204,
$response->getStatus());
160 $this->assertEquals(
'content3', $this->tree->getChild(
'file2')->getChild(
'file3')->get());
166 $request =
new HTTP\Request(
'COPY',
'/coll1', [
167 'Destination' =>
'/file2',
171 $this->assertEquals(204,
$response->getStatus());
172 $this->assertEquals(
'content3', $this->tree->getChild(
'file2')->getChild(
'file3')->get());
178 $request =
new HTTP\Request(
'COPY',
'/coll1', [
179 'Destination' =>
'/file2',
183 $this->assertEquals(412,
$response->getStatus());
184 $this->assertEquals(
'content2', $this->tree->getChild(
'file2')->get());
190 $request =
new HTTP\Request(
'COPY',
'/coll1', [
191 'Destination' =>
'/coll1/subcol',
194 $this->assertEquals(409,
$response->getStatus());
testCopyFileToExistingOverwriteBadValue()
setUpTree()
Sets up the DAV tree.
foreach($paths as $path) $request
testCopyCollToExistingOverwriteF()
testCopyFileToExistingOverwriteT()
testCopyFileToExistinBlockedCreateDestination()
testCopyFileNonExistantParent()
This class may be used as a basis for other webdav-related unittests.
Tests related to the COPY request.
testCopyFileToExistingOverwriteF()
testCopyCollIntoSubtree()
testCopyCollToExistingOverwriteT()
request($request, $expectedStatus=null)
Makes a request, and returns a response object.