diff options
Diffstat (limited to 'apps/files_external/tests/Auth/AuthMechanismTest.php')
-rw-r--r-- | apps/files_external/tests/Auth/AuthMechanismTest.php | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/apps/files_external/tests/Auth/AuthMechanismTest.php b/apps/files_external/tests/Auth/AuthMechanismTest.php index 7e1d2a84ae4..e999cecf181 100644 --- a/apps/files_external/tests/Auth/AuthMechanismTest.php +++ b/apps/files_external/tests/Auth/AuthMechanismTest.php @@ -1,24 +1,10 @@ <?php + +declare(strict_types=1); /** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin McCorkell <robin@mccorkell.me.uk> - * - * @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: 2020-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only */ namespace OCA\Files_External\Tests\Auth; @@ -27,9 +13,9 @@ use OCA\Files_External\Lib\Backend\Backend; use OCA\Files_External\Lib\StorageConfig; class AuthMechanismTest extends \Test\TestCase { - public function testJsonSerialization() { + public function testJsonSerialization(): void { $mechanism = $this->getMockBuilder(AuthMechanism::class) - ->setMethods(['jsonSerializeDefinition']) + ->onlyMethods(['jsonSerializeDefinition']) ->getMock(); $mechanism->expects($this->once()) ->method('jsonSerializeDefinition') @@ -42,7 +28,7 @@ class AuthMechanismTest extends \Test\TestCase { $this->assertEquals('scheme', $json['scheme']); } - public function validateStorageProvider() { + public static function validateStorageProvider(): array { return [ [true, 'scheme', true], [false, 'scheme', false], @@ -51,12 +37,10 @@ class AuthMechanismTest extends \Test\TestCase { ]; } - /** - * @dataProvider validateStorageProvider - */ - public function testValidateStorage($expectedSuccess, $scheme, $definitionSuccess) { + #[\PHPUnit\Framework\Attributes\DataProvider('validateStorageProvider')] + public function testValidateStorage(bool $expectedSuccess, string $scheme, bool $definitionSuccess): void { $mechanism = $this->getMockBuilder(AuthMechanism::class) - ->setMethods(['validateStorageDefinition']) + ->onlyMethods(['validateStorageDefinition']) ->getMock(); $mechanism->expects($this->atMost(1)) ->method('validateStorageDefinition') @@ -64,16 +48,12 @@ class AuthMechanismTest extends \Test\TestCase { $mechanism->setScheme($scheme); - $backend = $this->getMockBuilder(Backend::class) - ->disableOriginalConstructor() - ->getMock(); + $backend = $this->createMock(Backend::class); $backend->expects($this->once()) ->method('getAuthSchemes') ->willReturn(['scheme' => true, 'foobar' => true]); - $storageConfig = $this->getMockBuilder(StorageConfig::class) - ->disableOriginalConstructor() - ->getMock(); + $storageConfig = $this->createMock(StorageConfig::class); $storageConfig->expects($this->once()) ->method('getBackend') ->willReturn($backend); |