diff options
Diffstat (limited to 'apps/dav/tests/unit/CardDAV')
8 files changed, 23 insertions, 19 deletions
diff --git a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php index 833221bd3ea..f3abfbbde9e 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php @@ -55,7 +55,7 @@ class AddressBookImplTest extends TestCase { /** @var VCard | \PHPUnit_Framework_MockObject_MockObject */ private $vCard; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->addressBookInfo = [ diff --git a/apps/dav/tests/unit/CardDAV/AddressBookTest.php b/apps/dav/tests/unit/CardDAV/AddressBookTest.php index 8fa6023f0d2..e801eb22b53 100644 --- a/apps/dav/tests/unit/CardDAV/AddressBookTest.php +++ b/apps/dav/tests/unit/CardDAV/AddressBookTest.php @@ -51,10 +51,10 @@ class AddressBookTest extends TestCase { $c->delete(); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ + public function testDeleteFromGroup() { + $this->expectException(\Sabre\DAV\Exception\Forbidden::class); + /** @var \PHPUnit_Framework_MockObject_MockObject | CardDavBackend $backend */ $backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock(); $backend->expects($this->never())->method('updateShares'); @@ -73,10 +73,10 @@ class AddressBookTest extends TestCase { $c->delete(); } - /** - * @expectedException \Sabre\DAV\Exception\Forbidden - */ + public function testPropPatch() { + $this->expectException(\Sabre\DAV\Exception\Forbidden::class); + /** @var \PHPUnit_Framework_MockObject_MockObject | CardDavBackend $backend */ $backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock(); $calendarInfo = [ diff --git a/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php b/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php index 06ea1329ec0..82333143958 100644 --- a/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php +++ b/apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php @@ -52,7 +52,7 @@ class BirthdayServiceTest extends TestCase { /** @var IL10N | \PHPUnit_Framework_MockObject_MockObject */ private $l10n; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->calDav = $this->createMock(CalDavBackend::class); diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php index aa18ef63a5c..f2a85cb9dbb 100644 --- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php +++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php @@ -121,7 +121,7 @@ class CardDavBackendTest extends TestCase { 'N:TestNoUID;;;;'.PHP_EOL. 'END:VCARD'; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->userManager = $this->createMock(IUserManager::class); @@ -159,7 +159,7 @@ class CardDavBackendTest extends TestCase { $this->tearDown(); } - public function tearDown() { + protected function tearDown(): void { parent::tearDown(); if (is_null($this->backend)) { @@ -631,10 +631,10 @@ class CardDavBackendTest extends TestCase { $this->invokePrivate($this->backend, 'getCardId', [1, 'uri'])); } - /** - * @expectedException InvalidArgumentException - */ + public function testGetCardIdFailed() { + $this->expectException(\InvalidArgumentException::class); + $this->invokePrivate($this->backend, 'getCardId', [1, 'uri']); } @@ -784,10 +784,10 @@ class CardDavBackendTest extends TestCase { $this->assertSame('uri', $this->backend->getCardUri($id)); } - /** - * @expectedException InvalidArgumentException - */ + public function testGetCardUriFailed() { + $this->expectException(\InvalidArgumentException::class); + $this->backend->getCardUri(1); } diff --git a/apps/dav/tests/unit/CardDAV/ConverterTest.php b/apps/dav/tests/unit/CardDAV/ConverterTest.php index dbb035a33d3..e308bd71cfc 100644 --- a/apps/dav/tests/unit/CardDAV/ConverterTest.php +++ b/apps/dav/tests/unit/CardDAV/ConverterTest.php @@ -39,7 +39,7 @@ class ConverterTest extends TestCase { /** @var AccountManager | PHPUnit_Framework_MockObject_MockObject */ private $accountManager; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->accountManager = $this->createMock(AccountManager::class); diff --git a/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php b/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php index f7b9137b480..d7f8ce5d159 100644 --- a/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php +++ b/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php @@ -53,7 +53,7 @@ class ImageExportPluginTest extends TestCase { /** @var PhotoCache|\PHPUnit_Framework_MockObject_MockObject */ private $cache; - function setUp() { + protected function setUp(): void { parent::setUp(); $this->request = $this->createMock(RequestInterface::class); diff --git a/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php b/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php index c8dce8598a3..1cb7bc31f2f 100644 --- a/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php +++ b/apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php @@ -44,7 +44,7 @@ class PluginTest extends TestCase { /** @var IShareable | \PHPUnit_Framework_MockObject_MockObject */ private $book; - public function setUp() { + protected function setUp(): void { parent::setUp(); /** @var Auth | \PHPUnit_Framework_MockObject_MockObject $authBackend */ diff --git a/apps/dav/tests/unit/CardDAV/SyncServiceTest.php b/apps/dav/tests/unit/CardDAV/SyncServiceTest.php index 7d444571fac..241f7a3e10c 100644 --- a/apps/dav/tests/unit/CardDAV/SyncServiceTest.php +++ b/apps/dav/tests/unit/CardDAV/SyncServiceTest.php @@ -113,6 +113,10 @@ class SyncServiceTest extends TestCase { 'carddata' => "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 3.4.8//EN\r\nUID:test-user\r\nFN:test-user\r\nN:test-user;;;;\r\nEND:VCARD\r\n\r\n" ]); + $backend->method('getAddressBooksByUri') + ->with('principals/system/system', 'system') + ->willReturn(['id' => -1]); + /** @var IUserManager | \PHPUnit_Framework_MockObject_MockObject $userManager */ $userManager = $this->getMockBuilder(IUserManager::class)->disableOriginalConstructor()->getMock(); |