summaryrefslogtreecommitdiffstats
path: root/apps/federation/tests/SyncFederationAddressbooksTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/federation/tests/SyncFederationAddressbooksTest.php')
-rw-r--r--apps/federation/tests/SyncFederationAddressbooksTest.php20
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];
});