function setup() { if (!SABRE_HASSQLITE) { $this->markTestSkipped('No PDO SQLite support'); } $this->caldavBackend = Sabre_CalDAV_TestUtil::getBackend(); $principalBackend = new Sabre_DAVACL_MockPrincipalBackend(); $principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-read', array('principals/user1')); $principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-write', array('principals/user1')); $principalBackend->addPrincipal(array('uri' => 'principals/admin/calendar-proxy-read')); $principalBackend->addPrincipal(array('uri' => 'principals/admin/calendar-proxy-write')); $calendars = new Sabre_CalDAV_CalendarRootNode($principalBackend, $this->caldavBackend); $principals = new Sabre_CalDAV_Principal_Collection($principalBackend); $root = new Sabre_DAV_SimpleDirectory('root'); $root->addChild($calendars); $root->addChild($principals); $objectTree = new Sabre_DAV_ObjectTree($root); $this->server = new Sabre_DAV_Server($objectTree); $this->server->debugExceptions = true; $this->server->setBaseUri('/'); $this->plugin = new Sabre_CalDAV_Plugin(); $this->server->addPlugin($this->plugin); $this->response = new Sabre_HTTP_ResponseMock(); $this->server->httpResponse = $this->response; }
function getServer() { $backend = new Sabre_DAV_Auth_MockBackend(); $dir = new Sabre_DAV_SimpleDirectory('root'); $principals = new Sabre_DAV_Auth_PrincipalCollection($backend); $dir->addChild($principals); $fakeServer = new Sabre_DAV_Server(new Sabre_DAV_ObjectTree($dir)); $fakeServer->httpResponse = new Sabre_HTTP_ResponseMock(); $plugin = new Sabre_DAV_Auth_Plugin($backend, 'realm'); $this->assertTrue($plugin instanceof Sabre_DAV_Auth_Plugin); $fakeServer->addPlugin($plugin); $this->assertEquals($plugin, $fakeServer->getPlugin('Sabre_DAV_Auth_Plugin')); return $fakeServer; }
function getServer() { $backend = new Sabre_DAVACL_MockPrincipalBackend(); $dir = new Sabre_DAV_SimpleDirectory('root'); $principals = new Sabre_DAVACL_PrincipalCollection($backend); $dir->addChild($principals); $fakeServer = new Sabre_DAV_Server(new Sabre_DAV_ObjectTree($dir)); $fakeServer->httpResponse = new Sabre_HTTP_ResponseMock(); $fakeServer->debugExceptions = true; $plugin = new Sabre_DAVACL_MockPlugin($backend, 'realm'); $plugin->allowAccessToNodesWithoutACL = true; $this->assertTrue($plugin instanceof Sabre_DAVACL_Plugin); $fakeServer->addPlugin($plugin); $this->assertEquals($plugin, $fakeServer->getPlugin('acl')); return $fakeServer; }
/** * Sets up the object. A PDO object must be passed to setup all the backends. * * @param PDO $pdo */ public function __construct(PDO $pdo) { /* Backends */ $authBackend = new Sabre_DAV_Auth_Backend_PDO($pdo); $calendarBackend = new Sabre_CalDAV_Backend_PDO($pdo); /* Directory structure */ $root = new Sabre_DAV_SimpleDirectory('root'); $principals = new Sabre_DAV_Auth_PrincipalCollection($authBackend); $root->addChild($principals); $calendars = new Sabre_CalDAV_CalendarRootNode($authBackend, $calendarBackend); $root->addChild($calendars); $objectTree = new Sabre_DAV_ObjectTree($root); /* Initializing server */ parent::__construct($objectTree); /* Server Plugins */ $authPlugin = new Sabre_DAV_Auth_Plugin($authBackend, 'SabreDAV'); $this->addPlugin($authPlugin); $caldavPlugin = new Sabre_CalDAV_Plugin(); $this->addPlugin($caldavPlugin); }
function setup() { if (!SABRE_HASSQLITE) { $this->markTestSkipped('No PDO SQLite support'); } $this->caldavBackend = Sabre_CalDAV_TestUtil::getBackend(); $authBackend = new Sabre_DAV_Auth_MockBackend(); $authBackend->setCurrentUser('principals/user1'); $calendars = new Sabre_CalDAV_CalendarRootNode($authBackend, $this->caldavBackend); $principals = new Sabre_DAV_Auth_PrincipalCollection($authBackend); $root = new Sabre_DAV_SimpleDirectory('root'); $root->addChild($calendars); $root->addChild($principals); $objectTree = new Sabre_DAV_ObjectTree($root); $this->server = new Sabre_DAV_Server($objectTree); $this->server->debugExceptions = true; $this->server->setBaseUri('/'); $this->plugin = new Sabre_CalDAV_Plugin(); $this->server->addPlugin($this->plugin); $this->response = new Sabre_HTTP_ResponseMock(); $this->server->httpResponse = $this->response; }
function getChild($name) { if (isset($this->newDirectories[$name])) { return new Sabre_DAV_TreeDirectoryTester($name); } if (isset($this->newFiles[$name])) { return new Sabre_DAV_TreeFileTester($name, $this->newFiles[$name]); } return parent::getChild($name); }
function __construct($type) { $this->type = $type; parent::__construct('root'); }
/** * @depends testSimpleDirectoryConstruct * @expectedException Sabre_DAV_Exception_NotFound */ public function testSimpleDirectoryGetChild404() { $dir = new Sabre_DAV_SimpleDirectory('simpledir'); $dir->getChild('blabla'); }