diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2017-03-09 11:36:54 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-04-11 15:04:01 +0200 |
commit | 821e2878057343dcd6df9ce28b4885e3144ca318 (patch) | |
tree | a5ec63e57d387c40a2cda01ebe03957a9ac9647e /apps/federation/tests/SyncFederationAddressbooksTest.php | |
parent | d5dec527c964fd08b91f9ab6ffeea228ca214ad6 (diff) | |
download | nextcloud-server-821e2878057343dcd6df9ce28b4885e3144ca318.tar.gz nextcloud-server-821e2878057343dcd6df9ce28b4885e3144ca318.zip |
adjust existing tests
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/federation/tests/SyncFederationAddressbooksTest.php')
-rw-r--r-- | apps/federation/tests/SyncFederationAddressbooksTest.php | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/apps/federation/tests/SyncFederationAddressbooksTest.php b/apps/federation/tests/SyncFederationAddressbooksTest.php index 1a2dbf1bcae..9ce5efeb457 100644 --- a/apps/federation/tests/SyncFederationAddressbooksTest.php +++ b/apps/federation/tests/SyncFederationAddressbooksTest.php @@ -24,6 +24,7 @@ */ namespace OCA\Federation\Tests; +use OC\OCS\DiscoveryService; use OCA\Federation\DbHandler; use OCA\Federation\SyncFederationAddressBooks; @@ -32,7 +33,18 @@ class SyncFederationAddressbooksTest extends \Test\TestCase { /** @var array */ private $callBacks = []; - function testSync() { + /** @var \PHPUnit_Framework_MockObject_MockObject | DiscoveryService */ + private $discoveryService; + + public function setUp() { + parent::setUp(); + + $this->discoveryService = $this->getMockBuilder(DiscoveryService::class) + ->disableOriginalConstructor()->getMock(); + $this->discoveryService->expects($this->any())->method('discover')->willReturn([]); + } + + public function testSync() { /** @var DbHandler | \PHPUnit_Framework_MockObject_MockObject $dbHandler */ $dbHandler = $this->getMockBuilder('OCA\Federation\DbHandler')-> disableOriginalConstructor()-> @@ -55,14 +67,14 @@ class SyncFederationAddressbooksTest extends \Test\TestCase { ->willReturn(1); /** @var \OCA\DAV\CardDAV\SyncService $syncService */ - $s = new SyncFederationAddressBooks($dbHandler, $syncService); + $s = new SyncFederationAddressBooks($dbHandler, $syncService, $this->discoveryService); $s->syncThemAll(function($url, $ex) { $this->callBacks[] = [$url, $ex]; }); $this->assertEquals(1, count($this->callBacks)); } - function testException() { + public function testException() { /** @var DbHandler | \PHPUnit_Framework_MockObject_MockObject $dbHandler */ $dbHandler = $this->getMockBuilder('OCA\Federation\DbHandler')-> disableOriginalConstructor()-> @@ -83,7 +95,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase { ->willThrowException(new \Exception('something did not work out')); /** @var \OCA\DAV\CardDAV\SyncService $syncService */ - $s = new SyncFederationAddressBooks($dbHandler, $syncService); + $s = new SyncFederationAddressBooks($dbHandler, $syncService, $this->discoveryService); $s->syncThemAll(function($url, $ex) { $this->callBacks[] = [$url, $ex]; }); |