diff options
Diffstat (limited to 'apps/files_sharing/tests/LockingTest.php')
-rw-r--r-- | apps/files_sharing/tests/LockingTest.php | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/apps/files_sharing/tests/LockingTest.php b/apps/files_sharing/tests/LockingTest.php index 680220e5fa5..280c364a136 100644 --- a/apps/files_sharing/tests/LockingTest.php +++ b/apps/files_sharing/tests/LockingTest.php @@ -1,34 +1,19 @@ <?php + /** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Joas Schilling <coding@schilljs.com> - * @author Lukas Reschke <lukas@statuscode.ch> - * @author Robin Appelman <robin@icewind.nl> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * @author Thomas Müller <thomas.mueller@tmit.eu> - * - * @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: 2018-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only */ - namespace OCA\Files_Sharing\Tests; use OC\Files\Filesystem; use OC\Files\View; +use OCP\Constants; +use OCP\IUserManager; use OCP\Lock\ILockingProvider; +use OCP\Lock\LockedException; +use OCP\Server; use OCP\Share\IShare; /** @@ -51,7 +36,7 @@ class LockingTest extends TestCase { parent::setUp(); $this->userBackend = new \Test\Util\User\Dummy(); - \OC::$server->getUserManager()->registerBackend($this->userBackend); + Server::get(IUserManager::class)->registerBackend($this->userBackend); $this->ownerUid = $this->getUniqueID('owner_'); $this->recipientUid = $this->getUniqueID('recipient_'); @@ -68,7 +53,7 @@ class LockingTest extends TestCase { '/foo/bar.txt', $this->ownerUid, $this->recipientUid, - \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE + Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE | Constants::PERMISSION_SHARE ); $this->loginAsUser($this->recipientUid); @@ -76,13 +61,13 @@ class LockingTest extends TestCase { } protected function tearDown(): void { - \OC::$server->getUserManager()->removeBackend($this->userBackend); + Server::get(IUserManager::class)->removeBackend($this->userBackend); parent::tearDown(); } - public function testLockAsRecipient() { - $this->expectException(\OCP\Lock\LockedException::class); + public function testLockAsRecipient(): void { + $this->expectException(LockedException::class); $this->loginAsUser($this->ownerUid); @@ -93,7 +78,7 @@ class LockingTest extends TestCase { Filesystem::rename('/foo', '/asd'); } - public function testUnLockAsRecipient() { + public function testUnLockAsRecipient(): void { $this->loginAsUser($this->ownerUid); Filesystem::initMountPoints($this->recipientUid); @@ -104,7 +89,7 @@ class LockingTest extends TestCase { $this->assertTrue(Filesystem::rename('/foo', '/asd')); } - public function testChangeLock() { + public function testChangeLock(): void { Filesystem::initMountPoints($this->recipientUid); $recipientView = new View('/' . $this->recipientUid . '/files'); $recipientView->lockFile('bar.txt', ILockingProvider::LOCK_SHARED); |