diff options
Diffstat (limited to 'apps/federation/tests/SyncFederationAddressbooksTest.php')
-rw-r--r-- | apps/federation/tests/SyncFederationAddressbooksTest.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/federation/tests/SyncFederationAddressbooksTest.php b/apps/federation/tests/SyncFederationAddressbooksTest.php index 73c44c72399..a5da446b931 100644 --- a/apps/federation/tests/SyncFederationAddressbooksTest.php +++ b/apps/federation/tests/SyncFederationAddressbooksTest.php @@ -28,28 +28,34 @@ */ namespace OCA\Federation\Tests; +use Psr\Log\LoggerInterface; use OC\OCS\DiscoveryService; use OCA\Federation\DbHandler; use OCA\Federation\SyncFederationAddressBooks; +use PHPUnit\Framework\MockObject\MockObject; class SyncFederationAddressbooksTest extends \Test\TestCase { /** @var array */ private $callBacks = []; - /** @var \PHPUnit\Framework\MockObject\MockObject | DiscoveryService */ + /** @var MockObject | DiscoveryService */ private $discoveryService; + /** @var MockObject|LoggerInterface */ + private $logger; + protected function setUp(): void { parent::setUp(); $this->discoveryService = $this->getMockBuilder(DiscoveryService::class) ->disableOriginalConstructor()->getMock(); $this->discoveryService->expects($this->any())->method('discover')->willReturn([]); + $this->logger = $this->createMock(LoggerInterface::class); } public function testSync() { - /** @var DbHandler | \PHPUnit\Framework\MockObject\MockObject $dbHandler */ + /** @var DbHandler | MockObject $dbHandler */ $dbHandler = $this->getMockBuilder('OCA\Federation\DbHandler') ->disableOriginalConstructor() ->getMock(); @@ -71,7 +77,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase { ->willReturn('1'); /** @var \OCA\DAV\CardDAV\SyncService $syncService */ - $s = new SyncFederationAddressBooks($dbHandler, $syncService, $this->discoveryService); + $s = new SyncFederationAddressBooks($dbHandler, $syncService, $this->discoveryService, $this->logger); $s->syncThemAll(function ($url, $ex) { $this->callBacks[] = [$url, $ex]; }); @@ -79,7 +85,7 @@ class SyncFederationAddressbooksTest extends \Test\TestCase { } public function testException() { - /** @var DbHandler | \PHPUnit\Framework\MockObject\MockObject $dbHandler */ + /** @var DbHandler | MockObject $dbHandler */ $dbHandler = $this->getMockBuilder('OCA\Federation\DbHandler')-> disableOriginalConstructor()-> getMock(); @@ -99,7 +105,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, $this->discoveryService); + $s = new SyncFederationAddressBooks($dbHandler, $syncService, $this->discoveryService, $this->logger); $s->syncThemAll(function ($url, $ex) { $this->callBacks[] = [$url, $ex]; }); |