diff options
author | friendica <info@friendica.com> | 2013-10-21 15:46:31 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-10-21 15:46:31 -0700 |
commit | b35122f7a6ad42756c35bb60ba1f06c3dcd45c77 (patch) | |
tree | ccdf373ce6475d264778523259cc32899b732fe7 /vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php | |
parent | e3504df514d306cfe6b83e44a11f550664564af4 (diff) | |
download | volse-hubzilla-b35122f7a6ad42756c35bb60ba1f06c3dcd45c77.tar.gz volse-hubzilla-b35122f7a6ad42756c35bb60ba1f06c3dcd45c77.tar.bz2 volse-hubzilla-b35122f7a6ad42756c35bb60ba1f06c3dcd45c77.zip |
add sabre (1.8.x) via composer in the !@#$ place it wants to be
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php')
-rw-r--r-- | vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php b/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php new file mode 100644 index 000000000..357675686 --- /dev/null +++ b/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php @@ -0,0 +1,64 @@ +<?php + +namespace Sabre\DAV; + +use Sabre\HTTP; + +require_once 'Sabre/HTTP/ResponseMock.php'; + +abstract class AbstractServer extends \PHPUnit_Framework_TestCase { + + /** + * @var Sabre\HTTP\ResponseMock + */ + protected $response; + protected $request; + /** + * @var Sabre\DAV\Server + */ + protected $server; + protected $tempDir = SABRE_TEMPDIR; + + function setUp() { + + $this->response = new HTTP\ResponseMock(); + $this->server = new Server($this->getRootNode()); + $this->server->httpResponse = $this->response; + $this->server->debugExceptions = true; + file_put_contents(SABRE_TEMPDIR . '/test.txt', 'Test contents'); + mkdir(SABRE_TEMPDIR . '/dir'); + file_put_contents(SABRE_TEMPDIR . '/dir/child.txt', 'Child contents'); + + + } + + function tearDown() { + + $this->deleteTree(SABRE_TEMPDIR,false); + + } + + protected function getRootNode() { + + return new FS\Directory(SABRE_TEMPDIR); + + } + + private function deleteTree($path,$deleteRoot = true) { + + foreach(scandir($path) as $node) { + + if ($node=='.' || $node=='.svn' || $node=='..') continue; + $myPath = $path.'/'. $node; + if (is_file($myPath)) { + unlink($myPath); + } else { + $this->deleteTree($myPath); + } + + } + if ($deleteRoot) rmdir($path); + + } + +} |