diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-09-05 09:18:25 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-09-05 09:20:26 +0200 |
commit | 637cafcf35422fbf1280144ac68c71a3284be74f (patch) | |
tree | 92f951994e92fa313492a6dd90466a7b0287b9f6 | |
parent | 5c78adb20dc7d9b1db3cf07e3dc42d982afb0ce3 (diff) | |
download | nextcloud-server-637cafcf35422fbf1280144ac68c71a3284be74f.tar.gz nextcloud-server-637cafcf35422fbf1280144ac68c71a3284be74f.zip |
Fix ContactsManagerTest adressbook mocks having a null key
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r-- | tests/lib/ContactsManagerTest.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/lib/ContactsManagerTest.php b/tests/lib/ContactsManagerTest.php index d15cd74bef8..63491214eb7 100644 --- a/tests/lib/ContactsManagerTest.php +++ b/tests/lib/ContactsManagerTest.php @@ -109,6 +109,9 @@ class ContactsManagerTest extends \Test\TestCase { ->method('delete') ->willReturn('returnMe'); + $addressbook->expects($this->any()) + ->method('getKey') + ->willReturn('addressbookKey'); $this->cm->registerAddressBook($addressbook); $result = $this->cm->delete(1, $addressbook->getKey()); @@ -128,6 +131,10 @@ class ContactsManagerTest extends \Test\TestCase { $addressbook->expects($this->never()) ->method('delete'); + $addressbook->expects($this->any()) + ->method('getKey') + ->willReturn('addressbookKey'); + $this->cm->registerAddressBook($addressbook); $result = $this->cm->delete(1, $addressbook->getKey()); $this->assertEquals($result, null); @@ -142,6 +149,10 @@ class ContactsManagerTest extends \Test\TestCase { $addressbook->expects($this->never()) ->method('delete'); + $addressbook->expects($this->any()) + ->method('getKey') + ->willReturn('addressbookKey'); + $this->cm->registerAddressBook($addressbook); $result = $this->cm->delete(1, 'noaddressbook'); $this->assertEquals($result, null); @@ -161,6 +172,10 @@ class ContactsManagerTest extends \Test\TestCase { ->method('createOrUpdate') ->willReturn('returnMe'); + $addressbook->expects($this->any()) + ->method('getKey') + ->willReturn('addressbookKey'); + $this->cm->registerAddressBook($addressbook); $result = $this->cm->createOrUpdate([], $addressbook->getKey()); $this->assertEquals($result, 'returnMe'); @@ -179,6 +194,10 @@ class ContactsManagerTest extends \Test\TestCase { $addressbook->expects($this->never()) ->method('createOrUpdate'); + $addressbook->expects($this->any()) + ->method('getKey') + ->willReturn('addressbookKey'); + $this->cm->registerAddressBook($addressbook); $result = $this->cm->createOrUpdate([], $addressbook->getKey()); $this->assertEquals($result, null); @@ -193,6 +212,10 @@ class ContactsManagerTest extends \Test\TestCase { $addressbook->expects($this->never()) ->method('createOrUpdate'); + $addressbook->expects($this->any()) + ->method('getKey') + ->willReturn('addressbookKey'); + $this->cm->registerAddressBook($addressbook); $result = $this->cm->createOrUpdate([], 'noaddressbook'); $this->assertEquals($result, null); @@ -209,6 +232,10 @@ class ContactsManagerTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); + $addressbook->expects($this->any()) + ->method('getKey') + ->willReturn('addressbookKey'); + $this->cm->registerAddressBook($addressbook); $result = $this->cm->isEnabled(); $this->assertTrue($result); |