getMockBuilder(IManager::class)->disableOriginalConstructor()->getMock(); $cm->expects($this->exactly(2))->method('registerAddressBook'); $urlGenerator = $this->getMockBuilder(IURLGenerator::class)->disableOriginalConstructor()->getMock(); /** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject $backEnd */ $backEnd = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock(); $backEnd->method('getAddressBooksForUser')->willReturn([ ['{DAV:}displayname' => 'Test address book', 'uri' => 'default'], ]); $l = $this->createMock(IL10N::class); $app = new ContactsManager($backEnd, $l); $app->setupContactsProvider($cm, 'user01', $urlGenerator); } }