ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
AbstractServer.php
Go to the documentation of this file.
1<?php
2
3namespace Sabre\DAV;
4
5use Sabre\HTTP;
6
8
12 protected $response;
13 protected $request;
17 protected $server;
18 protected $tempDir = SABRE_TEMPDIR;
19
20 function setUp() {
21
22 $this->response = new HTTP\ResponseMock();
23 $this->server = new Server($this->getRootNode());
24 $this->server->sapi = new HTTP\SapiMock();
25 $this->server->httpResponse = $this->response;
26 $this->server->debugExceptions = true;
27 $this->deleteTree(SABRE_TEMPDIR, false);
28 file_put_contents(SABRE_TEMPDIR . '/test.txt', 'Test contents');
29 mkdir(SABRE_TEMPDIR . '/dir');
30 file_put_contents(SABRE_TEMPDIR . '/dir/child.txt', 'Child contents');
31
32
33 }
34
35 function tearDown() {
36
37 $this->deleteTree(SABRE_TEMPDIR, false);
38
39 }
40
41 protected function getRootNode() {
42
43 return new FS\Directory(SABRE_TEMPDIR);
44
45 }
46
47 private function deleteTree($path, $deleteRoot = true) {
48
49 foreach (scandir($path) as $node) {
50
51 if ($node == '.' || $node == '.svn' || $node == '..') continue;
52 $myPath = $path . '/' . $node;
53 if (is_file($myPath)) {
54 unlink($myPath);
55 } else {
56 $this->deleteTree($myPath);
57 }
58
59 }
60 if ($deleteRoot) rmdir($path);
61
62 }
63
64}
$path
Definition: aliased.php:25
An exception for terminatinating execution or to throw for unit testing.
deleteTree($path, $deleteRoot=true)
Directory class.
Definition: Directory.php:14
Main DAV server class.
Definition: Server.php:23