From c2d1e6e7ff82e46e3c933e27ca6a24f9250da14d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 23 Feb 2017 10:31:28 +0100 Subject: Restrict share handling to the owner only Otherwise group members can remove the share for the complete group, remove edit permissions and even single user shares for other users. Signed-off-by: Joas Schilling --- apps/dav/lib/CalDAV/Calendar.php | 17 ++++++++++++++--- apps/dav/lib/CardDAV/AddressBook.php | 21 ++++++++++++++++++++- apps/dav/tests/unit/CalDAV/CalDavBackendTest.php | 4 ---- 3 files changed, 34 insertions(+), 8 deletions(-) (limited to 'apps') diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php index d1eff1aeaa3..05c7e635391 100644 --- a/apps/dav/lib/CalDAV/Calendar.php +++ b/apps/dav/lib/CalDAV/Calendar.php @@ -61,8 +61,12 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { * @param array $add * @param array $remove * @return void + * @throws Forbidden */ - function updateShares(array $add, array $remove) { + public function updateShares(array $add, array $remove) { + if ($this->isShared()) { + throw new Forbidden(); + } /** @var CalDavBackend $calDavBackend */ $calDavBackend = $this->caldavBackend; $calDavBackend->updateShares($this, $add, $remove); @@ -80,7 +84,10 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { * * @return array */ - function getShares() { + public function getShares() { + if ($this->isShared()) { + return []; + } /** @var CalDavBackend $calDavBackend */ $calDavBackend = $this->caldavBackend; return $calDavBackend->getShares($this->getResourceId()); @@ -136,6 +143,10 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { ]; } + if ($this->isShared()) { + return $acl; + } + /** @var CalDavBackend $calDavBackend */ $calDavBackend = $this->caldavBackend; return $calDavBackend->applyShareAcl($this->getResourceId(), $acl); @@ -156,7 +167,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { if (isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal']) && $this->calendarInfo['{http://owncloud.org/ns}owner-principal'] !== $this->calendarInfo['principaluri']) { $principal = 'principal:' . parent::getOwner(); - $shares = $this->getShares(); + $shares = $this->caldavBackend->getShares($this->getResourceId()); $shares = array_filter($shares, function($share) use ($principal){ return $share['href'] === $principal; }); diff --git a/apps/dav/lib/CardDAV/AddressBook.php b/apps/dav/lib/CardDAV/AddressBook.php index 1c13ac00aec..84448c5459e 100644 --- a/apps/dav/lib/CardDAV/AddressBook.php +++ b/apps/dav/lib/CardDAV/AddressBook.php @@ -64,8 +64,12 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { * @param array $add * @param array $remove * @return void + * @throws Forbidden */ function updateShares(array $add, array $remove) { + if ($this->isShared()) { + throw new Forbidden(); + } /** @var CardDavBackend $carddavBackend */ $carddavBackend = $this->carddavBackend; $carddavBackend->updateShares($this, $add, $remove); @@ -84,6 +88,9 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { * @return array */ function getShares() { + if ($this->isShared()) { + return []; + } /** @var CardDavBackend $carddavBackend */ $carddavBackend = $this->carddavBackend; return $carddavBackend->getShares($this->getResourceId()); @@ -123,6 +130,10 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { ]; } + if ($this->isShared()) { + return $acl; + } + /** @var CardDavBackend $carddavBackend */ $carddavBackend = $this->carddavBackend; return $carddavBackend->applyShareAcl($this->getResourceId(), $acl); @@ -160,7 +171,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { function delete() { if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { $principal = 'principal:' . parent::getOwner(); - $shares = $this->getShares(); + $shares = $this->carddavBackend->getShares($this->getResourceId()); $shares = array_filter($shares, function($share) use ($principal){ return $share['href'] === $principal; }); @@ -192,6 +203,14 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { return $cardDavBackend->collectCardProperties($this->getResourceId(), 'CATEGORIES'); } + private function isShared() { + if (!isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { + return false; + } + + return $this->addressBookInfo['{http://owncloud.org/ns}owner-principal'] !== $this->addressBookInfo['principaluri']; + } + private function canWrite() { if (isset($this->addressBookInfo['{http://owncloud.org/ns}read-only'])) { return !$this->addressBookInfo['{http://owncloud.org/ns}read-only']; diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index 22ef232dac4..63ca03b0d3d 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -143,8 +143,6 @@ class CalDavBackendTest extends AbstractCalDavBackendTest { $this->assertAcl(self::UNIT_TEST_USER, '{DAV:}write', $acl); $this->assertAccess($userCanRead, self::UNIT_TEST_USER1, '{DAV:}read', $acl); $this->assertAccess($userCanWrite, self::UNIT_TEST_USER1, '{DAV:}write', $acl); - $this->assertAccess($groupCanRead, self::UNIT_TEST_GROUP, '{DAV:}read', $acl); - $this->assertAccess($groupCanWrite, self::UNIT_TEST_GROUP, '{DAV:}write', $acl); $this->assertEquals(self::UNIT_TEST_USER, $calendar->getOwner()); // test acls on the child @@ -178,8 +176,6 @@ EOD; $this->assertAcl(self::UNIT_TEST_USER, '{DAV:}write', $acl); $this->assertAccess($userCanRead, self::UNIT_TEST_USER1, '{DAV:}read', $acl); $this->assertAccess($userCanWrite, self::UNIT_TEST_USER1, '{DAV:}write', $acl); - $this->assertAccess($groupCanRead, self::UNIT_TEST_GROUP, '{DAV:}read', $acl); - $this->assertAccess($groupCanWrite, self::UNIT_TEST_GROUP, '{DAV:}write', $acl); // delete the address book $this->dispatcher->expects($this->at(0)) -- cgit v1.2.3 From 62ef59616df68ba4d7cf1df57008b60e13049483 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 23 Feb 2017 10:33:54 +0100 Subject: Add public access modifier to all methods Signed-off-by: Joas Schilling --- apps/dav/lib/CalDAV/Calendar.php | 24 ++++++++++++------------ apps/dav/lib/CardDAV/AddressBook.php | 16 ++++++++-------- 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'apps') diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php index 05c7e635391..696bbf20a41 100644 --- a/apps/dav/lib/CalDAV/Calendar.php +++ b/apps/dav/lib/CalDAV/Calendar.php @@ -107,7 +107,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { return $this->calendarInfo['principaluri']; } - function getACL() { + public function getACL() { $acl = [ [ 'privilege' => '{DAV:}read', @@ -152,18 +152,18 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { return $calDavBackend->applyShareAcl($this->getResourceId(), $acl); } - function getChildACL() { + public function getChildACL() { return $this->getACL(); } - function getOwner() { + public function getOwner() { if (isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal'])) { return $this->calendarInfo['{http://owncloud.org/ns}owner-principal']; } return parent::getOwner(); } - function delete() { + public function delete() { if (isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal']) && $this->calendarInfo['{http://owncloud.org/ns}owner-principal'] !== $this->calendarInfo['principaluri']) { $principal = 'principal:' . parent::getOwner(); @@ -185,7 +185,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { parent::delete(); } - function propPatch(PropPatch $propPatch) { + public function propPatch(PropPatch $propPatch) { // parent::propPatch will only update calendars table // if calendar is shared, changes have to be made to the properties table if (!$this->isShared()) { @@ -193,7 +193,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { } } - function getChild($name) { + public function getChild($name) { $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name); @@ -211,7 +211,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { } - function getChildren() { + public function getChildren() { $objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']); $children = []; @@ -226,7 +226,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { } - function getMultipleChildren(array $paths) { + public function getMultipleChildren(array $paths) { $objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths); $children = []; @@ -241,7 +241,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { } - function childExists($name) { + public function childExists($name) { $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name); if (!$obj) { return false; @@ -253,7 +253,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { return true; } - function calendarQuery(array $filters) { + public function calendarQuery(array $filters) { $uris = $this->caldavBackend->calendarQuery($this->calendarInfo['id'], $filters); if ($this->isShared()) { @@ -269,7 +269,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { * @param boolean $value * @return string|null */ - function setPublishStatus($value) { + public function setPublishStatus($value) { $publicUri = $this->caldavBackend->setPublishStatus($value, $this); $this->calendarInfo['publicuri'] = $publicUri; return $publicUri; @@ -278,7 +278,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { /** * @return mixed $value */ - function getPublishStatus() { + public function getPublishStatus() { return $this->caldavBackend->getPublishStatus($this); } diff --git a/apps/dav/lib/CardDAV/AddressBook.php b/apps/dav/lib/CardDAV/AddressBook.php index 84448c5459e..89c8571821f 100644 --- a/apps/dav/lib/CardDAV/AddressBook.php +++ b/apps/dav/lib/CardDAV/AddressBook.php @@ -66,7 +66,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { * @return void * @throws Forbidden */ - function updateShares(array $add, array $remove) { + public function updateShares(array $add, array $remove) { if ($this->isShared()) { throw new Forbidden(); } @@ -87,7 +87,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { * * @return array */ - function getShares() { + public function getShares() { if ($this->isShared()) { return []; } @@ -96,7 +96,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { return $carddavBackend->getShares($this->getResourceId()); } - function getACL() { + public function getACL() { $acl = [ [ 'privilege' => '{DAV:}read', @@ -139,11 +139,11 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { return $carddavBackend->applyShareAcl($this->getResourceId(), $acl); } - function getChildACL() { + public function getChildACL() { return $this->getACL(); } - function getChild($name) { + public function getChild($name) { $obj = $this->carddavBackend->getCard($this->addressBookInfo['id'], $name); if (!$obj) { @@ -161,14 +161,14 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { return $this->addressBookInfo['id']; } - function getOwner() { + public function getOwner() { if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { return $this->addressBookInfo['{http://owncloud.org/ns}owner-principal']; } return parent::getOwner(); } - function delete() { + public function delete() { if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { $principal = 'principal:' . parent::getOwner(); $shares = $this->carddavBackend->getShares($this->getResourceId()); @@ -189,7 +189,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { parent::delete(); } - function propPatch(PropPatch $propPatch) { + public function propPatch(PropPatch $propPatch) { if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { throw new Forbidden(); } -- cgit v1.2.3 From 088f4422f904cf95ec66e897ce0f3d1daf482ca4 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 23 Feb 2017 10:37:49 +0100 Subject: Fix remaining "PHP Inspection" warnings Signed-off-by: Joas Schilling --- apps/dav/lib/CalDAV/Calendar.php | 30 ++++++++++++++---------------- apps/dav/lib/CardDAV/AddressBook.php | 31 +++++++++++++------------------ 2 files changed, 27 insertions(+), 34 deletions(-) (limited to 'apps') diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php index 696bbf20a41..a216e4e078b 100644 --- a/apps/dav/lib/CalDAV/Calendar.php +++ b/apps/dav/lib/CalDAV/Calendar.php @@ -30,6 +30,12 @@ use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\Exception\NotFound; use Sabre\DAV\PropPatch; +/** + * Class Calendar + * + * @package OCA\DAV\CalDAV + * @property BackendInterface|CalDavBackend $caldavBackend + */ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { public function __construct(BackendInterface $caldavBackend, $calendarInfo, IL10N $l10n) { @@ -67,9 +73,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { if ($this->isShared()) { throw new Forbidden(); } - /** @var CalDavBackend $calDavBackend */ - $calDavBackend = $this->caldavBackend; - $calDavBackend->updateShares($this, $add, $remove); + $this->caldavBackend->updateShares($this, $add, $remove); } /** @@ -88,9 +92,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { if ($this->isShared()) { return []; } - /** @var CalDavBackend $calDavBackend */ - $calDavBackend = $this->caldavBackend; - return $calDavBackend->getShares($this->getResourceId()); + return $this->caldavBackend->getShares($this->getResourceId()); } /** @@ -147,9 +149,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { return $acl; } - /** @var CalDavBackend $calDavBackend */ - $calDavBackend = $this->caldavBackend; - return $calDavBackend->applyShareAcl($this->getResourceId(), $acl); + return $this->caldavBackend->applyShareAcl($this->getResourceId(), $acl); } public function getChildACL() { @@ -175,9 +175,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { throw new Forbidden(); } - /** @var CalDavBackend $calDavBackend */ - $calDavBackend = $this->caldavBackend; - $calDavBackend->updateShares($this, [], [ + $this->caldavBackend->updateShares($this, [], [ 'href' => $principal ]); return; @@ -201,7 +199,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { throw new NotFound('Calendar object not found'); } - if ($this->isShared() && $obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { + if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE && $this->isShared()) { throw new NotFound('Calendar object not found'); } @@ -216,7 +214,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { $objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']); $children = []; foreach ($objs as $obj) { - if ($this->isShared() && $obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { + if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE && $this->isShared()) { continue; } $obj['acl'] = $this->getChildACL(); @@ -231,7 +229,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { $objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths); $children = []; foreach ($objs as $obj) { - if ($this->isShared() && $obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { + if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE && $this->isShared()) { continue; } $obj['acl'] = $this->getChildACL(); @@ -246,7 +244,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { if (!$obj) { return false; } - if ($this->isShared() && $obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) { + if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE && $this->isShared()) { return false; } diff --git a/apps/dav/lib/CardDAV/AddressBook.php b/apps/dav/lib/CardDAV/AddressBook.php index 89c8571821f..eb5bebaa2ee 100644 --- a/apps/dav/lib/CardDAV/AddressBook.php +++ b/apps/dav/lib/CardDAV/AddressBook.php @@ -29,6 +29,12 @@ use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\Exception\NotFound; use Sabre\DAV\PropPatch; +/** + * Class AddressBook + * + * @package OCA\DAV\CardDAV + * @property BackendInterface|CardDavBackend $carddavBackend + */ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { /** @@ -41,8 +47,8 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { public function __construct(BackendInterface $carddavBackend, array $addressBookInfo, IL10N $l10n) { parent::__construct($carddavBackend, $addressBookInfo); - if ($this->getName() === CardDavBackend::PERSONAL_ADDRESSBOOK_URI && - $this->addressBookInfo['{DAV:}displayname'] === CardDavBackend::PERSONAL_ADDRESSBOOK_NAME) { + if ($this->addressBookInfo['{DAV:}displayname'] === CardDavBackend::PERSONAL_ADDRESSBOOK_NAME && + $this->getName() === CardDavBackend::PERSONAL_ADDRESSBOOK_URI) { $this->addressBookInfo['{DAV:}displayname'] = $l10n->t('Contacts'); } } @@ -70,9 +76,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { if ($this->isShared()) { throw new Forbidden(); } - /** @var CardDavBackend $carddavBackend */ - $carddavBackend = $this->carddavBackend; - $carddavBackend->updateShares($this, $add, $remove); + $this->carddavBackend->updateShares($this, $add, $remove); } /** @@ -91,9 +95,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { if ($this->isShared()) { return []; } - /** @var CardDavBackend $carddavBackend */ - $carddavBackend = $this->carddavBackend; - return $carddavBackend->getShares($this->getResourceId()); + return $this->carddavBackend->getShares($this->getResourceId()); } public function getACL() { @@ -134,9 +136,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { return $acl; } - /** @var CardDavBackend $carddavBackend */ - $carddavBackend = $this->carddavBackend; - return $carddavBackend->applyShareAcl($this->getResourceId(), $acl); + return $this->carddavBackend->applyShareAcl($this->getResourceId(), $acl); } public function getChildACL() { @@ -179,9 +179,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { throw new Forbidden(); } - /** @var CardDavBackend $cardDavBackend */ - $cardDavBackend = $this->carddavBackend; - $cardDavBackend->updateShares($this, [], [ + $this->carddavBackend->updateShares($this, [], [ 'href' => $principal ]); return; @@ -197,10 +195,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { } public function getContactsGroups() { - /** @var CardDavBackend $cardDavBackend */ - $cardDavBackend = $this->carddavBackend; - - return $cardDavBackend->collectCardProperties($this->getResourceId(), 'CATEGORIES'); + return $this->carddavBackend->collectCardProperties($this->getResourceId(), 'CATEGORIES'); } private function isShared() { -- cgit v1.2.3 From 5d18e4243dd1a71804bb52190c581bb4d1f2ee58 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 20 Apr 2017 16:01:26 -0500 Subject: Fix unit tests Signed-off-by: Morris Jobke --- apps/dav/tests/unit/CardDAV/AddressBookTest.php | 4 ++++ apps/dav/tests/unit/CardDAV/ContactsManagerTest.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'apps') diff --git a/apps/dav/tests/unit/CardDAV/AddressBookTest.php b/apps/dav/tests/unit/CardDAV/AddressBookTest.php index 22992d564f6..132fa4796db 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookTest.php @@ -40,6 +40,7 @@ class AddressBookTest extends TestCase { ]); $calendarInfo = [ '{http://owncloud.org/ns}owner-principal' => 'user1', + '{DAV:}displayname' => 'Test address book', 'principaluri' => 'user2', 'id' => 666, 'uri' => 'default', @@ -61,6 +62,7 @@ class AddressBookTest extends TestCase { ]); $calendarInfo = [ '{http://owncloud.org/ns}owner-principal' => 'user1', + '{DAV:}displayname' => 'Test address book', 'principaluri' => 'user2', 'id' => 666, 'uri' => 'default', @@ -78,6 +80,7 @@ class AddressBookTest extends TestCase { $backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')->disableOriginalConstructor()->getMock(); $calendarInfo = [ '{http://owncloud.org/ns}owner-principal' => 'user1', + '{DAV:}displayname' => 'Test address book', 'principaluri' => 'user2', 'id' => 666, 'uri' => 'default', @@ -95,6 +98,7 @@ class AddressBookTest extends TestCase { $backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')->disableOriginalConstructor()->getMock(); $backend->expects($this->any())->method('applyShareAcl')->willReturnArgument(1); $calendarInfo = [ + '{DAV:}displayname' => 'Test address book', 'principaluri' => 'user2', 'id' => 666, 'uri' => 'default' diff --git a/apps/dav/tests/unit/CardDAV/ContactsManagerTest.php b/apps/dav/tests/unit/CardDAV/ContactsManagerTest.php index 062ef72dbf0..a6f0384cc38 100644 --- a/apps/dav/tests/unit/CardDAV/ContactsManagerTest.php +++ b/apps/dav/tests/unit/CardDAV/ContactsManagerTest.php @@ -39,7 +39,7 @@ class ContactsManagerTest extends TestCase { /** @var CardDavBackend | \PHPUnit_Framework_MockObject_MockObject $backEnd */ $backEnd = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')->disableOriginalConstructor()->getMock(); $backEnd->method('getAddressBooksForUser')->willReturn([ - ['uri' => 'default'], + ['{DAV:}displayname' => 'Test address book', 'uri' => 'default'], ]); $l = $this->createMock(IL10N::class); -- cgit v1.2.3