diff options
Diffstat (limited to 'apps/files_sharing/tests/LockingTest.php')
-rw-r--r-- | apps/files_sharing/tests/LockingTest.php | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/apps/files_sharing/tests/LockingTest.php b/apps/files_sharing/tests/LockingTest.php index 0ca204ef215..280c364a136 100644 --- a/apps/files_sharing/tests/LockingTest.php +++ b/apps/files_sharing/tests/LockingTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -8,7 +9,11 @@ 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; /** @@ -31,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_'); @@ -48,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); @@ -56,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); @@ -73,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); @@ -84,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); |