diff options
Diffstat (limited to 'apps/files_sharing/tests/SharedMountTest.php')
-rw-r--r-- | apps/files_sharing/tests/SharedMountTest.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php index 241b708f07e..cc9c70a241f 100644 --- a/apps/files_sharing/tests/SharedMountTest.php +++ b/apps/files_sharing/tests/SharedMountTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -13,6 +14,7 @@ use OCA\Files_Sharing\MountProvider; use OCA\Files_Sharing\SharedMount; use OCP\Constants; use OCP\ICacheFactory; +use OCP\IDBConnection; use OCP\IGroupManager; use OCP\IUserManager; use OCP\Server; @@ -50,8 +52,8 @@ class SharedMountTest extends TestCase { $this->view->file_put_contents($this->folder . $this->filename, 'file in subfolder'); $this->view->file_put_contents($this->folder2 . $this->filename, 'file in subfolder2'); - $this->groupManager = \OC::$server->getGroupManager(); - $this->userManager = \OC::$server->getUserManager(); + $this->groupManager = Server::get(IGroupManager::class); + $this->userManager = Server::get(IUserManager::class); } protected function tearDown(): void { @@ -223,11 +225,11 @@ class SharedMountTest extends TestCase { } /** - * @dataProvider dataProviderTestStripUserFilesPath * @param string $path * @param string $expectedResult * @param bool $exception if a exception is expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderTestStripUserFilesPath')] public function testStripUserFilesPath($path, $expectedResult, $exception): void { $testClass = new DummyTestClassSharedMount(null, null); try { @@ -242,7 +244,7 @@ class SharedMountTest extends TestCase { } } - public function dataProviderTestStripUserFilesPath() { + public static function dataProviderTestStripUserFilesPath() { return [ ['/user/files/foo.txt', '/foo.txt', false], ['/user/files/folder/foo.txt', '/folder/foo.txt', false], @@ -266,7 +268,7 @@ class SharedMountTest extends TestCase { $testGroup->addUser($user2); $testGroup->addUser($user3); - $connection = \OC::$server->getDatabaseConnection(); + $connection = Server::get(IDBConnection::class); // Share item with group $fileinfo = $this->view->getFileInfo($this->folder); |