summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/caldav/calendartest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/tests/unit/caldav/calendartest.php')
-rw-r--r--apps/dav/tests/unit/caldav/calendartest.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/dav/tests/unit/caldav/calendartest.php b/apps/dav/tests/unit/caldav/calendartest.php
index 561ce6c8351..93b3f4bff8c 100644
--- a/apps/dav/tests/unit/caldav/calendartest.php
+++ b/apps/dav/tests/unit/caldav/calendartest.php
@@ -31,9 +31,32 @@ class CalendarTest extends TestCase {
/** @var \PHPUnit_Framework_MockObject_MockObject | CalDavBackend $backend */
$backend = $this->getMockBuilder('OCA\DAV\CalDAV\CalDavBackend')->disableOriginalConstructor()->getMock();
$backend->expects($this->once())->method('updateShares');
+ $backend->method('getShares')->willReturn([
+ ['href' => 'principal:user2']
+ ]);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',
'principaluri' => 'user2',
+ 'id' => 666
+ ];
+ $c = new Calendar($backend, $calendarInfo);
+ $c->delete();
+ }
+
+ /**
+ * @expectedException \Sabre\DAV\Exception\Forbidden
+ */
+ public function testDeleteFromGroup() {
+ /** @var \PHPUnit_Framework_MockObject_MockObject | CalDavBackend $backend */
+ $backend = $this->getMockBuilder('OCA\DAV\CalDAV\CalDavBackend')->disableOriginalConstructor()->getMock();
+ $backend->expects($this->never())->method('updateShares');
+ $backend->method('getShares')->willReturn([
+ ['href' => 'principal:group2']
+ ]);
+ $calendarInfo = [
+ '{http://owncloud.org/ns}owner-principal' => 'user1',
+ 'principaluri' => 'user2',
+ 'id' => 666
];
$c = new Calendar($backend, $calendarInfo);
$c->delete();