summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2020-08-04 07:57:07 +0200
committerGeorg Ehrke <developer@georgehrke.com>2020-08-05 09:04:41 +0200
commitb0c5457c422888f87b76f2b67f05917aed02a775 (patch)
treeeb423d096287fb63d9a8a939c025ff6290b74393 /apps/dav/tests
parent1cf9f4281795610bfaf74af9e3f3f1c3c544c08c (diff)
downloadnextcloud-server-b0c5457c422888f87b76f2b67f05917aed02a775.tar.gz
nextcloud-server-b0c5457c422888f87b76f2b67f05917aed02a775.zip
IAddressBook: add isShared and isSystemAddressBook
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav/tests')
-rw-r--r--apps/dav/tests/unit/CardDAV/AddressBookImplTest.php59
1 files changed, 59 insertions, 0 deletions
diff --git a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php
index cc7e50e9374..242106fbcc9 100644
--- a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php
+++ b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php
@@ -447,4 +447,63 @@ class AddressBookImplTest extends TestCase {
'isLocalSystemBook' => true,
], $array);
}
+
+ public function testIsSystemAddressBook(): void {
+ $addressBookInfo = [
+ '{http://owncloud.org/ns}owner-principal' => 'principals/system/system',
+ 'principaluri' => 'principals/system/system',
+ '{DAV:}displayname' => 'display name',
+ 'id' => 666,
+ 'uri' => 'system',
+ ];
+
+ $addressBookImpl = new AddressBookImpl(
+ $this->addressBook,
+ $addressBookInfo,
+ $this->backend,
+ $this->urlGenerator
+ );
+
+ $this->assertTrue($addressBookImpl->isSystemAddressBook());
+ }
+
+ public function testIsShared(): void {
+ $addressBookInfo = [
+ '{http://owncloud.org/ns}owner-principal' => 'user1',
+ '{DAV:}displayname' => 'Test address book',
+ 'principaluri' => 'user2',
+ 'id' => 666,
+ 'uri' => 'default',
+ ];
+
+ $addressBookImpl = new AddressBookImpl(
+ $this->addressBook,
+ $addressBookInfo,
+ $this->backend,
+ $this->urlGenerator
+ );
+
+ $this->assertFalse($addressBookImpl->isSystemAddressBook());
+ $this->assertTrue($addressBookImpl->isShared());
+ }
+
+ public function testIsNotShared(): void {
+ $addressBookInfo = [
+ '{http://owncloud.org/ns}owner-principal' => 'user1',
+ '{DAV:}displayname' => 'Test address book',
+ 'principaluri' => 'user1',
+ 'id' => 666,
+ 'uri' => 'default',
+ ];
+
+ $addressBookImpl = new AddressBookImpl(
+ $this->addressBook,
+ $addressBookInfo,
+ $this->backend,
+ $this->urlGenerator
+ );
+
+ $this->assertFalse($addressBookImpl->isSystemAddressBook());
+ $this->assertFalse($addressBookImpl->isShared());
+ }
}