function setUp() { $calendars = array(array('principaluri' => 'principals/user2', 'id' => 1, 'uri' => 'calendar1')); $calendarobjects = array(1 => array('1.ics' => array('uri' => '1.ics', 'calendardata' => 'BEGIN:VCALENDAR BEGIN:VEVENT DTSTART:20110101T130000 DURATION:PT1H END:VEVENT END:VCALENDAR', 'calendarid' => 1))); $principalBackend = new Sabre_DAVACL_MockPrincipalBackend(); $caldavBackend = new Sabre_CalDAV_Backend_Mock($calendars, $calendarobjects); $tree = array(new Sabre_DAVACL_PrincipalCollection($principalBackend), new Sabre_CalDAV_CalendarRootNode($principalBackend, $caldavBackend)); $this->request = new Sabre_HTTP_Request(array('CONTENT_TYPE' => 'text/calendar')); $this->response = new Sabre_HTTP_ResponseMock(); $this->server = new Sabre_DAV_Server($tree); $this->server->httpRequest = $this->request; $this->server->httpResponse = $this->response; $this->aclPlugin = new Sabre_DAVACL_Plugin(); $this->server->addPlugin($this->aclPlugin); $authBackend = new Sabre_DAV_Auth_MockBackend(); $authBackend->setCurrentUser('user1'); $this->authPlugin = new Sabre_DAV_Auth_Plugin($authBackend, 'SabreDAV'); $this->server->addPlugin($this->authPlugin); $this->plugin = new Sabre_CalDAV_Plugin(); $this->server->addPlugin($this->plugin); }
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; }