"Fix" the unit tests

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2019-03-06 11:06:03 +01:00
parent a788da6ac2
commit e13253c66a
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
2 changed files with 3 additions and 20 deletions

View File

@ -77,7 +77,7 @@ class Application extends App {
}
/**
* @param IManager $contactsManager
* @param IContactsManager $contactsManager
*/
public function setupSystemContactsProvider(IContactsManager $contactsManager) {
/** @var ContactsManager $cm */

View File

@ -26,7 +26,6 @@ namespace OCA\DAV\Tests\unit\AppInfo;
use OCA\DAV\AppInfo\Application;
use OCA\DAV\CardDAV\CardDavBackend;
use OCA\DAV\CardDAV\ContactsManager;
use OCP\Contacts\IManager;
use Test\TestCase;
/**
@ -43,24 +42,8 @@ class ApplicationTest extends TestCase {
// assert service instances in the container are properly setup
$s = $c->query(ContactsManager::class);
$this->assertInstanceOf('OCA\DAV\CardDAV\ContactsManager', $s);
$this->assertInstanceOf(ContactsManager::class, $s);
$s = $c->query(CardDavBackend::class);
$this->assertInstanceOf('OCA\DAV\CardDAV\CardDavBackend', $s);
}
public function testContactsManagerSetup() {
$app = new Application();
$c = $app->getContainer();
$c->registerService(CardDavBackend::class, function() {
$service = $this->createMock(CardDavBackend::class);
$service->method('getAddressBooksForUser')->willReturn([]);
return $service;
});
// assert setupContactsProvider() is proper
/** @var IManager|\PHPUnit_Framework_MockObject_MockObject $cm */
$cm = $this->createMock(IManager::class);
$app->setupContactsProvider($cm, 'xxx');
$this->addToAssertionCount(1);
$this->assertInstanceOf(CardDavBackend::class, $s);
}
}