diff options
Diffstat (limited to 'apps/dav/tests/unit/Settings/CalDAVSettingsTest.php')
-rw-r--r-- | apps/dav/tests/unit/Settings/CalDAVSettingsTest.php | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php b/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php index 9f2d2582884..df7a08d5d08 100644 --- a/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php +++ b/apps/dav/tests/unit/Settings/CalDAVSettingsTest.php @@ -1,9 +1,11 @@ <?php + +declare(strict_types=1); /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace OCA\DAV\Tests\Unit\DAV\Settings; +namespace OCA\DAV\Tests\unit\DAV\Settings; use OCA\DAV\Settings\CalDAVSettings; use OCP\App\IAppManager; @@ -15,19 +17,10 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class CalDAVSettingsTest extends TestCase { - - /** @var IConfig|MockObject */ - private $config; - - /** @var IInitialState|MockObject */ - private $initialState; - - /** @var IURLGenerator|MockObject */ - private $urlGenerator; - - /** @var IAppManager|MockObject */ - private $appManager; - + private IConfig&MockObject $config; + private IInitialState&MockObject $initialState; + private IURLGenerator&MockObject $urlGenerator; + private IAppManager&MockObject $appManager; private CalDAVSettings $settings; protected function setUp(): void { @@ -42,28 +35,32 @@ class CalDAVSettingsTest extends TestCase { public function testGetForm(): void { $this->config->method('getAppValue') - ->withConsecutive( - ['dav', 'sendInvitations', 'yes'], - ['dav', 'generateBirthdayCalendar', 'yes'], - ['dav', 'sendEventReminders', 'yes'], - ['dav', 'sendEventRemindersToSharedUsers', 'yes'], - ['dav', 'sendEventRemindersPush', 'yes'], - ) - ->will($this->onConsecutiveCalls('yes', 'no', 'yes', 'yes', 'yes')); + ->willReturnMap([ + ['dav', 'sendInvitations', 'yes', 'yes'], + ['dav', 'generateBirthdayCalendar', 'yes', 'no'], + ['dav', 'sendEventReminders', 'yes', 'yes'], + ['dav', 'sendEventRemindersToSharedUsers', 'yes', 'yes'], + ['dav', 'sendEventRemindersPush', 'yes', 'yes'], + ]); $this->urlGenerator ->expects($this->once()) ->method('linkToDocs') ->with('user-sync-calendars') ->willReturn('Some docs URL'); + + $calls = [ + ['userSyncCalendarsDocUrl', 'Some docs URL'], + ['sendInvitations', true], + ['generateBirthdayCalendar', false], + ['sendEventReminders', true], + ['sendEventRemindersToSharedUsers', true], + ['sendEventRemindersPush', true], + ]; $this->initialState->method('provideInitialState') - ->withConsecutive( - ['userSyncCalendarsDocUrl', 'Some docs URL'], - ['sendInvitations', true], - ['generateBirthdayCalendar', false], - ['sendEventReminders', true], - ['sendEventRemindersToSharedUsers', true], - ['sendEventRemindersPush', true], - ); + ->willReturnCallback(function () use (&$calls) { + $expected = array_shift($calls); + $this->assertEquals($expected, func_get_args()); + }); $result = $this->settings->getForm(); $this->assertInstanceOf(TemplateResponse::class, $result); @@ -88,5 +85,4 @@ class CalDAVSettingsTest extends TestCase { public function testGetPriority(): void { $this->assertEquals(10, $this->settings->getPriority()); } - } |