function setup() { $this->caldavBackend = new Sabre_CalDAV_Backend_Mock(array(array('id' => 1, 'uri' => 'UUID-123467', 'principaluri' => 'principals/user1', '{DAV:}displayname' => 'user1 calendar', '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar description', '{http://apple.com/ns/ical/}calendar-order' => '1', '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array('VEVENT', 'VTODO'))), array('id' => 2, 'uri' => 'UUID-123468', 'principaluri' => 'principals/user1', '{DAV:}displayname' => 'user1 calendar2', '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar description', '{http://apple.com/ns/ical/}calendar-order' => '1', '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array('VEVENT', 'VTODO')))), array(1 => array('UUID-2345' => array('calendardata' => Sabre_CalDAV_TestUtil::getTestCalendarData())))); $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_SimpleCollection('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); // Adding ACL plugin $this->server->addPlugin(new Sabre_DAVACL_Plugin()); // Adding Auth plugin, and ensuring that we are logged in. $authBackend = new Sabre_DAV_Auth_MockBackend(); $authBackend->defaultUser = '******'; $authPlugin = new Sabre_DAV_Auth_Plugin($authBackend, 'SabreDAV'); $this->server->addPlugin($authPlugin); $authPlugin->beforeMethod('GET', '/'); $this->response = new Sabre_HTTP_ResponseMock(); $this->server->httpResponse = $this->response; }
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_SimpleCollection('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; }