diff options
Diffstat (limited to 'apps/files_external/tests/Settings/AdminTest.php')
-rw-r--r-- | apps/files_external/tests/Settings/AdminTest.php | 65 |
1 files changed, 23 insertions, 42 deletions
diff --git a/apps/files_external/tests/Settings/AdminTest.php b/apps/files_external/tests/Settings/AdminTest.php index 6236f2d416a..fd4a1949760 100644 --- a/apps/files_external/tests/Settings/AdminTest.php +++ b/apps/files_external/tests/Settings/AdminTest.php @@ -1,49 +1,30 @@ <?php + +declare(strict_types=1); /** - * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch> - * - * @author Lukas Reschke <lukas@statuscode.ch> - * - * @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\Files_External\Tests\Settings; use OCA\Files_External\Lib\Auth\Password\GlobalAuth; +use OCA\Files_External\MountConfig; use OCA\Files_External\Service\BackendService; use OCA\Files_External\Service\GlobalStoragesService; use OCA\Files_External\Settings\Admin; use OCP\AppFramework\Http\TemplateResponse; use OCP\Encryption\IManager; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class AdminTest extends TestCase { - /** @var Admin */ - private $admin; - /** @var IManager|\PHPUnit_Framework_MockObject_MockObject */ - private $encryptionManager; - /** @var GlobalStoragesService|\PHPUnit_Framework_MockObject_MockObject */ - private $globalStoragesService; - /** @var BackendService|\PHPUnit_Framework_MockObject_MockObject */ - private $backendService; - /** @var GlobalAuth|\PHPUnit_Framework_MockObject_MockObject */ - private $globalAuth; + private IManager&MockObject $encryptionManager; + private GlobalStoragesService&MockObject $globalStoragesService; + private BackendService&MockObject $backendService; + private GlobalAuth&MockObject $globalAuth; + private Admin $admin; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->encryptionManager = $this->createMock(IManager::class); $this->globalStoragesService = $this->createMock(GlobalStoragesService::class); @@ -58,7 +39,7 @@ class AdminTest extends TestCase { ); } - public function testGetForm() { + public function testGetForm(): void { $this->encryptionManager ->expects($this->once()) ->method('isEnabled') @@ -89,25 +70,25 @@ class AdminTest extends TestCase { ->with('') ->willReturn('asdf:asdf'); $params = [ - 'encryptionEnabled' => false, - 'visibilityType' => BackendService::VISIBILITY_ADMIN, - 'storages' => ['a', 'b', 'c'], - 'backends' => ['d', 'e', 'f'], - 'authMechanisms' => ['g', 'h', 'i'], - 'dependencies' => \OC_Mount_Config::dependencyMessage($this->backendService->getBackends()), - 'allowUserMounting' => true, - 'globalCredentials' => 'asdf:asdf', + 'encryptionEnabled' => false, + 'visibilityType' => BackendService::VISIBILITY_ADMIN, + 'storages' => ['a', 'b', 'c'], + 'backends' => ['d', 'e', 'f'], + 'authMechanisms' => ['g', 'h', 'i'], + 'dependencies' => MountConfig::dependencyMessage($this->backendService->getBackends()), + 'allowUserMounting' => true, + 'globalCredentials' => 'asdf:asdf', 'globalCredentialsUid' => '', ]; $expected = new TemplateResponse('files_external', 'settings', $params, ''); $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('externalstorages', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(40, $this->admin->getPriority()); } } |