aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/tests/Auth/Password
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/tests/Auth/Password')
-rw-r--r--apps/files_external/tests/Auth/Password/GlobalAuthTest.php (renamed from apps/files_external/tests/Auth/Password/GlobalAuth.php)59
1 files changed, 17 insertions, 42 deletions
diff --git a/apps/files_external/tests/Auth/Password/GlobalAuth.php b/apps/files_external/tests/Auth/Password/GlobalAuthTest.php
index 867e3329cb8..6d83655403e 100644
--- a/apps/files_external/tests/Auth/Password/GlobalAuth.php
+++ b/apps/files_external/tests/Auth/Password/GlobalAuthTest.php
@@ -1,50 +1,25 @@
<?php
+
+declare(strict_types=1);
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <robin@icewind.nl>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCA\Files_External\Tests\Auth\Password;
use OCA\Files_External\Lib\Auth\Password\GlobalAuth;
-use OCA\Files_external\Lib\StorageConfig;
+use OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException;
+use OCA\Files_External\Lib\StorageConfig;
use OCP\IL10N;
use OCP\Security\ICredentialsManager;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class GlobalAuthTest extends TestCase {
- /**
- * @var \OCP\IL10N|\PHPUnit\Framework\MockObject\MockObject
- */
- private $l10n;
-
- /**
- * @var \OCP\Security\ICredentialsManager|\PHPUnit\Framework\MockObject\MockObject
- */
- private $credentialsManager;
-
- /**
- * @var GlobalAuth
- */
- private $instance;
+ private IL10N&MockObject $l10n;
+ private ICredentialsManager&MockObject $credentialsManager;
+ private GlobalAuth $instance;
protected function setUp(): void {
parent::setUp();
@@ -54,7 +29,7 @@ class GlobalAuthTest extends TestCase {
}
private function getStorageConfig($type, $config = []) {
- /** @var \OCA\Files_External\Lib\StorageConfig|\PHPUnit\Framework\MockObject\MockObject $storageConfig */
+ /** @var StorageConfig&MockObject $storageConfig */
$storageConfig = $this->createMock(StorageConfig::class);
$storageConfig->expects($this->any())
->method('getType')
@@ -71,14 +46,14 @@ class GlobalAuthTest extends TestCase {
});
$storageConfig->expects($this->any())
->method('setBackendOption')
- ->willReturnCallback(function ($key, $value) use (&$config) {
+ ->willReturnCallback(function ($key, $value) use (&$config): void {
$config[$key] = $value;
});
return $storageConfig;
}
- public function testNoCredentials() {
+ public function testNoCredentials(): void {
$this->credentialsManager->expects($this->once())
->method('retrieve')
->willReturn(null);
@@ -89,7 +64,7 @@ class GlobalAuthTest extends TestCase {
$this->assertEquals([], $storage->getBackendOptions());
}
- public function testSavedCredentials() {
+ public function testSavedCredentials(): void {
$this->credentialsManager->expects($this->once())
->method('retrieve')
->willReturn([
@@ -107,8 +82,8 @@ class GlobalAuthTest extends TestCase {
}
- public function testNoCredentialsPersonal() {
- $this->expectException(\OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException::class);
+ public function testNoCredentialsPersonal(): void {
+ $this->expectException(InsufficientDataForMeaningfulAnswerException::class);
$this->credentialsManager->expects($this->never())
->method('retrieve');