aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/tests/Settings
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings/tests/Settings')
-rw-r--r--apps/settings/tests/Settings/Admin/MailTest.php136
-rw-r--r--apps/settings/tests/Settings/Admin/SecurityTest.php89
-rw-r--r--apps/settings/tests/Settings/Admin/ServerTest.php99
-rw-r--r--apps/settings/tests/Settings/Admin/SharingTest.php477
-rw-r--r--apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php113
-rw-r--r--apps/settings/tests/Settings/Personal/Security/PasswordTest.php37
6 files changed, 376 insertions, 575 deletions
diff --git a/apps/settings/tests/Settings/Admin/MailTest.php b/apps/settings/tests/Settings/Admin/MailTest.php
index 60a8f39cfa8..992c7d43dba 100644
--- a/apps/settings/tests/Settings/Admin/MailTest.php
+++ b/apps/settings/tests/Settings/Admin/MailTest.php
@@ -1,123 +1,79 @@
<?php
+
/**
- * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCA\Settings\Tests\Settings\Admin;
use OCA\Settings\Settings\Admin\Mail;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\IBinaryFinder;
use OCP\IConfig;
+use OCP\IL10N;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class MailTest extends TestCase {
- /** @var Mail */
- private $admin;
- /** @var IConfig */
- private $config;
+
+ private Mail $admin;
+ private IConfig&MockObject $config;
+ private IL10N&MockObject $l10n;
protected function setUp(): void {
parent::setUp();
- $this->config = $this->getMockBuilder(IConfig::class)->getMock();
+ $this->config = $this->createMock(IConfig::class);
+ $this->l10n = $this->createMock(IL10N::class);
$this->admin = new Mail(
- $this->config
+ $this->config,
+ $this->l10n
);
}
- public function testGetForm() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('mail_domain', '')
- ->willReturn('mx.nextcloud.com');
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('mail_from_address', '')
- ->willReturn('no-reply@nextcloud.com');
- $this->config
- ->expects($this->at(2))
- ->method('getSystemValue')
- ->with('mail_smtpmode', '')
- ->willReturn('smtp');
- $this->config
- ->expects($this->at(3))
- ->method('getSystemValue')
- ->with('mail_smtpsecure', '')
- ->willReturn(true);
- $this->config
- ->expects($this->at(4))
- ->method('getSystemValue')
- ->with('mail_smtphost', '')
- ->willReturn('smtp.nextcloud.com');
- $this->config
- ->expects($this->at(5))
- ->method('getSystemValue')
- ->with('mail_smtpport', '')
- ->willReturn(25);
- $this->config
- ->expects($this->at(6))
- ->method('getSystemValue')
- ->with('mail_smtpauthtype', '')
- ->willReturn('login');
- $this->config
- ->expects($this->at(7))
- ->method('getSystemValue')
- ->with('mail_smtpauth', false)
- ->willReturn(true);
- $this->config
- ->expects($this->at(8))
- ->method('getSystemValue')
- ->with('mail_smtpname', '')
- ->willReturn('smtp.sender.com');
- $this->config
- ->expects($this->at(9))
- ->method('getSystemValue')
- ->with('mail_smtppassword', '')
- ->willReturn('mypassword');
+ public static function dataGetForm(): array {
+ return [
+ [true],
+ [false],
+ ];
+ }
+
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataGetForm')]
+ public function testGetForm(bool $sendmail) {
+ $finder = $this->createMock(IBinaryFinder::class);
+ $finder->expects(self::once())
+ ->method('findBinaryPath')
+ ->with('sendmail')
+ ->willReturn($sendmail ? '/usr/bin/sendmail': false);
+ $this->overwriteService(IBinaryFinder::class, $finder);
+
$this->config
- ->expects($this->at(10))
+ ->expects($this->any())
->method('getSystemValue')
- ->with('mail_sendmailmode', 'smtp')
- ->willReturn('smtp');
+ ->willReturnMap([
+ ['mail_domain', '', 'mx.nextcloud.com'],
+ ['mail_from_address', '', 'no-reply@nextcloud.com'],
+ ['mail_smtpmode', '', 'smtp'],
+ ['mail_smtpsecure', '', true],
+ ['mail_smtphost', '', 'smtp.nextcloud.com'],
+ ['mail_smtpport', '', 25],
+ ['mail_smtpauth', false, true],
+ ['mail_smtpname', '', 'smtp.sender.com'],
+ ['mail_smtppassword', '', 'mypassword'],
+ ['mail_sendmailmode', 'smtp', 'smtp'],
+ ]);
$expected = new TemplateResponse(
'settings',
'settings/admin/additional-mail',
[
- 'sendmail_is_available' => (bool) \OC_Helper::findBinaryPath('sendmail'),
+ 'sendmail_is_available' => $sendmail,
'mail_domain' => 'mx.nextcloud.com',
'mail_from_address' => 'no-reply@nextcloud.com',
'mail_smtpmode' => 'smtp',
'mail_smtpsecure' => true,
'mail_smtphost' => 'smtp.nextcloud.com',
'mail_smtpport' => 25,
- 'mail_smtpauthtype' => 'login',
'mail_smtpauth' => true,
'mail_smtpname' => 'smtp.sender.com',
'mail_smtppassword' => '********',
@@ -129,11 +85,11 @@ class MailTest extends TestCase {
$this->assertEquals($expected, $this->admin->getForm());
}
- public function testGetSection() {
+ public function testGetSection(): void {
$this->assertSame('server', $this->admin->getSection());
}
- public function testGetPriority() {
+ public function testGetPriority(): void {
$this->assertSame(10, $this->admin->getPriority());
}
}
diff --git a/apps/settings/tests/Settings/Admin/SecurityTest.php b/apps/settings/tests/Settings/Admin/SecurityTest.php
index a8a140b2c5d..89a6d8c0d88 100644
--- a/apps/settings/tests/Settings/Admin/SecurityTest.php
+++ b/apps/settings/tests/Settings/Admin/SecurityTest.php
@@ -1,84 +1,53 @@
<?php
+
/**
- * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCA\Settings\Tests\Settings\Admin;
use OC\Authentication\TwoFactorAuth\MandatoryTwoFactor;
use OC\Encryption\Manager;
use OCA\Settings\Settings\Admin\Security;
use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IInitialStateService;
+use OCP\AppFramework\Services\IInitialState;
+use OCP\IURLGenerator;
use OCP\IUserManager;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class SecurityTest extends TestCase {
- /** @var Security */
- private $admin;
- /** @var Manager */
- private $manager;
- /** @var IUserManager */
- private $userManager;
- /** @var MandatoryTwoFactor|MockObject */
- private $mandatoryTwoFactor;
- /** @var IInitialStateService|MockObject */
- private $initialState;
+ private Manager $manager;
+ private IUserManager $userManager;
+ private MandatoryTwoFactor&MockObject $mandatoryTwoFactor;
+ private IInitialState&MockObject $initialState;
+ private Security $admin;
protected function setUp(): void {
parent::setUp();
- $this->manager = $this->getMockBuilder(Manager::class)->disableOriginalConstructor()->getMock();
- $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock();
+ $this->manager = $this->createMock(Manager::class);
+ $this->userManager = $this->createMock(IUserManager::class);
$this->mandatoryTwoFactor = $this->createMock(MandatoryTwoFactor::class);
- $this->initialState = $this->createMock(IInitialStateService::class);
+ $this->initialState = $this->createMock(IInitialState::class);
$this->admin = new Security(
$this->manager,
$this->userManager,
$this->mandatoryTwoFactor,
- $this->initialState
+ $this->initialState,
+ $this->createMock(IURLGenerator::class)
);
}
- /**
- * @return array
- */
- public function encryptionSettingsProvider() {
+ public static function encryptionSettingsProvider(): array {
return [
[true],
[false],
];
}
- /**
- * @dataProvider encryptionSettingsProvider
- * @param bool $enabled
- */
- public function testGetFormWithOnlyOneBackend($enabled) {
+ #[\PHPUnit\Framework\Attributes\DataProvider('encryptionSettingsProvider')]
+ public function testGetFormWithOnlyOneBackend(bool $enabled): void {
$this->manager
->expects($this->once())
->method('isEnabled')
@@ -98,22 +67,17 @@ class SecurityTest extends TestCase {
$expected = new TemplateResponse(
'settings',
'settings/admin/security',
- [
- 'encryptionEnabled' => $enabled,
- 'encryptionReady' => $enabled,
- 'externalBackendsEnabled' => false,
- 'encryptionModules' => []
- ],
+ [],
''
);
$this->assertEquals($expected, $this->admin->getForm());
}
/**
- * @dataProvider encryptionSettingsProvider
* @param bool $enabled
*/
- public function testGetFormWithMultipleBackends($enabled) {
+ #[\PHPUnit\Framework\Attributes\DataProvider('encryptionSettingsProvider')]
+ public function testGetFormWithMultipleBackends($enabled): void {
$this->manager
->expects($this->once())
->method('isEnabled')
@@ -133,22 +97,17 @@ class SecurityTest extends TestCase {
$expected = new TemplateResponse(
'settings',
'settings/admin/security',
- [
- 'encryptionEnabled' => $enabled,
- 'encryptionReady' => $enabled,
- 'externalBackendsEnabled' => true,
- 'encryptionModules' => []
- ],
+ [ ],
''
);
$this->assertEquals($expected, $this->admin->getForm());
}
- public function testGetSection() {
+ public function testGetSection(): void {
$this->assertSame('security', $this->admin->getSection());
}
- public function testGetPriority() {
+ public function testGetPriority(): void {
$this->assertSame(10, $this->admin->getPriority());
}
}
diff --git a/apps/settings/tests/Settings/Admin/ServerTest.php b/apps/settings/tests/Settings/Admin/ServerTest.php
index f37cb01a40d..e2ca4cff3c6 100644
--- a/apps/settings/tests/Settings/Admin/ServerTest.php
+++ b/apps/settings/tests/Settings/Admin/ServerTest.php
@@ -3,40 +3,21 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCA\Settings\Tests\Settings\Admin;
+use OC\Profile\ProfileManager;
use OCA\Settings\Settings\Admin\Server;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\AppFramework\Services\IInitialState;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\IAppConfig;
use OCP\IConfig;
use OCP\IDBConnection;
+use OCP\IL10N;
+use OCP\IUrlGenerator;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
@@ -44,27 +25,38 @@ use Test\TestCase;
* @group DB
*/
class ServerTest extends TestCase {
- /** @var Server */
- private $admin;
- /** @var IDBConnection */
- private $connection;
- /** @var ITimeFactory|MockObject */
- private $timeFactory;
- /** @var IConfig|MockObject */
- private $config;
+ private IDBConnection $connection;
+ private Server&MockObject $admin;
+ private IInitialState&MockObject $initialStateService;
+ private ProfileManager&MockObject $profileManager;
+ private ITimeFactory&MockObject $timeFactory;
+ private IConfig&MockObject $config;
+ private IAppConfig&MockObject $appConfig;
+ private IL10N&MockObject $l10n;
+ private IUrlGenerator&MockObject $urlGenerator;
protected function setUp(): void {
parent::setUp();
- $this->connection = \OC::$server->getDatabaseConnection();
+ $this->connection = \OCP\Server::get(IDBConnection::class);
+ $this->initialStateService = $this->createMock(IInitialState::class);
+ $this->profileManager = $this->createMock(ProfileManager::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->config = $this->createMock(IConfig::class);
+ $this->appConfig = $this->createMock(IAppConfig::class);
+ $this->l10n = $this->createMock(IL10N::class);
+ $this->urlGenerator = $this->createMock(IUrlGenerator::class);
$this->admin = $this->getMockBuilder(Server::class)
->onlyMethods(['cronMaxAge'])
->setConstructorArgs([
$this->connection,
+ $this->initialStateService,
+ $this->profileManager,
$this->timeFactory,
+ $this->urlGenerator,
$this->config,
+ $this->appConfig,
+ $this->l10n,
])
->getMock();
}
@@ -74,30 +66,29 @@ class ServerTest extends TestCase {
->method('cronMaxAge')
->willReturn(1337);
$this->config
- ->expects($this->at(0))
- ->method('getAppValue')
- ->with('core', 'backgroundjobs_mode', 'ajax')
- ->willReturn('ajax');
- $this->config
- ->expects($this->at(1))
- ->method('getAppValue')
- ->with('core', 'lastcron', false)
- ->willReturn(false);
- $this->config
- ->expects($this->at(2))
+ ->expects($this->any())
->method('getAppValue')
- ->with('core', 'cronErrors')
- ->willReturn('');
+ ->willReturnMap([
+ ['core', 'lastcron', '0', '0'],
+ ['core', 'cronErrors', ''],
+ ]);
+ $this->appConfig
+ ->expects($this->any())
+ ->method('getValueString')
+ ->willReturnCallback(fn ($a, $b, $default) => $default);
+ $this->appConfig
+ ->expects($this->any())
+ ->method('getValueBool')
+ ->willReturnCallback(fn ($a, $b, $default) => $default);
+ $this->profileManager
+ ->expects($this->exactly(2))
+ ->method('isProfileEnabled')
+ ->willReturn(true);
$expected = new TemplateResponse(
'settings',
'settings/admin/server',
[
- 'backgroundjobs_mode' => 'ajax',
- 'lastcron' => false,
- 'cronErrors' => '',
- 'cronMaxAge' => 1337,
- 'cli_based_cron_possible' => true,
- 'cli_based_cron_user' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : '', // to not explode here because of posix extension not being disabled - which is already checked in the line above
+ 'profileEnabledGlobally' => true,
],
''
);
diff --git a/apps/settings/tests/Settings/Admin/SharingTest.php b/apps/settings/tests/Settings/Admin/SharingTest.php
index 52e83f8ba7f..f37ade2171f 100644
--- a/apps/settings/tests/Settings/Admin/SharingTest.php
+++ b/apps/settings/tests/Settings/Admin/SharingTest.php
@@ -1,321 +1,264 @@
<?php
+
/**
- * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Daniel Kesselberg <mail@danielkesselberg.de>
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCA\Settings\Tests\Settings\Admin;
use OCA\Settings\Settings\Admin\Sharing;
+use OCP\App\IAppManager;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\AppFramework\Services\IInitialState;
use OCP\Constants;
+use OCP\IAppConfig;
use OCP\IConfig;
use OCP\IL10N;
+use OCP\IURLGenerator;
use OCP\Share\IManager;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class SharingTest extends TestCase {
- /** @var Sharing */
- private $admin;
- /** @var IConfig */
- private $config;
- /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
- private $l10n;
- /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */
- private $shareManager;
+ private Sharing $admin;
+
+ private IConfig&MockObject $config;
+ private IAppConfig&MockObject $appConfig;
+ private IL10N&MockObject $l10n;
+ private IManager&MockObject $shareManager;
+ private IAppManager&MockObject $appManager;
+ private IURLGenerator&MockObject $urlGenerator;
+ private IInitialState&MockObject $initialState;
protected function setUp(): void {
parent::setUp();
- $this->config = $this->getMockBuilder(IConfig::class)->getMock();
- $this->l10n = $this->getMockBuilder(IL10N::class)->getMock();
+ $this->config = $this->createMock(IConfig::class);
+ $this->appConfig = $this->createMock(IAppConfig::class);
+ $this->l10n = $this->createMock(IL10N::class);
- $this->shareManager = $this->getMockBuilder(IManager::class)->getMock();
+ $this->shareManager = $this->createMock(IManager::class);
+ $this->appManager = $this->createMock(IAppManager::class);
+ $this->urlGenerator = $this->createMock(IURLGenerator::class);
+ $this->initialState = $this->createMock(IInitialState::class);
$this->admin = new Sharing(
$this->config,
+ $this->appConfig,
$this->l10n,
- $this->shareManager
+ $this->shareManager,
+ $this->appManager,
+ $this->urlGenerator,
+ $this->initialState,
+ 'settings',
);
}
- public function testGetFormWithoutExcludedGroups() {
- $this->config
- ->expects($this->at(0))
- ->method('getAppValue')
- ->with('core', 'shareapi_exclude_groups_list', '')
- ->willReturn('');
- $this->config
- ->expects($this->at(1))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_group_sharing', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(2))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_links', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(3))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_public_upload', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(4))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_resharing', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(5))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(6))
- ->method('getAppValue')
- ->with('core', 'shareapi_restrict_user_enumeration_to_group', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(7))
- ->method('getAppValue')
- ->with('core', 'shareapi_enabled', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(8))
- ->method('getAppValue')
- ->with('core', 'shareapi_default_expire_date', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(9))
- ->method('getAppValue')
- ->with('core', 'shareapi_expire_after_n_days', '7')
- ->willReturn('7');
- $this->config
- ->expects($this->at(10))
- ->method('getAppValue')
- ->with('core', 'shareapi_enforce_expire_date', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(11))
- ->method('getAppValue')
- ->with('core', 'shareapi_exclude_groups', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(12))
- ->method('getAppValue')
- ->with('core', 'shareapi_public_link_disclaimertext', null)
- ->willReturn('Lorem ipsum');
- $this->config
- ->expects($this->at(13))
- ->method('getAppValue')
- ->with('core', 'shareapi_enable_link_password_by_default', 'no')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(14))
- ->method('getAppValue')
- ->with('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL)
- ->willReturn(Constants::PERMISSION_ALL);
- $this->config
- ->expects($this->at(15))
- ->method('getAppValue')
- ->with('core', 'shareapi_default_internal_expire_date', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(16))
- ->method('getAppValue')
- ->with('core', 'shareapi_internal_expire_after_n_days', '7')
- ->willReturn('7');
+ public function testGetFormWithoutExcludedGroups(): void {
+ $this->appConfig
+ ->method('getValueBool')
+ ->willReturnMap([
+ ['core', 'shareapi_allow_federation_on_public_shares', true],
+ ['core', 'shareapi_enable_link_password_by_default', true],
+ ]);
+
$this->config
- ->expects($this->at(17))
->method('getAppValue')
- ->with('core', 'shareapi_enforce_internal_expire_date', 'no')
- ->willReturn('no');
+ ->willReturnMap([
+ ['core', 'shareapi_exclude_groups_list', '', ''],
+ ['core', 'shareapi_allow_links_exclude_groups', '', ''],
+ ['core', 'shareapi_allow_group_sharing', 'yes', 'yes'],
+ ['core', 'shareapi_allow_links', 'yes', 'yes'],
+ ['core', 'shareapi_allow_public_upload', 'yes', 'yes'],
+ ['core', 'shareapi_allow_resharing', 'yes', 'yes'],
+ ['core', 'shareapi_allow_share_dialog_user_enumeration', 'yes', 'yes'],
+ ['core', 'shareapi_restrict_user_enumeration_to_group', 'no', 'no'],
+ ['core', 'shareapi_restrict_user_enumeration_to_phone', 'no', 'no'],
+ ['core', 'shareapi_restrict_user_enumeration_full_match', 'yes', 'yes'],
+ ['core', 'shareapi_restrict_user_enumeration_full_match_userid', 'yes', 'yes'],
+ ['core', 'shareapi_restrict_user_enumeration_full_match_email', 'yes', 'yes'],
+ ['core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_dn', 'no', 'no'],
+ ['core', 'shareapi_enabled', 'yes', 'yes'],
+ ['core', 'shareapi_default_expire_date', 'no', 'no'],
+ ['core', 'shareapi_expire_after_n_days', '7', '7'],
+ ['core', 'shareapi_enforce_expire_date', 'no', 'no'],
+ ['core', 'shareapi_exclude_groups', 'no', 'no'],
+ ['core', 'shareapi_public_link_disclaimertext', '', 'Lorem ipsum'],
+ ['core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL, Constants::PERMISSION_ALL],
+ ['core', 'shareapi_default_internal_expire_date', 'no', 'no'],
+ ['core', 'shareapi_internal_expire_after_n_days', '7', '7'],
+ ['core', 'shareapi_enforce_internal_expire_date', 'no', 'no'],
+ ['core', 'shareapi_default_remote_expire_date', 'no', 'no'],
+ ['core', 'shareapi_remote_expire_after_n_days', '7', '7'],
+ ['core', 'shareapi_enforce_remote_expire_date', 'no', 'no'],
+ ['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
+ ['core', 'shareapi_only_share_with_group_members_exclude_group_list', '', '[]'],
+ ]);
+ $this->shareManager->method('shareWithGroupMembersOnly')
+ ->willReturn(false);
+
+ $this->appManager->method('isEnabledForUser')->with('files_sharing')->willReturn(false);
+
+ $initialStateCalls = [];
+ $this->initialState
+ ->expects($this->exactly(3))
+ ->method('provideInitialState')
+ ->willReturnCallback(function (string $key) use (&$initialStateCalls): void {
+ $initialStateCalls[$key] = func_get_args();
+ });
+
+ $expectedInitialStateCalls = [
+ 'sharingAppEnabled' => false,
+ 'sharingDocumentation' => '',
+ 'sharingSettings' => [
+ 'allowGroupSharing' => true,
+ 'allowLinks' => true,
+ 'allowPublicUpload' => true,
+ 'allowResharing' => true,
+ 'allowShareDialogUserEnumeration' => true,
+ 'allowFederationOnPublicShares' => true,
+ 'restrictUserEnumerationToGroup' => false,
+ 'restrictUserEnumerationToPhone' => false,
+ 'restrictUserEnumerationFullMatch' => true,
+ 'restrictUserEnumerationFullMatchUserId' => true,
+ 'restrictUserEnumerationFullMatchEmail' => true,
+ 'restrictUserEnumerationFullMatchIgnoreSecondDN' => false,
+ 'enforceLinksPassword' => false,
+ 'onlyShareWithGroupMembers' => false,
+ 'enabled' => true,
+ 'defaultExpireDate' => false,
+ 'expireAfterNDays' => '7',
+ 'enforceExpireDate' => false,
+ 'excludeGroups' => 'no',
+ 'excludeGroupsList' => [],
+ 'publicShareDisclaimerText' => 'Lorem ipsum',
+ 'enableLinkPasswordByDefault' => true,
+ 'defaultPermissions' => Constants::PERMISSION_ALL,
+ 'defaultInternalExpireDate' => false,
+ 'internalExpireAfterNDays' => '7',
+ 'enforceInternalExpireDate' => false,
+ 'defaultRemoteExpireDate' => false,
+ 'remoteExpireAfterNDays' => '7',
+ 'enforceRemoteExpireDate' => false,
+ 'allowLinksExcludeGroups' => [],
+ 'onlyShareWithGroupMembersExcludeGroupList' => [],
+ 'enforceLinksPasswordExcludedGroups' => [],
+ 'enforceLinksPasswordExcludedGroupsEnabled' => false,
+ ]
+ ];
$expected = new TemplateResponse(
'settings',
'settings/admin/sharing',
- [
- 'allowGroupSharing' => 'yes',
- 'allowLinks' => 'yes',
- 'allowPublicUpload' => 'yes',
- 'allowResharing' => 'yes',
- 'allowShareDialogUserEnumeration' => 'yes',
- 'restrictUserEnumerationToGroup' => 'no',
- 'enforceLinkPassword' => false,
- 'onlyShareWithGroupMembers' => false,
- 'shareAPIEnabled' => 'yes',
- 'shareDefaultExpireDateSet' => 'no',
- 'shareExpireAfterNDays' => '7',
- 'shareEnforceExpireDate' => 'no',
- 'shareExcludeGroups' => false,
- 'shareExcludedGroupsList' => '',
- 'publicShareDisclaimerText' => 'Lorem ipsum',
- 'enableLinkPasswordByDefault' => 'yes',
- 'shareApiDefaultPermissions' => Constants::PERMISSION_ALL,
- 'shareApiDefaultPermissionsCheckboxes' => $this->invokePrivate($this->admin, 'getSharePermissionList', []),
- 'shareDefaultInternalExpireDateSet' => 'no',
- 'shareInternalExpireAfterNDays' => '7',
- 'shareInternalEnforceExpireDate' => 'no',
- ],
+ [],
''
);
$this->assertEquals($expected, $this->admin->getForm());
+ $this->assertEquals(sort($expectedInitialStateCalls), sort($initialStateCalls), 'Provided initial state does not match');
}
- public function testGetFormWithExcludedGroups() {
- $this->config
- ->expects($this->at(0))
- ->method('getAppValue')
- ->with('core', 'shareapi_exclude_groups_list', '')
- ->willReturn('["NoSharers","OtherNoSharers"]');
- $this->config
- ->expects($this->at(1))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_group_sharing', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(2))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_links', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(3))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_public_upload', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(4))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_resharing', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(5))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(6))
- ->method('getAppValue')
- ->with('core', 'shareapi_restrict_user_enumeration_to_group', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(7))
- ->method('getAppValue')
- ->with('core', 'shareapi_enabled', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(8))
- ->method('getAppValue')
- ->with('core', 'shareapi_default_expire_date', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(9))
- ->method('getAppValue')
- ->with('core', 'shareapi_expire_after_n_days', '7')
- ->willReturn('7');
- $this->config
- ->expects($this->at(10))
- ->method('getAppValue')
- ->with('core', 'shareapi_enforce_expire_date', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(11))
- ->method('getAppValue')
- ->with('core', 'shareapi_exclude_groups', 'no')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(12))
- ->method('getAppValue')
- ->with('core', 'shareapi_public_link_disclaimertext', null)
- ->willReturn('Lorem ipsum');
- $this->config
- ->expects($this->at(13))
- ->method('getAppValue')
- ->with('core', 'shareapi_enable_link_password_by_default', 'no')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(14))
- ->method('getAppValue')
- ->with('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL)
- ->willReturn(Constants::PERMISSION_ALL);
- $this->config
- ->expects($this->at(15))
- ->method('getAppValue')
- ->with('core', 'shareapi_default_internal_expire_date', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(16))
- ->method('getAppValue')
- ->with('core', 'shareapi_internal_expire_after_n_days', '7')
- ->willReturn('7');
- $this->config
- ->expects($this->at(17))
- ->method('getAppValue')
- ->with('core', 'shareapi_enforce_internal_expire_date', 'no')
- ->willReturn('no');
+ public function testGetFormWithExcludedGroups(): void {
+ $this->config
+ ->method('getAppValue')
+ ->willReturnMap([
+ ['core', 'shareapi_exclude_groups_list', '', '["NoSharers","OtherNoSharers"]'],
+ ['core', 'shareapi_allow_links_exclude_groups', '', ''],
+ ['core', 'shareapi_allow_group_sharing', 'yes', 'yes'],
+ ['core', 'shareapi_allow_links', 'yes', 'yes'],
+ ['core', 'shareapi_allow_public_upload', 'yes', 'yes'],
+ ['core', 'shareapi_allow_resharing', 'yes', 'yes'],
+ ['core', 'shareapi_allow_share_dialog_user_enumeration', 'yes', 'yes'],
+ ['core', 'shareapi_restrict_user_enumeration_to_group', 'no', 'no'],
+ ['core', 'shareapi_restrict_user_enumeration_to_phone', 'no', 'no'],
+ ['core', 'shareapi_restrict_user_enumeration_full_match', 'yes', 'yes'],
+ ['core', 'shareapi_restrict_user_enumeration_full_match_userid', 'yes', 'yes'],
+ ['core', 'shareapi_restrict_user_enumeration_full_match_email', 'yes', 'yes'],
+ ['core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_dn', 'no', 'no'],
+ ['core', 'shareapi_enabled', 'yes', 'yes'],
+ ['core', 'shareapi_default_expire_date', 'no', 'no'],
+ ['core', 'shareapi_expire_after_n_days', '7', '7'],
+ ['core', 'shareapi_enforce_expire_date', 'no', 'no'],
+ ['core', 'shareapi_exclude_groups', 'no', 'yes'],
+ ['core', 'shareapi_public_link_disclaimertext', '', 'Lorem ipsum'],
+ ['core', 'shareapi_enable_link_password_by_default', 'no', 'yes'],
+ ['core', 'shareapi_default_permissions', (string)Constants::PERMISSION_ALL, Constants::PERMISSION_ALL],
+ ['core', 'shareapi_default_internal_expire_date', 'no', 'no'],
+ ['core', 'shareapi_internal_expire_after_n_days', '7', '7'],
+ ['core', 'shareapi_enforce_internal_expire_date', 'no', 'no'],
+ ['core', 'shareapi_default_remote_expire_date', 'no', 'no'],
+ ['core', 'shareapi_remote_expire_after_n_days', '7', '7'],
+ ['core', 'shareapi_enforce_remote_expire_date', 'no', 'no'],
+ ['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
+ ['core', 'shareapi_only_share_with_group_members_exclude_group_list', '', '[]'],
+ ]);
+ $this->shareManager->method('shareWithGroupMembersOnly')
+ ->willReturn(false);
+ $this->appManager->method('isEnabledForUser')->with('files_sharing')->willReturn(true);
- $expected = new TemplateResponse(
- 'settings',
- 'settings/admin/sharing',
- [
- 'allowGroupSharing' => 'yes',
- 'allowLinks' => 'yes',
- 'allowPublicUpload' => 'yes',
- 'allowResharing' => 'yes',
- 'allowShareDialogUserEnumeration' => 'yes',
- 'restrictUserEnumerationToGroup' => 'no',
- 'enforceLinkPassword' => false,
+ $initialStateCalls = [];
+ $this->initialState
+ ->expects($this->exactly(3))
+ ->method('provideInitialState')
+ ->willReturnCallback(function (string $key) use (&$initialStateCalls): void {
+ $initialStateCalls[$key] = func_get_args();
+ });
+
+ $expectedInitialStateCalls = [
+ 'sharingAppEnabled' => true,
+ 'sharingDocumentation' => '',
+ 'sharingSettings' => [
+ 'allowGroupSharing' => true,
+ 'allowLinks' => true,
+ 'allowPublicUpload' => true,
+ 'allowResharing' => true,
+ 'allowShareDialogUserEnumeration' => true,
+ 'restrictUserEnumerationToGroup' => false,
+ 'restrictUserEnumerationToPhone' => false,
+ 'restrictUserEnumerationFullMatch' => true,
+ 'restrictUserEnumerationFullMatchUserId' => true,
+ 'restrictUserEnumerationFullMatchEmail' => true,
+ 'restrictUserEnumerationFullMatchIgnoreSecondDN' => false,
+ 'enforceLinksPassword' => false,
'onlyShareWithGroupMembers' => false,
- 'shareAPIEnabled' => 'yes',
- 'shareDefaultExpireDateSet' => 'no',
- 'shareExpireAfterNDays' => '7',
- 'shareEnforceExpireDate' => 'no',
- 'shareExcludeGroups' => true,
- 'shareExcludedGroupsList' => 'NoSharers|OtherNoSharers',
+ 'enabled' => true,
+ 'defaultExpireDate' => false,
+ 'expireAfterNDays' => '7',
+ 'enforceExpireDate' => false,
+ 'excludeGroups' => 'yes',
+ 'excludeGroupsList' => ['NoSharers','OtherNoSharers'],
'publicShareDisclaimerText' => 'Lorem ipsum',
- 'enableLinkPasswordByDefault' => 'yes',
- 'shareApiDefaultPermissions' => Constants::PERMISSION_ALL,
- 'shareApiDefaultPermissionsCheckboxes' => $this->invokePrivate($this->admin, 'getSharePermissionList', []),
- 'shareDefaultInternalExpireDateSet' => 'no',
- 'shareInternalExpireAfterNDays' => '7',
- 'shareInternalEnforceExpireDate' => 'no',
+ 'enableLinkPasswordByDefault' => true,
+ 'defaultPermissions' => Constants::PERMISSION_ALL,
+ 'defaultInternalExpireDate' => false,
+ 'internalExpireAfterNDays' => '7',
+ 'enforceInternalExpireDate' => false,
+ 'defaultRemoteExpireDate' => false,
+ 'remoteExpireAfterNDays' => '7',
+ 'enforceRemoteExpireDate' => false,
+ 'allowLinksExcludeGroups' => [],
+ 'onlyShareWithGroupMembersExcludeGroupList' => [],
+ 'enforceLinksPasswordExcludedGroups' => [],
+ 'enforceLinksPasswordExcludedGroupsEnabled' => false,
],
+ ];
+
+ $expected = new TemplateResponse(
+ 'settings',
+ 'settings/admin/sharing',
+ [],
''
);
$this->assertEquals($expected, $this->admin->getForm());
+ $this->assertEquals(sort($expectedInitialStateCalls), sort($initialStateCalls), 'Provided initial state does not match');
}
- public function testGetSection() {
+ public function testGetSection(): void {
$this->assertSame('sharing', $this->admin->getSection());
}
- public function testGetPriority() {
+ public function testGetPriority(): void {
$this->assertSame(0, $this->admin->getPriority());
}
}
diff --git a/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php b/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php
index f3d92051e46..0a0ff4d84af 100644
--- a/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php
+++ b/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php
@@ -3,58 +3,29 @@
declare(strict_types=1);
/**
- * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCA\Settings\Tests\Settings\Personal\Security;
-use OC\Authentication\Token\DefaultToken;
use OC\Authentication\Token\IProvider as IAuthTokenProvider;
+use OC\Authentication\Token\PublicKeyToken;
use OCA\Settings\Settings\Personal\Security\Authtokens;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
+use OCP\Authentication\Token\IToken;
use OCP\ISession;
use OCP\IUserSession;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class AuthtokensTest extends TestCase {
-
- /** @var IAuthTokenProvider|MockObject */
- private $authTokenProvider;
-
- /** @var ISession|MockObject */
- private $session;
-
- /** @var IUserSession|MockObject */
- private $userSession;
-
- /** @var IInitialState|MockObject */
- private $initialState;
-
- /** @var string */
- private $uid;
-
- /** @var Authtokens */
- private $section;
+ private IAuthTokenProvider&MockObject $authTokenProvider;
+ private ISession&MockObject $session;
+ private IUserSession&MockObject $userSession;
+ private IInitialState&MockObject $initialState;
+ private string $uid;
+ private Authtokens $section;
protected function setUp(): void {
parent::setUp();
@@ -74,16 +45,16 @@ class AuthtokensTest extends TestCase {
);
}
- public function testGetForm() {
- $token1 = new DefaultToken();
+ public function testGetForm(): void {
+ $token1 = new PublicKeyToken();
$token1->setId(100);
- $token2 = new DefaultToken();
+ $token2 = new PublicKeyToken();
$token2->setId(200);
$tokens = [
$token1,
$token2,
];
- $sessionToken = new DefaultToken();
+ $sessionToken = new PublicKeyToken();
$sessionToken->setId(100);
$this->authTokenProvider->expects($this->once())
@@ -97,33 +68,39 @@ class AuthtokensTest extends TestCase {
->method('getToken')
->with('session123')
->willReturn($sessionToken);
- $this->initialState->expects($this->at(0))
- ->method('provideInitialState')
- ->with('app_tokens', [
- [
- 'id' => 100,
- 'name' => null,
- 'lastActivity' => 0,
- 'type' => 0,
- 'canDelete' => false,
- 'current' => true,
- 'scope' => ['filesystem' => true],
- 'canRename' => false,
- ],
- [
- 'id' => 200,
- 'name' => null,
- 'lastActivity' => 0,
- 'type' => 0,
- 'canDelete' => true,
- 'scope' => ['filesystem' => true],
- 'canRename' => true,
- ],
- ]);
- $this->initialState->expects($this->at(1))
+ $calls = [
+ [
+ 'app_tokens', [
+ [
+ 'id' => 100,
+ 'name' => null,
+ 'lastActivity' => 0,
+ 'type' => 0,
+ 'canDelete' => false,
+ 'current' => true,
+ 'scope' => [IToken::SCOPE_FILESYSTEM => true],
+ 'canRename' => false,
+ ],
+ [
+ 'id' => 200,
+ 'name' => null,
+ 'lastActivity' => 0,
+ 'type' => 0,
+ 'canDelete' => true,
+ 'scope' => [IToken::SCOPE_FILESYSTEM => true],
+ 'canRename' => true,
+ ],
+ ]
+ ],
+ ['can_create_app_token', true],
+ ];
+ $this->initialState->expects($this->exactly(2))
->method('provideInitialState')
- ->with('can_create_app_token', true);
+ ->willReturnCallback(function () use (&$calls): void {
+ $expected = array_shift($calls);
+ $this->assertEquals($expected, func_get_args());
+ });
$form = $this->section->getForm();
diff --git a/apps/settings/tests/Settings/Personal/Security/PasswordTest.php b/apps/settings/tests/Settings/Personal/Security/PasswordTest.php
index db766747fe7..34a4b8e296f 100644
--- a/apps/settings/tests/Settings/Personal/Security/PasswordTest.php
+++ b/apps/settings/tests/Settings/Personal/Security/PasswordTest.php
@@ -3,28 +3,9 @@
declare(strict_types=1);
/**
- * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
-
namespace OCA\Settings\Tests\Settings\Personal\Security;
use OCA\Settings\Settings\Personal\Security\Password;
@@ -35,15 +16,9 @@ use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class PasswordTest extends TestCase {
-
- /** @var IUserManager|MockObject */
- private $userManager;
-
- /** @var string */
- private $uid;
-
- /** @var Password */
- private $section;
+ private IUserManager&MockObject $userManager;
+ private string $uid;
+ private Password $section;
protected function setUp(): void {
parent::setUp();
@@ -57,7 +32,7 @@ class PasswordTest extends TestCase {
);
}
- public function testGetForm() {
+ public function testGetForm(): void {
$user = $this->createMock(IUser::class);
$this->userManager->expects($this->once())
->method('get')