Files
FHC-Core/include/sabredav/tests/Sabre/DAV/AbstractServer.php
T
Paolo 0bc0a09bf4 - Removed file system execute permission for all files (no directories)
- application/extensions file system permission now is 775
- application/logs file system permission now is 775
- Added extensions directory in application/: config, controllers, helpers, hooks, libraries, models, views and widgets
- Added view views/extensions/manage.php
- Added controller controllers/system/extensions/Manager.php
- Added library ExtensionsLib to manage extensions
- Added model models/system/Extensions_model.php
- Moved code related to print out info from MigrationLib to EPrintfLib
2017-11-13 10:45:49 +01:00

66 lines
1.4 KiB
PHP

<?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;
$this->deleteTree(SABRE_TEMPDIR,false);
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);
}
}