diff options
Diffstat (limited to 'apps/files_external/tests/Backend/LegacyBackendTest.php')
-rw-r--r-- | apps/files_external/tests/Backend/LegacyBackendTest.php | 48 |
1 files changed, 13 insertions, 35 deletions
diff --git a/apps/files_external/tests/Backend/LegacyBackendTest.php b/apps/files_external/tests/Backend/LegacyBackendTest.php index 2a69ab9e355..c4ddfedf6e2 100644 --- a/apps/files_external/tests/Backend/LegacyBackendTest.php +++ b/apps/files_external/tests/Backend/LegacyBackendTest.php @@ -1,27 +1,13 @@ <?php + /** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Robin McCorkell <robin@mccorkell.me.uk> - * @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: 2019-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only */ namespace OCA\Files_External\Tests\Backend; +use OCA\Files_External\Lib\Auth\Builtin; use OCA\Files_External\Lib\Backend\LegacyBackend; use OCA\Files_External\Lib\DefinitionParameter; use OCA\Files_External\Lib\MissingDependency; @@ -31,24 +17,21 @@ class LegacyBackendTest extends \Test\TestCase { /** * @return MissingDependency[] */ - public static function checkDependencies() { + public static function checkDependencies(): array { return [ (new MissingDependency('abc'))->setMessage('foobar') ]; } - public function testConstructor() { - $auth = $this->getMockBuilder('\OCA\Files_External\Lib\Auth\Builtin') - ->disableOriginalConstructor() - ->getMock(); + public function testConstructor(): void { + $auth = $this->createMock(Builtin::class); - $class = '\OCA\Files_External\Tests\Backend\LegacyBackendTest'; + $class = self::class; $definition = [ 'configuration' => [ 'textfield' => 'Text field', 'passwordfield' => '*Password field', 'checkbox' => '!Checkbox', - 'hiddenfield' => '#Hidden field', 'optionaltext' => '&Optional text field', 'optionalpassword' => '&*Optional password field', ], @@ -60,7 +43,7 @@ class LegacyBackendTest extends \Test\TestCase { $backend = new LegacyBackend($class, $definition, $auth); - $this->assertEquals('\OCA\Files_External\Tests\Backend\LegacyBackendTest', $backend->getStorageClass()); + $this->assertEquals(self::class, $backend->getStorageClass()); $this->assertEquals('Backend text', $backend->getText()); $this->assertEquals(123, $backend->getPriority()); $this->assertContains('foo/bar.js', $backend->getCustomJs()); @@ -82,9 +65,6 @@ class LegacyBackendTest extends \Test\TestCase { $this->assertEquals('Checkbox', $parameters['checkbox']->getText()); $this->assertEquals(DefinitionParameter::VALUE_BOOLEAN, $parameters['checkbox']->getType()); $this->assertEquals(DefinitionParameter::FLAG_NONE, $parameters['checkbox']->getFlags()); - $this->assertEquals('Hidden field', $parameters['hiddenfield']->getText()); - $this->assertEquals(DefinitionParameter::VALUE_HIDDEN, $parameters['hiddenfield']->getType()); - $this->assertEquals(DefinitionParameter::FLAG_NONE, $parameters['hiddenfield']->getFlags()); $this->assertEquals('Optional text field', $parameters['optionaltext']->getText()); $this->assertEquals(DefinitionParameter::VALUE_TEXT, $parameters['optionaltext']->getType()); $this->assertEquals(DefinitionParameter::FLAG_OPTIONAL, $parameters['optionaltext']->getFlags()); @@ -93,12 +73,10 @@ class LegacyBackendTest extends \Test\TestCase { $this->assertEquals(DefinitionParameter::FLAG_OPTIONAL, $parameters['optionalpassword']->getFlags()); } - public function testNoDependencies() { - $auth = $this->getMockBuilder('\OCA\Files_External\Lib\Auth\Builtin') - ->disableOriginalConstructor() - ->getMock(); + public function testNoDependencies(): void { + $auth = $this->createMock(Builtin::class); - $class = '\OCA\Files_External\Tests\Backend\LegacyBackendTest'; + $class = self::class; $definition = [ 'configuration' => [ ], |