Definition at line 10 of file ServerTest.php.
◆ getRootNode()
Sabre\DAV\FSExt\ServerTest::getRootNode |
( |
| ) |
|
|
protected |
Definition at line 12 of file ServerTest.php.
14 return new Directory($this->tempDir);
◆ testDelete()
Sabre\DAV\FSExt\ServerTest::testDelete |
( |
| ) |
|
Definition at line 132 of file ServerTest.php.
References Sabre\DAV\AbstractServer\$request, and Sabre\DAV\Version\VERSION.
134 $request =
new HTTP\Request(
'DELETE',
'/test.txt');
135 $this->server->httpRequest = (
$request);
136 $this->server->exec();
138 $this->assertEquals([
140 'Content-Length' => [
'0'],
141 ], $this->response->getHeaders());
143 $this->assertEquals(204, $this->response->status);
144 $this->assertEquals(
'', $this->response->body);
145 $this->assertFalse(file_exists($this->tempDir .
'/test.txt'));
const VERSION
Full version number.
◆ testDeleteDirectory()
Sabre\DAV\FSExt\ServerTest::testDeleteDirectory |
( |
| ) |
|
Definition at line 149 of file ServerTest.php.
References Sabre\DAV\AbstractServer\$request, and Sabre\DAV\Version\VERSION.
151 mkdir($this->tempDir .
'/testcol');
152 file_put_contents($this->tempDir .
'/testcol/test.txt',
'Hi! I\'m a file with a short lifespan');
154 $request =
new HTTP\Request(
'DELETE',
'/testcol');
155 $this->server->httpRequest = (
$request);
156 $this->server->exec();
158 $this->assertEquals([
160 'Content-Length' => [
'0'],
161 ], $this->response->getHeaders());
162 $this->assertEquals(204, $this->response->status);
163 $this->assertEquals(
'', $this->response->body);
164 $this->assertFalse(file_exists($this->tempDir .
'/testcol'));
const VERSION
Full version number.
◆ testGet()
Sabre\DAV\FSExt\ServerTest::testGet |
( |
| ) |
|
Definition at line 18 of file ServerTest.php.
References $filename, Sabre\DAV\AbstractServer\$request, Sabre\HTTP\Util\toHTTPDate(), and Sabre\DAV\Version\VERSION.
20 $request =
new HTTP\Request(
'GET',
'/test.txt');
22 $this->server->httpRequest =
$request;
23 $this->server->exec();
25 $this->assertEquals(200, $this->response->getStatus(),
'Invalid status code received.');
28 'Content-Type' => [
'application/octet-stream'],
29 'Content-Length' => [13],
33 $this->response->getHeaders()
37 $this->assertEquals(
'Test contents', stream_get_contents($this->response->body));
static toHTTPDate(\DateTime $dateTime)
Transforms a DateTime object to HTTP's most common date format.
const VERSION
Full version number.
◆ testHEAD()
Sabre\DAV\FSExt\ServerTest::testHEAD |
( |
| ) |
|
Definition at line 41 of file ServerTest.php.
References $filename, Sabre\DAV\AbstractServer\$request, Sabre\HTTP\Util\toHTTPDate(), and Sabre\DAV\Version\VERSION.
43 $request =
new HTTP\Request(
'HEAD',
'/test.txt');
45 $this->server->httpRequest = (
$request);
46 $this->server->exec();
50 'Content-Type' => [
'application/octet-stream'],
51 'Content-Length' => [13],
55 $this->response->getHeaders()
58 $this->assertEquals(200, $this->response->status);
59 $this->assertEquals(
'', $this->response->body);
static toHTTPDate(\DateTime $dateTime)
Transforms a DateTime object to HTTP's most common date format.
const VERSION
Full version number.
◆ testMkcol()
Sabre\DAV\FSExt\ServerTest::testMkcol |
( |
| ) |
|
Definition at line 100 of file ServerTest.php.
References Sabre\DAV\AbstractServer\$request, and Sabre\DAV\Version\VERSION.
102 $request =
new HTTP\Request(
'MKCOL',
'/testcol');
103 $this->server->httpRequest = (
$request);
104 $this->server->exec();
106 $this->assertEquals([
108 'Content-Length' => [
'0'],
109 ], $this->response->getHeaders());
111 $this->assertEquals(201, $this->response->status);
112 $this->assertEquals(
'', $this->response->body);
113 $this->assertTrue(is_dir($this->tempDir .
'/testcol'));
const VERSION
Full version number.
◆ testMove()
Sabre\DAV\FSExt\ServerTest::testMove |
( |
| ) |
|
Definition at line 188 of file ServerTest.php.
References Sabre\DAV\AbstractServer\$request, and Sabre\DAV\Version\VERSION.
190 mkdir($this->tempDir .
'/testcol');
192 $request =
new HTTP\Request(
'MOVE',
'/test.txt', [
'Destination' =>
'/testcol/test2.txt']);
193 $this->server->httpRequest = (
$request);
194 $this->server->exec();
196 $this->assertEquals(201, $this->response->status);
197 $this->assertEquals(
'', $this->response->body);
199 $this->assertEquals([
200 'Content-Length' => [
'0'],
202 ], $this->response->getHeaders());
205 is_file($this->tempDir .
'/testcol/test2.txt')
const VERSION
Full version number.
◆ testMoveOtherObject()
Sabre\DAV\FSExt\ServerTest::testMoveOtherObject |
( |
| ) |
|
This test checks if it's possible to move a non-FSExt collection into a FSExt collection.
The moveInto function should ignore the object and let sabredav itself execute the slow move.
Definition at line 218 of file ServerTest.php.
References Sabre\DAV\AbstractServer\$request, $tree, and Sabre\DAV\Version\VERSION.
220 mkdir($this->tempDir .
'/tree1');
221 mkdir($this->tempDir .
'/tree2');
223 $tree =
new DAV\Tree(
new DAV\SimpleCollection(
'root', [
224 new DAV\FS\Directory($this->tempDir .
'/tree1'),
225 new DAV\FSExt\Directory($this->tempDir .
'/tree2'),
227 $this->server->tree =
$tree;
229 $request =
new HTTP\Request(
'MOVE',
'/tree1', [
'Destination' =>
'/tree2/tree1']);
230 $this->server->httpRequest = (
$request);
231 $this->server->exec();
233 $this->assertEquals(201, $this->response->status);
234 $this->assertEquals(
'', $this->response->body);
236 $this->assertEquals([
237 'Content-Length' => [
'0'],
239 ], $this->response->getHeaders());
242 is_dir($this->tempDir .
'/tree2/tree1')
const VERSION
Full version number.
◆ testOptions()
Sabre\DAV\FSExt\ServerTest::testOptions |
( |
| ) |
|
Definition at line 168 of file ServerTest.php.
References Sabre\DAV\AbstractServer\$request, and Sabre\DAV\Version\VERSION.
170 $request =
new HTTP\Request(
'OPTIONS',
'/');
171 $this->server->httpRequest = (
$request);
172 $this->server->exec();
174 $this->assertEquals([
175 'DAV' => [
'1, 3, extended-mkcol'],
176 'MS-Author-Via' => [
'DAV'],
177 'Allow' => [
'OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT'],
178 'Accept-Ranges' => [
'bytes'],
179 'Content-Length' => [
'0'],
181 ], $this->response->getHeaders());
183 $this->assertEquals(200, $this->response->status);
184 $this->assertEquals(
'', $this->response->body);
const VERSION
Full version number.
◆ testPut()
Sabre\DAV\FSExt\ServerTest::testPut |
( |
| ) |
|
Definition at line 63 of file ServerTest.php.
References $filename, Sabre\DAV\AbstractServer\$request, and Sabre\DAV\Version\VERSION.
65 $request =
new HTTP\Request(
'PUT',
'/testput.txt');
66 $filename = $this->tempDir .
'/testput.txt';
67 $request->setBody(
'Testing new file');
68 $this->server->httpRequest = (
$request);
69 $this->server->exec();
73 'Content-Length' => [
'0'],
75 ], $this->response->getHeaders());
77 $this->assertEquals(201, $this->response->status);
78 $this->assertEquals(
'', $this->response->body);
79 $this->assertEquals(
'Testing new file', file_get_contents(
$filename));
const VERSION
Full version number.
◆ testPutAlreadyExists()
Sabre\DAV\FSExt\ServerTest::testPutAlreadyExists |
( |
| ) |
|
Definition at line 83 of file ServerTest.php.
References Sabre\DAV\AbstractServer\$request, and Sabre\DAV\Version\VERSION.
85 $request =
new HTTP\Request(
'PUT',
'/test.txt', [
'If-None-Match' =>
'*']);
86 $request->setBody(
'Testing new file');
87 $this->server->httpRequest = (
$request);
88 $this->server->exec();
92 'Content-Type' => [
'application/xml; charset=utf-8'],
93 ], $this->response->getHeaders());
95 $this->assertEquals(412, $this->response->status);
96 $this->assertNotEquals(
'Testing new file', file_get_contents($this->tempDir .
'/test.txt'));
const VERSION
Full version number.
◆ testPutUpdate()
Sabre\DAV\FSExt\ServerTest::testPutUpdate |
( |
| ) |
|
Definition at line 117 of file ServerTest.php.
References Sabre\DAV\AbstractServer\$request.
119 $request =
new HTTP\Request(
'PUT',
'/test.txt');
120 $request->setBody(
'Testing updated file');
121 $this->server->httpRequest = (
$request);
122 $this->server->exec();
124 $this->assertEquals(
'0', $this->response->getHeader(
'Content-Length'));
126 $this->assertEquals(204, $this->response->status);
127 $this->assertEquals(
'', $this->response->body);
128 $this->assertEquals(
'Testing updated file', file_get_contents($this->tempDir .
'/test.txt'));
The documentation for this class was generated from the following file: