aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/tests/Controller/UserStoragesControllerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/tests/Controller/UserStoragesControllerTest.php')
-rw-r--r--apps/files_external/tests/Controller/UserStoragesControllerTest.php48
1 files changed, 15 insertions, 33 deletions
diff --git a/apps/files_external/tests/Controller/UserStoragesControllerTest.php b/apps/files_external/tests/Controller/UserStoragesControllerTest.php
index 793a90c527b..3e8d89ec060 100644
--- a/apps/files_external/tests/Controller/UserStoragesControllerTest.php
+++ b/apps/files_external/tests/Controller/UserStoragesControllerTest.php
@@ -1,35 +1,19 @@
<?php
+
+declare(strict_types=1);
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Joas Schilling <coding@schilljs.com>
- * @author Robin Appelman <robin@icewind.nl>
- * @author Robin McCorkell <robin@mccorkell.me.uk>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author Vincent Petry <vincent@nextcloud.com>
- *
- * @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\Controller;
use OC\User\User;
use OCA\Files_External\Controller\UserStoragesController;
+use OCA\Files_External\Lib\Storage\SMB;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\Service\BackendService;
+use OCA\Files_External\Service\UserStoragesService;
use OCP\AppFramework\Http;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
@@ -39,18 +23,16 @@ use OCP\IRequest;
use OCP\IUserSession;
use Psr\Log\LoggerInterface;
-class UserStoragesControllerTest extends StoragesControllerTest {
+class UserStoragesControllerTest extends StoragesControllerTestCase {
/**
* @var array
*/
- private $oldAllowedBackends;
+ private array $oldAllowedBackends;
protected function setUp(): void {
parent::setUp();
- $this->service = $this->getMockBuilder('\OCA\Files_External\Service\UserStoragesService')
- ->disableOriginalConstructor()
- ->getMock();
+ $this->service = $this->createMock(UserStoragesService::class);
$this->service->method('getVisibilityType')
->willReturn(BackendService::VISIBILITY_PERSONAL);
@@ -58,7 +40,7 @@ class UserStoragesControllerTest extends StoragesControllerTest {
$this->controller = $this->createController(true);
}
- private function createController($allowCreateLocal = true) {
+ private function createController(bool $allowCreateLocal = true) {
$session = $this->createMock(IUserSession::class);
$session->method('getUser')
->willReturn(new User('test', null, $this->createMock(IEventDispatcher::class)));
@@ -80,12 +62,12 @@ class UserStoragesControllerTest extends StoragesControllerTest {
);
}
- public function testAddLocalStorageWhenDisabled() {
+ public function testAddLocalStorageWhenDisabled(): void {
$this->controller = $this->createController(false);
parent::testAddLocalStorageWhenDisabled();
}
- public function testAddOrUpdateStorageDisallowedBackend() {
+ public function testAddOrUpdateStorageDisallowedBackend(): void {
$backend = $this->getBackendMock();
$backend->method('isVisibleFor')
->with(BackendService::VISIBILITY_PERSONAL)
@@ -108,7 +90,7 @@ class UserStoragesControllerTest extends StoragesControllerTest {
$response = $this->controller->create(
'mount',
- '\OCA\Files_External\Lib\Storage\SMB',
+ SMB::class,
'\Auth\Mechanism',
[],
[],
@@ -122,7 +104,7 @@ class UserStoragesControllerTest extends StoragesControllerTest {
$response = $this->controller->update(
1,
'mount',
- '\OCA\Files_External\Lib\Storage\SMB',
+ SMB::class,
'\Auth\Mechanism',
[],
[],