ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAV\ServerMKCOLTest Class Reference
+ Inheritance diagram for Sabre\DAV\ServerMKCOLTest:
+ Collaboration diagram for Sabre\DAV\ServerMKCOLTest:

Public Member Functions

 testMkcol ()
 
 testMKCOLUnknownBody ()
 @depends testMkcol More...
 
 testMKCOLBrokenXML ()
 @depends testMkcol More...
 
 testMKCOLUnknownXML ()
 @depends testMkcol More...
 
 testMKCOLNoResourceType ()
 @depends testMkcol More...
 
 testMKCOLIncorrectResourceType ()
 @depends testMkcol More...
 
 testMKCOLSuccess ()
 @depends testMKCOLIncorrectResourceType More...
 
 testMKCOLWhiteSpaceResourceType ()
 @depends testMKCOLIncorrectResourceType More...
 
 testMKCOLNoParent ()
 @depends testMKCOLIncorrectResourceType More...
 
 testMKCOLParentIsNoCollection ()
 @depends testMKCOLIncorrectResourceType More...
 
 testMKCOLAlreadyExists ()
 @depends testMKCOLIncorrectResourceType More...
 
 testMKCOLAndProps ()
 @depends testMKCOLSuccess @depends testMKCOLAlreadyExists More...
 
- Public Member Functions inherited from Sabre\DAV\AbstractServer
 setUp ()
 
 tearDown ()
 

Additional Inherited Members

- Protected Member Functions inherited from Sabre\DAV\AbstractServer
 getRootNode ()
 
- Protected Attributes inherited from Sabre\DAV\AbstractServer
 $response
 
 $request
 
 $server
 
 $tempDir = SABRE_TEMPDIR
 

Detailed Description

Definition at line 7 of file ServerMKCOLTest.php.

Member Function Documentation

◆ testMkcol()

Sabre\DAV\ServerMKCOLTest::testMkcol ( )

Definition at line 9 of file ServerMKCOLTest.php.

9 {
10
11 $serverVars = [
12 'REQUEST_URI' => '/testcol',
13 'REQUEST_METHOD' => 'MKCOL',
14 ];
15
17 $request->setBody("");
18 $this->server->httpRequest = ($request);
19 $this->server->exec();
20
21 $this->assertEquals([
22 'X-Sabre-Version' => [Version::VERSION],
23 'Content-Length' => ['0'],
24 ], $this->response->getHeaders());
25
26 $this->assertEquals(201, $this->response->status);
27 $this->assertEquals('', $this->response->body);
28 $this->assertTrue(is_dir($this->tempDir . '/testcol'));
29
30 }
const VERSION
Full version number.
Definition: Version.php:17
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.
Definition: Sapi.php:107

References Sabre\DAV\AbstractServer\$request, Sabre\HTTP\Sapi\createFromServerArray(), and Sabre\DAV\Version\VERSION.

+ Here is the call graph for this function:

◆ testMKCOLAlreadyExists()

Sabre\DAV\ServerMKCOLTest::testMKCOLAlreadyExists ( )

@depends testMKCOLIncorrectResourceType

Definition at line 289 of file ServerMKCOLTest.php.

289 {
290
291 $serverVars = [
292 'REQUEST_URI' => '/test.txt',
293 'REQUEST_METHOD' => 'MKCOL',
294 ];
295
297 $request->setBody('');
298
299 $this->server->httpRequest = ($request);
300 $this->server->exec();
301
302 $this->assertEquals([
303 'X-Sabre-Version' => [Version::VERSION],
304 'Content-Type' => ['application/xml; charset=utf-8'],
305 'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT'],
306 ], $this->response->getHeaders());
307
308 $this->assertEquals(405, $this->response->status, 'Wrong statuscode received. Full response body: ' . $this->response->body);
309
310 }

References Sabre\DAV\AbstractServer\$request, Sabre\HTTP\Sapi\createFromServerArray(), and Sabre\DAV\Version\VERSION.

+ Here is the call graph for this function:

