Fix ContactsManagerTest adressbook mocks having a null key

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/35539/head
Côme Chilliet 2023-09-05 09:18:25 +07:00
parent 5c78adb20d
commit 637cafcf35
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
1 changed files with 27 additions and 0 deletions

@ -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);