Example #1
0
 /**
  * @depends testCreateCalendarAndFetch
  */
 function testDeleteCalendar()
 {
     $backend = new PDO($this->pdo);
     $returnedId = $backend->createCalendar('principals/user2', 'somerandomid', array('{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new CalDAV\Property\SupportedCalendarComponentSet(array('VEVENT')), '{DAV:}displayname' => 'Hello!'));
     $backend->deleteCalendar($returnedId);
     $calendars = $backend->getCalendarsForUser('principals/user2');
     $this->assertEquals(array(), $calendars);
 }
Example #2
0
 /**
  * Delete a calendar and all it's objects 
  * 
  * @param string $calendarId 
  * @return void
  */
 public function deleteCalendar($calendarId)
 {
     parent::deleteCalendar($calendarId);
     $this->deleteCalendarShares($calendarId);
 }
Example #3
0
 /**
  * Delete a calendar and all it's objects 
  * 
  * @param string $calendarId 
  * @return void
  */
 public function deleteCalendar($calendarId)
 {
     \CApi::Log('deleteCalendar', \ELogLevel::Full, 'del-');
     parent::deleteCalendar($calendarId);
     $this->deleteCalendarShares($calendarId);
 }
Example #4
0
 /**
  * @depends testUpdateInvites
  */
 function testDeleteSharedCalendar()
 {
     $backend = new PDO($this->pdo);
     // creating a new calendar
     $backend->createCalendar('principals/user1', 'somerandomid', []);
     $calendar = $backend->getCalendarsForUser('principals/user1')[0];
     $ownerSharee = new Sharee(['href' => 'principals/user1', 'principal' => 'principals/user1', 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED]);
     // Add a new invite
     $backend->updateInvites($calendar['id'], [new Sharee(['href' => 'mailto:user@example.org', 'principal' => 'principals/user2', 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED, 'properties' => ['{DAV:}displayname' => 'User 2']])]);
     $expectedCalendar = ['id' => [1, 2], 'principaluri' => 'principals/user2', '{http://calendarserver.org/ns/}getctag' => 'http://sabre.io/ns/sync/1', '{http://sabredav.org/ns}sync-token' => '1', 'share-access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ, 'read-only' => true, 'share-resource-uri' => '/ns/share/1'];
     $calendars = $backend->getCalendarsForUser('principals/user2');
     foreach ($expectedCalendar as $k => $v) {
         $this->assertEquals($v, $calendars[0][$k], "Key " . $k . " in calendars array did not have the expected value.");
     }
     // Removing the shared calendar.
     $backend->deleteCalendar($calendars[0]['id']);
     $this->assertEquals([], $backend->getCalendarsForUser('principals/user2'));
     $result = $backend->getInvites($calendar['id']);
     $expected = [new Sharee(['href' => 'principals/user1', 'principal' => 'principals/user1', 'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER, 'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED])];
     $this->assertEquals($expected, $result);
 }