◆ testMKCOLAndProps()

Sabre\DAV\ServerMKCOLTest::testMKCOLAndProps ( )

@depends testMKCOLSuccess @depends testMKCOLAlreadyExists

Definition at line 316 of file ServerMKCOLTest.php.

316 {
317
318 $request = new HTTP\Request(
319 'MKCOL',
320 '/testcol',
321 ['Content-Type' => 'application/xml']
322 );
323 $request->setBody('<?xml version="1.0"?>
324<mkcol xmlns="DAV:">
325 <set>
326 <prop>
327 <resourcetype><collection /></resourcetype>
328 <displayname>my new collection</displayname>
329 </prop>
330 </set>
331</mkcol>');
332 $this->server->httpRequest = ($request);
333 $this->server->exec();
334
335 $this->assertEquals(207, $this->response->status, 'Wrong statuscode received. Full response body: ' . $this->response->body);
336
337 $this->assertEquals([
338 'X-Sabre-Version' => [Version::VERSION],
339 'Content-Type' => ['application/xml; charset=utf-8'],
340 ], $this->response->getHeaders());
341
342 $responseBody = $this->response->getBodyAsString();
343
344 $expected = <<<XML
345<?xml version="1.0"?>
346<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
347 <d:response>
348 <d:href>/testcol</d:href>
349 <d:propstat>
350 <d:prop>
351 <d:displayname />
352 </d:prop>
353 <d:status>HTTP/1.1 403 Forbidden</d:status>
354 </d:propstat>
355 </d:response>
356</d:multistatus>
357XML;
358
359 $this->assertXmlStringEqualsXmlString(
360 $expected,
361 $responseBody
362 );
363
364 }

References Sabre\DAV\AbstractServer\$request, and Sabre\DAV\Version\VERSION.

◆ testMKCOLBrokenXML()

Sabre\DAV\ServerMKCOLTest::testMKCOLBrokenXML ( )

@depends testMkcol

Definition at line 59 of file ServerMKCOLTest.php.

59 {
60
61 $serverVars = [
62 'REQUEST_URI' => '/testcol',
63 'REQUEST_METHOD' => 'MKCOL',
64 'HTTP_CONTENT_TYPE' => 'application/xml',
65 ];
66
68 $request->setBody("Hello");
69 $this->server->httpRequest = ($request);
70 $this->server->exec();
71
72 $this->assertEquals([
73 'X-Sabre-Version' => [Version::VERSION],
74 'Content-Type' => ['application/xml; charset=utf-8'],
75 ], $this->response->getHeaders());
76
77 $this->assertEquals(400, $this->response->getStatus(), $this->response->getBodyAsString());
78
79 }

References Sabre\DAV\AbstractServer\$request, Sabre\HTTP\Sapi\createFromServerArray(), and Sabre\DAV\Version\VERSION.

+ Here is the call graph for this function:

◆ testMKCOLIncorrectResourceType()

Sabre\DAV\ServerMKCOLTest::testMKCOLIncorrectResourceType ( )

@depends testMkcol

Definition at line 141 of file ServerMKCOLTest.php.

141 {
142
143 $serverVars = [
144 'REQUEST_URI' => '/testcol',
145 'REQUEST_METHOD' => 'MKCOL',
146 'HTTP_CONTENT_TYPE' => 'application/xml',
147 ];
148
150 $request->setBody('<?xml version="1.0"?>
151<mkcol xmlns="DAV:">
152 <set>
153 <prop>
154 <resourcetype><collection /><blabla /></resourcetype>
155 </prop>
156 </set>
157</mkcol>');
158 $this->server->httpRequest = ($request);
159 $this->server->exec();
160
161 $this->assertEquals([
162 'X-Sabre-Version' => [Version::VERSION],
163 'Content-Type' => ['application/xml; charset=utf-8'],
164 ], $this->response->getHeaders());
165
166 $this->assertEquals(403, $this->response->status, 'Wrong statuscode received. Full response body: ' . $this->response->body);
167
168 }

References Sabre\DAV\AbstractServer\$request, Sabre\HTTP\Sapi\createFromServerArray(), and Sabre\DAV\Version\VERSION.

+ Here is the call graph for this function:

◆ testMKCOLNoParent()

Sabre\DAV\ServerMKCOLTest::testMKCOLNoParent ( )

@depends testMKCOLIncorrectResourceType

Definition at line 239 of file ServerMKCOLTest.php.

239 {
240
241 $serverVars = [
242 'REQUEST_URI' => '/testnoparent/409me',
243 'REQUEST_METHOD' => 'MKCOL',
244 ];
245
247 $request->setBody('');
248
249 $this->server->httpRequest = ($request);
250 $this->server->exec();
251
252 $this->assertEquals([
253 'X-Sabre-Version' => [Version::VERSION],
254 'Content-Type' => ['application/xml; charset=utf-8'],
255 ], $this->response->getHeaders());
256
257 $this->assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: ' . $this->response->body);
258
259 }

References Sabre\DAV\AbstractServer\$request, Sabre\HTTP\Sapi\createFromServerArray(), and Sabre\DAV\Version\VERSION.

+ Here is the call graph for this function:

◆ testMKCOLNoResourceType()

Sabre\DAV\ServerMKCOLTest::testMKCOLNoResourceType ( )

@depends testMkcol

Definition at line 109 of file ServerMKCOLTest.php.

109 {
110
111 $serverVars = [
112 'REQUEST_URI' => '/testcol',
113 'REQUEST_METHOD' => 'MKCOL',
114 'HTTP_CONTENT_TYPE' => 'application/xml',
115 ];
116
118 $request->setBody('<?xml version="1.0"?>
119<mkcol xmlns="DAV:">
120 <set>
121 <prop>
122 <displayname>Evert</displayname>
123 </prop>
124 </set>
125</mkcol>');
126 $this->server->httpRequest = ($request);
127 $this->server->exec();
128
129 $this->assertEquals([
130 'X-Sabre-Version' => [Version::VERSION],
131 'Content-Type' => ['application/xml; charset=utf-8'],
132 ], $this->response->getHeaders());
133
134 $this->assertEquals(400, $this->response->status, 'Wrong statuscode received. Full response body: ' . $this->response->body);
135
136 }

References Sabre\DAV\AbstractServer\$request, Sabre\HTTP\Sapi\createFromServerArray(), and Sabre\DAV\Version\VERSION.

+ Here is the call graph for this function:

◆ testMKCOLParentIsNoCollection()

Sabre\DAV\ServerMKCOLTest::testMKCOLParentIsNoCollection ( )

@depends testMKCOLIncorrectResourceType

Definition at line 264 of file ServerMKCOLTest.php.

264 {
265
266 $serverVars = [
267 'REQUEST_URI' => '/test.txt/409me',
268 'REQUEST_METHOD' => 'MKCOL',
269 ];
270
272 $request->setBody('');
273
274 $this->server->httpRequest = ($request);
275 $this->server->exec();
276
277 $this->assertEquals([
278 'X-Sabre-Version' => [Version::VERSION],
279 'Content-Type' => ['application/xml; charset=utf-8'],
280 ], $this->response->getHeaders());
281
282 $this->assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: ' . $this->response->body);
283
284 }

References Sabre\DAV\AbstractServer\$request, Sabre\HTTP\Sapi\createFromServerArray(), and Sabre\DAV\Version\VERSION.

+ Here is the call graph for this function:

◆ testMKCOLSuccess()

Sabre\DAV\ServerMKCOLTest::testMKCOLSuccess ( )

@depends testMKCOLIncorrectResourceType

Definition at line 173 of file ServerMKCOLTest.php.

173 {
174
175 $serverVars = [
176 'REQUEST_URI' => '/testcol',
177 'REQUEST_METHOD' => 'MKCOL',
178 'HTTP_CONTENT_TYPE' => 'application/xml',
179 ];
180
182 $request->setBody('<?xml version="1.0"?>
183<mkcol xmlns="DAV:">
184 <set>
185 <prop>
186 <resourcetype><collection /></resourcetype>
187 </prop>
188 </set>
189</mkcol>');
190 $this->server->httpRequest = ($request);
191 $this->server->exec();
192
193 $this->assertEquals([
194 'X-Sabre-Version' => [Version::VERSION],
195 'Content-Length' => ['0'],
196 ], $this->response->getHeaders());
197
198 $this->assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: ' . $this->response->body);
199
200 }

References Sabre\DAV\AbstractServer\$request, Sabre\HTTP\Sapi\createFromServerArray(), and Sabre\DAV\Version\VERSION.

+ Here is the call graph for this function:

◆ testMKCOLUnknownBody()

Sabre\DAV\ServerMKCOLTest::testMKCOLUnknownBody ( )

@depends testMkcol

Definition at line 35 of file ServerMKCOLTest.php.

35 {
36
37 $serverVars = [
38 'REQUEST_URI' => '/testcol',
39 'REQUEST_METHOD' => 'MKCOL',
40 ];
41
43 $request->setBody("Hello");
44 $this->server->httpRequest = ($request);
45 $this->server->exec();
46
47 $this->assertEquals([
48 'X-Sabre-Version' => [Version::VERSION],
49 'Content-Type' => ['application/xml; charset=utf-8'],
50 ], $this->response->getHeaders());
51
52 $this->assertEquals(415, $this->response->status);
53
54 }

References Sabre\DAV\AbstractServer\$request, Sabre\HTTP\Sapi\createFromServerArray(), and Sabre\DAV\Version\VERSION.

+ Here is the call graph for this function:

◆ testMKCOLUnknownXML()

Sabre\DAV\ServerMKCOLTest::testMKCOLUnknownXML ( )

@depends testMkcol

Definition at line 84 of file ServerMKCOLTest.php.

84 {
85
86 $serverVars = [
87 'REQUEST_URI' => '/testcol',
88 'REQUEST_METHOD' => 'MKCOL',
89 'HTTP_CONTENT_TYPE' => 'application/xml',
90 ];
91
93 $request->setBody('<?xml version="1.0"?><html></html>');
94 $this->server->httpRequest = ($request);
95 $this->server->exec();
96
97 $this->assertEquals([
98 'X-Sabre-Version' => [Version::VERSION],
99 'Content-Type' => ['application/xml; charset=utf-8'],
100 ], $this->response->getHeaders());
101
102 $this->assertEquals(400, $this->response->getStatus());
103
104 }

References Sabre\DAV\AbstractServer\$request, Sabre\HTTP\Sapi\createFromServerArray(), and Sabre\DAV\Version\VERSION.

+ Here is the call graph for this function:

◆ testMKCOLWhiteSpaceResourceType()

Sabre\DAV\ServerMKCOLTest::testMKCOLWhiteSpaceResourceType ( )

@depends testMKCOLIncorrectResourceType

Definition at line 205 of file ServerMKCOLTest.php.

205 {
206
207 $serverVars = [
208 'REQUEST_URI' => '/testcol',
209 'REQUEST_METHOD' => 'MKCOL',
210 'HTTP_CONTENT_TYPE' => 'application/xml',
211 ];
212
214 $request->setBody('<?xml version="1.0"?>
215<mkcol xmlns="DAV:">
216 <set>
217 <prop>
218 <resourcetype>
219 <collection />
220 </resourcetype>
221 </prop>
222 </set>
223</mkcol>');
224 $this->server->httpRequest = ($request);
225 $this->server->exec();
226
227 $this->assertEquals([
228 'X-Sabre-Version' => [Version::VERSION],
229 'Content-Length' => ['0'],
230 ], $this->response->getHeaders());
231
232 $this->assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: ' . $this->response->body);
233
234 }

References Sabre\DAV\AbstractServer\$request, Sabre\HTTP\Sapi\createFromServerArray(), and Sabre\DAV\Version\VERSION.

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: