aboutsummaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests/Controller/RecoveryControllerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/encryption/tests/Controller/RecoveryControllerTest.php')
-rw-r--r--apps/encryption/tests/Controller/RecoveryControllerTest.php29
1 files changed, 14 insertions, 15 deletions
diff --git a/apps/encryption/tests/Controller/RecoveryControllerTest.php b/apps/encryption/tests/Controller/RecoveryControllerTest.php
index 9de583b387c..7eff312d6ce 100644
--- a/apps/encryption/tests/Controller/RecoveryControllerTest.php
+++ b/apps/encryption/tests/Controller/RecoveryControllerTest.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -13,26 +15,23 @@ use OCP\AppFramework\Http;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IRequest;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class RecoveryControllerTest extends TestCase {
- /** @var RecoveryController */
- private $controller;
- /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
- private $requestMock;
- /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
- private $configMock;
- /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
- private $l10nMock;
- /** @var Recovery|\PHPUnit\Framework\MockObject\MockObject */
- private $recoveryMock;
-
- public function adminRecoveryProvider() {
+ protected RecoveryController $controller;
+
+ protected IRequest&MockObject $requestMock;
+ protected IConfig&MockObject $configMock;
+ protected IL10N&MockObject $l10nMock;
+ protected Recovery&MockObject $recoveryMock;
+
+ public static function adminRecoveryProvider(): array {
return [
['test', 'test', '1', 'Recovery key successfully enabled', Http::STATUS_OK],
['', 'test', '1', 'Missing recovery key password', Http::STATUS_BAD_REQUEST],
['test', '', '1', 'Please repeat the recovery key password', Http::STATUS_BAD_REQUEST],
- ['test', 'soimething that doesn\'t match', '1', 'Repeated recovery key password does not match the provided recovery key password', Http::STATUS_BAD_REQUEST],
+ ['test', 'something that doesn\'t match', '1', 'Repeated recovery key password does not match the provided recovery key password', Http::STATUS_BAD_REQUEST],
['test', 'test', '0', 'Recovery key successfully disabled', Http::STATUS_OK],
];
}
@@ -63,7 +62,7 @@ class RecoveryControllerTest extends TestCase {
$this->assertEquals($expectedStatus, $response->getStatus());
}
- public function changeRecoveryPasswordProvider() {
+ public static function changeRecoveryPasswordProvider(): array {
return [
['test', 'test', 'oldtestFail', 'Could not change the password. Maybe the old password was not correct.', Http::STATUS_BAD_REQUEST],
['test', 'test', 'oldtest', 'Password successfully changed.', Http::STATUS_OK],
@@ -98,7 +97,7 @@ class RecoveryControllerTest extends TestCase {
$this->assertEquals($expectedStatus, $response->getStatus());
}
- public function userSetRecoveryProvider() {
+ public static function userSetRecoveryProvider(): array {
return [
['1', 'Recovery Key enabled', Http::STATUS_OK],
['0', 'Could not enable the recovery key, please try again or contact your administrator', Http::STATUS_BAD_REQUEST]