diff options
Diffstat (limited to 'apps/files_sharing/tests')
39 files changed, 312 insertions, 311 deletions
diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index a712903d768..bb686c1ea8c 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -240,11 +241,11 @@ class ApiTest extends TestCase { $data = $result->getData(); $this->assertEquals( - Constants::PERMISSION_READ | - Constants::PERMISSION_CREATE | - Constants::PERMISSION_UPDATE | - Constants::PERMISSION_DELETE | - Constants::PERMISSION_SHARE, + Constants::PERMISSION_READ + | Constants::PERMISSION_CREATE + | Constants::PERMISSION_UPDATE + | Constants::PERMISSION_DELETE + | Constants::PERMISSION_SHARE, $data['permissions'] ); $this->assertEmpty($data['expiration']); @@ -1021,11 +1022,11 @@ class ApiTest extends TestCase { $share1 = $this->shareManager->getShareById($share1->getFullId()); $this->assertEquals( - Constants::PERMISSION_READ | - Constants::PERMISSION_CREATE | - Constants::PERMISSION_UPDATE | - Constants::PERMISSION_DELETE | - Constants::PERMISSION_SHARE, + Constants::PERMISSION_READ + | Constants::PERMISSION_CREATE + | Constants::PERMISSION_UPDATE + | Constants::PERMISSION_DELETE + | Constants::PERMISSION_SHARE, $share1->getPermissions() ); @@ -1280,7 +1281,7 @@ class ApiTest extends TestCase { \OC_Hook::clear('\OCA\Files_Sharing\Tests\ApiTest', 'initTestMountPointsHook'); } - public function datesProvider() { + public static function datesProvider() { $date = new \DateTime(); $date->setTime(0, 0); $date->add(new \DateInterval('P5D')); @@ -1296,9 +1297,9 @@ class ApiTest extends TestCase { /** * Make sure only ISO 8601 dates are accepted * - * @dataProvider datesProvider * @group RoutingWeirdness */ + #[\PHPUnit\Framework\Attributes\DataProvider('datesProvider')] public function testPublicLinkExpireDate($date, $valid): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); diff --git a/apps/files_sharing/tests/ApplicationTest.php b/apps/files_sharing/tests/ApplicationTest.php index b1a635406b2..84a3f4b372b 100644 --- a/apps/files_sharing/tests/ApplicationTest.php +++ b/apps/files_sharing/tests/ApplicationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -86,9 +87,7 @@ class ApplicationTest extends TestCase { return $result; } - /** - * @dataProvider providesDataForCanGet - */ + #[\PHPUnit\Framework\Attributes\DataProvider('providesDataForCanGet')] public function testCheckDirectCanBeDownloaded(string $path, Folder $userFolder, bool $run): void { $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('test'); @@ -167,9 +166,7 @@ class ApplicationTest extends TestCase { return $return; } - /** - * @dataProvider providesDataForCanZip - */ + #[\PHPUnit\Framework\Attributes\DataProvider('providesDataForCanZip')] public function testCheckZipCanBeDownloaded(string $dir, array $files, Folder $userFolder, bool $run): void { $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('test'); diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php index 53e9efd5d9e..e95d3d4f91a 100644 --- a/apps/files_sharing/tests/CacheTest.php +++ b/apps/files_sharing/tests/CacheTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/CapabilitiesTest.php b/apps/files_sharing/tests/CapabilitiesTest.php index 737362e2195..2600bd9d925 100644 --- a/apps/files_sharing/tests/CapabilitiesTest.php +++ b/apps/files_sharing/tests/CapabilitiesTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php b/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php index 2bef0b0e922..572463a9ebc 100644 --- a/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php +++ b/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -35,9 +36,9 @@ class ShareRecipientSorterTest extends TestCase { } /** - * @dataProvider sortDataProvider * @param $data */ + #[\PHPUnit\Framework\Attributes\DataProvider('sortDataProvider')] public function testSort($data): void { $node = $this->createMock(Node::class); @@ -114,39 +115,37 @@ class ShareRecipientSorterTest extends TestCase { $this->assertEquals($originalArray, $workArray); } - public function sortDataProvider() { + public static function sortDataProvider() { return [[ [ #0 – sort properly and otherwise keep existing order 'context' => ['itemType' => 'files', 'itemId' => '42'], 'accessList' => ['users' => ['celia', 'darius', 'faruk', 'gail'], 'bots' => ['r2-d2']], 'input' => [ - 'users' => - [ - ['value' => ['shareWith' => 'alice']], - ['value' => ['shareWith' => 'bob']], - ['value' => ['shareWith' => 'celia']], - ['value' => ['shareWith' => 'darius']], - ['value' => ['shareWith' => 'elena']], - ['value' => ['shareWith' => 'faruk']], - ['value' => ['shareWith' => 'gail']], - ], + 'users' => [ + ['value' => ['shareWith' => 'alice']], + ['value' => ['shareWith' => 'bob']], + ['value' => ['shareWith' => 'celia']], + ['value' => ['shareWith' => 'darius']], + ['value' => ['shareWith' => 'elena']], + ['value' => ['shareWith' => 'faruk']], + ['value' => ['shareWith' => 'gail']], + ], 'bots' => [ ['value' => ['shareWith' => 'c-3po']], ['value' => ['shareWith' => 'r2-d2']], ] ], 'expected' => [ - 'users' => - [ - ['value' => ['shareWith' => 'celia']], - ['value' => ['shareWith' => 'darius']], - ['value' => ['shareWith' => 'faruk']], - ['value' => ['shareWith' => 'gail']], - ['value' => ['shareWith' => 'alice']], - ['value' => ['shareWith' => 'bob']], - ['value' => ['shareWith' => 'elena']], - ], + 'users' => [ + ['value' => ['shareWith' => 'celia']], + ['value' => ['shareWith' => 'darius']], + ['value' => ['shareWith' => 'faruk']], + ['value' => ['shareWith' => 'gail']], + ['value' => ['shareWith' => 'alice']], + ['value' => ['shareWith' => 'bob']], + ['value' => ['shareWith' => 'elena']], + ], 'bots' => [ ['value' => ['shareWith' => 'r2-d2']], ['value' => ['shareWith' => 'c-3po']], @@ -158,32 +157,30 @@ class ShareRecipientSorterTest extends TestCase { 'context' => ['itemType' => 'files', 'itemId' => '42'], 'accessList' => ['users' => false], 'input' => [ - 'users' => - [ - ['value' => ['shareWith' => 'alice']], - ['value' => ['shareWith' => 'bob']], - ['value' => ['shareWith' => 'celia']], - ['value' => ['shareWith' => 'darius']], - ['value' => ['shareWith' => 'elena']], - ['value' => ['shareWith' => 'faruk']], - ['value' => ['shareWith' => 'gail']], - ], + 'users' => [ + ['value' => ['shareWith' => 'alice']], + ['value' => ['shareWith' => 'bob']], + ['value' => ['shareWith' => 'celia']], + ['value' => ['shareWith' => 'darius']], + ['value' => ['shareWith' => 'elena']], + ['value' => ['shareWith' => 'faruk']], + ['value' => ['shareWith' => 'gail']], + ], 'bots' => [ ['value' => ['shareWith' => 'c-3po']], ['value' => ['shareWith' => 'r2-d2']], ] ], 'expected' => [ - 'users' => - [ - ['value' => ['shareWith' => 'alice']], - ['value' => ['shareWith' => 'bob']], - ['value' => ['shareWith' => 'celia']], - ['value' => ['shareWith' => 'darius']], - ['value' => ['shareWith' => 'elena']], - ['value' => ['shareWith' => 'faruk']], - ['value' => ['shareWith' => 'gail']], - ], + 'users' => [ + ['value' => ['shareWith' => 'alice']], + ['value' => ['shareWith' => 'bob']], + ['value' => ['shareWith' => 'celia']], + ['value' => ['shareWith' => 'darius']], + ['value' => ['shareWith' => 'elena']], + ['value' => ['shareWith' => 'faruk']], + ['value' => ['shareWith' => 'gail']], + ], 'bots' => [ ['value' => ['shareWith' => 'c-3po']], ['value' => ['shareWith' => 'r2-d2']], @@ -195,32 +192,30 @@ class ShareRecipientSorterTest extends TestCase { 'context' => ['itemType' => 'announcements', 'itemId' => '42'], 'accessList' => null, // not needed 'input' => [ - 'users' => - [ - ['value' => ['shareWith' => 'alice']], - ['value' => ['shareWith' => 'bob']], - ['value' => ['shareWith' => 'celia']], - ['value' => ['shareWith' => 'darius']], - ['value' => ['shareWith' => 'elena']], - ['value' => ['shareWith' => 'faruk']], - ['value' => ['shareWith' => 'gail']], - ], + 'users' => [ + ['value' => ['shareWith' => 'alice']], + ['value' => ['shareWith' => 'bob']], + ['value' => ['shareWith' => 'celia']], + ['value' => ['shareWith' => 'darius']], + ['value' => ['shareWith' => 'elena']], + ['value' => ['shareWith' => 'faruk']], + ['value' => ['shareWith' => 'gail']], + ], 'bots' => [ ['value' => ['shareWith' => 'c-3po']], ['value' => ['shareWith' => 'r2-d2']], ] ], 'expected' => [ - 'users' => - [ - ['value' => ['shareWith' => 'alice']], - ['value' => ['shareWith' => 'bob']], - ['value' => ['shareWith' => 'celia']], - ['value' => ['shareWith' => 'darius']], - ['value' => ['shareWith' => 'elena']], - ['value' => ['shareWith' => 'faruk']], - ['value' => ['shareWith' => 'gail']], - ], + 'users' => [ + ['value' => ['shareWith' => 'alice']], + ['value' => ['shareWith' => 'bob']], + ['value' => ['shareWith' => 'celia']], + ['value' => ['shareWith' => 'darius']], + ['value' => ['shareWith' => 'elena']], + ['value' => ['shareWith' => 'faruk']], + ['value' => ['shareWith' => 'gail']], + ], 'bots' => [ ['value' => ['shareWith' => 'c-3po']], ['value' => ['shareWith' => 'r2-d2']], diff --git a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php index 769516cda85..6f0960bf46c 100644 --- a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php +++ b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud GmbH. @@ -168,14 +169,14 @@ class CleanupRemoteStoragesTest extends TestCase { $output ->expects($this->any()) ->method('writeln') - ->willReturnCallback(function (string $text) use (&$outputCalls) { + ->willReturnCallback(function (string $text) use (&$outputCalls): void { $outputCalls[] = $text; }); $this->cloudIdManager ->expects($this->any()) ->method('getCloudId') - ->will($this->returnCallback(function (string $user, string $remote) { + ->willReturnCallback(function (string $user, string $remote) { $cloudIdMock = $this->createMock(ICloudId::class); // The remotes are already sanitized in the original data, so @@ -186,7 +187,7 @@ class CleanupRemoteStoragesTest extends TestCase { ->willReturn($remote); return $cloudIdMock; - })); + }); $this->command->execute($input, $output); diff --git a/apps/files_sharing/tests/Command/FixShareOwnersTest.php b/apps/files_sharing/tests/Command/FixShareOwnersTest.php index 939fad03d7c..0fde61895b1 100644 --- a/apps/files_sharing/tests/Command/FixShareOwnersTest.php +++ b/apps/files_sharing/tests/Command/FixShareOwnersTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only diff --git a/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php b/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php index 5e8e32c06d8..7e054d9a6dc 100644 --- a/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php b/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php index 41789cdd138..f49d839e8d4 100644 --- a/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php +++ b/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -20,7 +21,6 @@ use OCP\IRequest; use OCP\ISession; use OCP\Preview\IMimeIconProvider; use OCP\Share\Exceptions\ShareNotFound; -use OCP\Share\IAttributes; use OCP\Share\IManager; use OCP\Share\IShare; use PHPUnit\Framework\MockObject\MockObject; @@ -114,12 +114,8 @@ class PublicPreviewControllerTest extends TestCase { $share->method('getPermissions') ->willReturn(Constants::PERMISSION_READ); - $attributes = $this->createMock(IAttributes::class); - $attributes->method('getAttribute') - ->with('permissions', 'download') + $share->method('canSeeContent') ->willReturn(false); - $share->method('getAttributes') - ->willReturn($attributes); $res = $this->controller->getPreview('token', 'file', 10, 10); $expected = new DataResponse([], Http::STATUS_FORBIDDEN); @@ -136,12 +132,8 @@ class PublicPreviewControllerTest extends TestCase { $share->method('getPermissions') ->willReturn(Constants::PERMISSION_READ); - $attributes = $this->createMock(IAttributes::class); - $attributes->method('getAttribute') - ->with('permissions', 'download') + $share->method('canSeeContent') ->willReturn(false); - $share->method('getAttributes') - ->willReturn($attributes); $this->request->method('getHeader') ->with('x-nc-preview') @@ -176,12 +168,8 @@ class PublicPreviewControllerTest extends TestCase { $share->method('getPermissions') ->willReturn(Constants::PERMISSION_READ); - $attributes = $this->createMock(IAttributes::class); - $attributes->method('getAttribute') - ->with('permissions', 'download') + $share->method('canSeeContent') ->willReturn(true); - $share->method('getAttributes') - ->willReturn($attributes); $this->request->method('getHeader') ->with('x-nc-preview') @@ -220,6 +208,9 @@ class PublicPreviewControllerTest extends TestCase { $share->method('getNode') ->willReturn($file); + $share->method('canSeeContent') + ->willReturn(true); + $preview = $this->createMock(ISimpleFile::class); $preview->method('getName')->willReturn('name'); $preview->method('getMTime')->willReturn(42); @@ -249,6 +240,9 @@ class PublicPreviewControllerTest extends TestCase { $share->method('getNode') ->willReturn($folder); + $share->method('canSeeContent') + ->willReturn(true); + $folder->method('get') ->with($this->equalTo('file')) ->willThrowException(new NotFoundException()); @@ -272,6 +266,9 @@ class PublicPreviewControllerTest extends TestCase { $share->method('getNode') ->willReturn($folder); + $share->method('canSeeContent') + ->willReturn(true); + $file = $this->createMock(File::class); $folder->method('get') ->with($this->equalTo('file')) diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index f245f0a25c7..8bb220d684b 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -271,7 +272,7 @@ class ShareAPIControllerTest extends TestCase { $node->expects($this->once()) ->method('lock') ->with(ILockingProvider::LOCK_SHARED) - ->will($this->throwException(new LockedException('mypath'))); + ->willThrowException(new LockedException('mypath')); $this->assertFalse($this->invokePrivate($this->ocs, 'canDeleteFromSelf', [$share])); $this->assertFalse($this->invokePrivate($this->ocs, 'canDeleteShare', [$share])); @@ -592,9 +593,9 @@ class ShareAPIControllerTest extends TestCase { $share->method('getToken')->willReturn($token); $share->method('getPassword')->willReturn($password); - if ($shareType === IShare::TYPE_USER || - $shareType === IShare::TYPE_GROUP || - $shareType === IShare::TYPE_LINK) { + if ($shareType === IShare::TYPE_USER + || $shareType === IShare::TYPE_GROUP + || $shareType === IShare::TYPE_LINK) { $share->method('getFullId')->willReturn('ocinternal:' . $id); } @@ -823,9 +824,7 @@ class ShareAPIControllerTest extends TestCase { return $data; } - /** - * @dataProvider dataGetShare - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataGetShare')] public function testGetShare(IShare $share, array $result): void { /** @var ShareAPIController&MockObject $ocs */ $ocs = $this->getMockBuilder(ShareAPIController::class) @@ -1456,9 +1455,7 @@ class ShareAPIControllerTest extends TestCase { return $data; } - /** - * @dataProvider dataGetShares - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataGetShares')] public function testGetShares(array $getSharesParameters, array $shares, array $extraShareTypes, array $expected): void { /** @var ShareAPIController&MockObject $ocs */ $ocs = $this->getMockBuilder(ShareAPIController::class) @@ -1574,9 +1571,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertFalse($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); } - /** - * @dataProvider dataCanAccessShareWithPermissions - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataCanAccessShareWithPermissions')] public function testCanAccessShareWithPermissions(int $permissions, bool $expected): void { $share = $this->createMock(IShare::class); $share->method('getShareType')->willReturn(IShare::TYPE_USER); @@ -1614,9 +1609,7 @@ class ShareAPIControllerTest extends TestCase { ]; } - /** - * @dataProvider dataCanAccessShareAsGroupMember - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataCanAccessShareAsGroupMember')] public function testCanAccessShareAsGroupMember(string $group, bool $expected): void { $share = $this->createMock(IShare::class); $share->method('getShareType')->willReturn(IShare::TYPE_GROUP); @@ -1694,13 +1687,13 @@ class ShareAPIControllerTest extends TestCase { } /** - * @dataProvider dataCanAccessRoomShare * * @param bool $expects * @param IShare $share * @param bool helperAvailable * @param bool canAccessShareByHelper */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataCanAccessRoomShare')] public function testCanAccessRoomShare(bool $expected, IShare $share, bool $helperAvailable, bool $canAccessShareByHelper): void { $userFolder = $this->getMockBuilder(Folder::class)->getMock(); $this->rootFolder->method('getUserFolder') @@ -1760,7 +1753,7 @@ class ShareAPIControllerTest extends TestCase { $userFolder->expects($this->once()) ->method('get') ->with('invalid-path') - ->will($this->throwException(new NotFoundException())); + ->willThrowException(new NotFoundException()); $this->ocs->createShare('invalid-path'); } @@ -1897,15 +1890,15 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->method('createShare') ->with($this->callback(function (IShare $share) use ($path) { - return $share->getNode() === $path && - $share->getPermissions() === ( - Constants::PERMISSION_ALL & - ~Constants::PERMISSION_DELETE & - ~Constants::PERMISSION_CREATE - ) && - $share->getShareType() === IShare::TYPE_USER && - $share->getSharedWith() === 'validUser' && - $share->getSharedBy() === 'currentUser'; + return $share->getNode() === $path + && $share->getPermissions() === ( + Constants::PERMISSION_ALL + & ~Constants::PERMISSION_DELETE + & ~Constants::PERMISSION_CREATE + ) + && $share->getShareType() === IShare::TYPE_USER + && $share->getSharedWith() === 'validUser' + && $share->getSharedBy() === 'currentUser'; })) ->willReturnArgument(0); @@ -2008,11 +2001,11 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->method('createShare') ->with($this->callback(function (IShare $share) use ($path) { - return $share->getNode() === $path && - $share->getPermissions() === Constants::PERMISSION_ALL && - $share->getShareType() === IShare::TYPE_GROUP && - $share->getSharedWith() === 'validGroup' && - $share->getSharedBy() === 'currentUser'; + return $share->getNode() === $path + && $share->getPermissions() === Constants::PERMISSION_ALL + && $share->getShareType() === IShare::TYPE_GROUP + && $share->getSharedWith() === 'validGroup' + && $share->getSharedBy() === 'currentUser'; })) ->willReturnArgument(0); @@ -2125,7 +2118,7 @@ class ShareAPIControllerTest extends TestCase { $file = $this->createMock(File::class); $file->method('getId')->willReturn(42); $file->method('getStorage')->willReturn($storage); - + $this->rootFolder->method('getUserFolder')->with($this->currentUser)->willReturnSelf(); $this->rootFolder->method('get')->with('valid-path')->willReturn($file); $this->rootFolder->method('getById') @@ -2161,12 +2154,12 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->once())->method('createShare')->with( $this->callback(function (IShare $share) use ($path) { - return $share->getNode() === $path && - $share->getShareType() === IShare::TYPE_LINK && - $share->getPermissions() === (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE) && - $share->getSharedBy() === 'currentUser' && - $share->getPassword() === null && - $share->getExpirationDate() === null; + return $share->getNode() === $path + && $share->getShareType() === IShare::TYPE_LINK + && $share->getPermissions() === (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE) + && $share->getSharedBy() === 'currentUser' + && $share->getPassword() === null + && $share->getExpirationDate() === null; }) )->willReturnArgument(0); @@ -2241,13 +2234,13 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->once())->method('createShare')->with( $this->callback(function (IShare $share) use ($path) { - return $share->getNode() === $path && - $share->getShareType() === IShare::TYPE_LINK && - $share->getPermissions() === (Constants::PERMISSION_ALL & ~(Constants::PERMISSION_SHARE)) && - $share->getSharedBy() === 'currentUser' && - $share->getPassword() === 'password' && - $share->getSendPasswordByTalk() === true && - $share->getExpirationDate() === null; + return $share->getNode() === $path + && $share->getShareType() === IShare::TYPE_LINK + && $share->getPermissions() === (Constants::PERMISSION_ALL & ~(Constants::PERMISSION_SHARE)) + && $share->getSharedBy() === 'currentUser' + && $share->getPassword() === 'password' + && $share->getSendPasswordByTalk() === true + && $share->getExpirationDate() === null; }) )->willReturnArgument(0); @@ -2327,12 +2320,12 @@ class ShareAPIControllerTest extends TestCase { $date = new \DateTime('2000-01-01'); $date->setTime(0, 0, 0); - return $share->getNode() === $path && - $share->getShareType() === IShare::TYPE_LINK && - $share->getPermissions() === Constants::PERMISSION_READ | Constants::PERMISSION_SHARE && - $share->getSharedBy() === 'currentUser' && - $share->getPassword() === null && - $share->getExpirationDate() == $date; + return $share->getNode() === $path + && $share->getShareType() === IShare::TYPE_LINK + && $share->getPermissions() === Constants::PERMISSION_READ | Constants::PERMISSION_SHARE + && $share->getSharedBy() === 'currentUser' + && $share->getPassword() === null + && $share->getExpirationDate() == $date; }) )->willReturnArgument(0); @@ -2421,15 +2414,15 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->method('createShare') ->with($this->callback(function (IShare $share) use ($path) { - return $share->getNode() === $path && - $share->getPermissions() === ( - Constants::PERMISSION_ALL & - ~Constants::PERMISSION_DELETE & - ~Constants::PERMISSION_CREATE - ) && - $share->getShareType() === IShare::TYPE_REMOTE && - $share->getSharedWith() === 'user@example.org' && - $share->getSharedBy() === 'currentUser'; + return $share->getNode() === $path + && $share->getPermissions() === ( + Constants::PERMISSION_ALL + & ~Constants::PERMISSION_DELETE + & ~Constants::PERMISSION_CREATE + ) + && $share->getShareType() === IShare::TYPE_REMOTE + && $share->getSharedWith() === 'user@example.org' + && $share->getSharedBy() === 'currentUser'; })) ->willReturnArgument(0); @@ -2492,15 +2485,15 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->method('createShare') ->with($this->callback(function (IShare $share) use ($path) { - return $share->getNode() === $path && - $share->getPermissions() === ( - Constants::PERMISSION_ALL & - ~Constants::PERMISSION_DELETE & - ~Constants::PERMISSION_CREATE - ) && - $share->getShareType() === IShare::TYPE_REMOTE_GROUP && - $share->getSharedWith() === 'group@example.org' && - $share->getSharedBy() === 'currentUser'; + return $share->getNode() === $path + && $share->getPermissions() === ( + Constants::PERMISSION_ALL + & ~Constants::PERMISSION_DELETE + & ~Constants::PERMISSION_CREATE + ) + && $share->getShareType() === IShare::TYPE_REMOTE_GROUP + && $share->getSharedWith() === 'group@example.org' + && $share->getSharedBy() === 'currentUser'; })) ->willReturnArgument(0); @@ -2550,9 +2543,9 @@ class ShareAPIControllerTest extends TestCase { ->with( $share, 'recipientRoom', - Constants::PERMISSION_ALL & - ~Constants::PERMISSION_DELETE & - ~Constants::PERMISSION_CREATE, + Constants::PERMISSION_ALL + & ~Constants::PERMISSION_DELETE + & ~Constants::PERMISSION_CREATE, '' )->willReturnCallback( function ($share): void { @@ -2842,14 +2835,14 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->once())->method('updateShare')->with( $this->callback(function (IShare $share) { - return $share->getPermissions() === Constants::PERMISSION_READ && - $share->getPassword() === null && - $share->getExpirationDate() === null && + return $share->getPermissions() === Constants::PERMISSION_READ + && $share->getPassword() === null + && $share->getExpirationDate() === null // Once set a note or a label are never back to null, only to an // empty string. - $share->getNote() === '' && - $share->getLabel() === '' && - $share->getHideDownload() === false; + && $share->getNote() === '' + && $share->getLabel() === '' + && $share->getHideDownload() === false; }) )->willReturnArgument(0); @@ -2901,12 +2894,12 @@ class ShareAPIControllerTest extends TestCase { $date = new \DateTime('2000-01-01'); $date->setTime(0, 0, 0); - return $share->getPermissions() === (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE) && - $share->getPassword() === 'password' && - $share->getExpirationDate() == $date && - $share->getNote() === 'note' && - $share->getLabel() === 'label' && - $share->getHideDownload() === true; + return $share->getPermissions() === (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE) + && $share->getPassword() === 'password' + && $share->getExpirationDate() == $date + && $share->getNote() === 'note' + && $share->getLabel() === 'label' + && $share->getHideDownload() === true; }) )->willReturnArgument(0); @@ -2934,9 +2927,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - /** - * @dataProvider publicUploadParamsProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('publicUploadParamsProvider')] public function testUpdateLinkShareEnablePublicUpload($permissions, $publicUpload, $expireDate, $password): void { $ocs = $this->mockFormatShare(); @@ -2957,9 +2948,9 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->once())->method('updateShare')->with( $this->callback(function (IShare $share) { - return $share->getPermissions() === (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE) && - $share->getPassword() === 'password' && - $share->getExpirationDate() === null; + return $share->getPermissions() === (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE) + && $share->getPassword() === 'password' + && $share->getExpirationDate() === null; }) )->willReturnArgument(0); @@ -2985,7 +2976,7 @@ class ShareAPIControllerTest extends TestCase { } - public function publicLinkValidPermissionsProvider() { + public static function publicLinkValidPermissionsProvider() { return [ [Constants::PERMISSION_CREATE], [Constants::PERMISSION_READ], @@ -2995,9 +2986,7 @@ class ShareAPIControllerTest extends TestCase { ]; } - /** - * @dataProvider publicLinkValidPermissionsProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('publicLinkValidPermissionsProvider')] public function testUpdateLinkShareSetCRUDPermissions($permissions): void { $ocs = $this->mockFormatShare(); @@ -3042,7 +3031,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function publicLinkInvalidPermissionsProvider1() { + public static function publicLinkInvalidPermissionsProvider1() { return [ [Constants::PERMISSION_DELETE], [Constants::PERMISSION_UPDATE], @@ -3050,9 +3039,7 @@ class ShareAPIControllerTest extends TestCase { ]; } - /** - * @dataProvider publicLinkInvalidPermissionsProvider1 - */ + #[\PHPUnit\Framework\Attributes\DataProvider('publicLinkInvalidPermissionsProvider1')] public function testUpdateLinkShareSetInvalidCRUDPermissions1($permissions): void { $this->expectException(OCSBadRequestException::class); $this->expectExceptionMessage('Share must at least have READ or CREATE permissions'); @@ -3060,16 +3047,14 @@ class ShareAPIControllerTest extends TestCase { $this->testUpdateLinkShareSetCRUDPermissions($permissions, null); } - public function publicLinkInvalidPermissionsProvider2() { + public static function publicLinkInvalidPermissionsProvider2() { return [ [Constants::PERMISSION_CREATE | Constants::PERMISSION_DELETE], [Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE], ]; } - /** - * @dataProvider publicLinkInvalidPermissionsProvider2 - */ + #[\PHPUnit\Framework\Attributes\DataProvider('publicLinkInvalidPermissionsProvider2')] public function testUpdateLinkShareSetInvalidCRUDPermissions2($permissions): void { $this->expectException(OCSBadRequestException::class); $this->expectExceptionMessage('Share must have READ permission if UPDATE or DELETE permission is set'); @@ -3105,7 +3090,7 @@ class ShareAPIControllerTest extends TestCase { $ocs->updateShare(42, null, 'password', null, 'true', '2000-01-a'); } - public function publicUploadParamsProvider() { + public static function publicUploadParamsProvider() { return [ [null, 'true', null, 'password'], // legacy had no delete @@ -3121,9 +3106,7 @@ class ShareAPIControllerTest extends TestCase { ]; } - /** - * @dataProvider publicUploadParamsProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('publicUploadParamsProvider')] public function testUpdateLinkSharePublicUploadNotAllowed($permissions, $publicUpload, $expireDate, $password): void { $this->expectException(OCSForbiddenException::class); $this->expectExceptionMessage('Public upload disabled by the administrator'); @@ -3225,13 +3208,13 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->once())->method('updateShare')->with( $this->callback(function (IShare $share) use ($date) { - return $share->getPermissions() === Constants::PERMISSION_ALL && - $share->getPassword() === 'newpassword' && - $share->getSendPasswordByTalk() === true && - $share->getExpirationDate() === $date && - $share->getNote() === 'note' && - $share->getLabel() === 'label' && - $share->getHideDownload() === true; + return $share->getPermissions() === Constants::PERMISSION_ALL + && $share->getPassword() === 'newpassword' + && $share->getSendPasswordByTalk() === true + && $share->getExpirationDate() === $date + && $share->getNote() === 'note' + && $share->getLabel() === 'label' + && $share->getHideDownload() === true; }) )->willReturnArgument(0); @@ -3279,13 +3262,13 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->once())->method('updateShare')->with( $this->callback(function (IShare $share) use ($date) { - return $share->getPermissions() === Constants::PERMISSION_ALL && - $share->getPassword() === 'password' && - $share->getSendPasswordByTalk() === true && - $share->getExpirationDate() === $date && - $share->getNote() === 'note' && - $share->getLabel() === 'label' && - $share->getHideDownload() === true; + return $share->getPermissions() === Constants::PERMISSION_ALL + && $share->getPassword() === 'password' + && $share->getSendPasswordByTalk() === true + && $share->getExpirationDate() === $date + && $share->getNote() === 'note' + && $share->getLabel() === 'label' + && $share->getHideDownload() === true; }) )->willReturnArgument(0); @@ -3377,13 +3360,13 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->once())->method('updateShare')->with( $this->callback(function (IShare $share) use ($date) { - return $share->getPermissions() === Constants::PERMISSION_ALL && - $share->getPassword() === 'password' && - $share->getSendPasswordByTalk() === false && - $share->getExpirationDate() === $date && - $share->getNote() === 'note' && - $share->getLabel() === 'label' && - $share->getHideDownload() === true; + return $share->getPermissions() === Constants::PERMISSION_ALL + && $share->getPassword() === 'password' + && $share->getSendPasswordByTalk() === false + && $share->getExpirationDate() === $date + && $share->getNote() === 'note' + && $share->getLabel() === 'label' + && $share->getHideDownload() === true; }) )->willReturnArgument(0); @@ -3427,13 +3410,13 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->once())->method('updateShare')->with( $this->callback(function (IShare $share) use ($date) { - return $share->getPermissions() === Constants::PERMISSION_ALL && - $share->getPassword() === 'password' && - $share->getSendPasswordByTalk() === false && - $share->getExpirationDate() === $date && - $share->getNote() === 'note' && - $share->getLabel() === 'label' && - $share->getHideDownload() === true; + return $share->getPermissions() === Constants::PERMISSION_ALL + && $share->getPassword() === 'password' + && $share->getSendPasswordByTalk() === false + && $share->getExpirationDate() === $date + && $share->getNote() === 'note' + && $share->getLabel() === 'label' + && $share->getHideDownload() === true; }) )->willReturnArgument(0); @@ -3495,13 +3478,13 @@ class ShareAPIControllerTest extends TestCase { $date = new \DateTime('2010-12-23'); $date->setTime(0, 0, 0); - return $share->getPermissions() === Constants::PERMISSION_ALL && - $share->getPassword() === 'password' && - $share->getSendPasswordByTalk() === true && - $share->getExpirationDate() == $date && - $share->getNote() === 'note' && - $share->getLabel() === 'label' && - $share->getHideDownload() === true; + return $share->getPermissions() === Constants::PERMISSION_ALL + && $share->getPassword() === 'password' + && $share->getSendPasswordByTalk() === true + && $share->getExpirationDate() == $date + && $share->getNote() === 'note' + && $share->getLabel() === 'label' + && $share->getHideDownload() === true; }) )->willReturnArgument(0); @@ -3553,13 +3536,13 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->once())->method('updateShare')->with( $this->callback(function (IShare $share) use ($date) { - return $share->getPermissions() === (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE) && - $share->getPassword() === 'password' && - $share->getSendPasswordByTalk() === true && - $share->getExpirationDate() === $date && - $share->getNote() === 'note' && - $share->getLabel() === 'label' && - $share->getHideDownload() === true; + return $share->getPermissions() === (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE) + && $share->getPassword() === 'password' + && $share->getSendPasswordByTalk() === true + && $share->getExpirationDate() === $date + && $share->getNote() === 'note' + && $share->getLabel() === 'label' + && $share->getHideDownload() === true; }) )->willReturnArgument(0); @@ -3614,13 +3597,13 @@ class ShareAPIControllerTest extends TestCase { $this->shareManager->expects($this->once())->method('updateShare')->with( $this->callback(function (IShare $share) use ($date): bool { - return $share->getPermissions() === (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE) && - $share->getPassword() === 'password' && - $share->getSendPasswordByTalk() === true && - $share->getExpirationDate() === $date && - $share->getNote() === 'note' && - $share->getLabel() === 'label' && - $share->getHideDownload() === true; + return $share->getPermissions() === (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE) + && $share->getPassword() === 'password' + && $share->getSendPasswordByTalk() === true + && $share->getExpirationDate() === $date + && $share->getNote() === 'note' + && $share->getLabel() === 'label' + && $share->getHideDownload() === true; }) )->willReturnArgument(0); @@ -3676,13 +3659,13 @@ class ShareAPIControllerTest extends TestCase { ->method('updateShare') ->with( $this->callback(function (IShare $share) use ($date) { - return $share->getPermissions() === Constants::PERMISSION_ALL && - $share->getPassword() === 'password' && - $share->getSendPasswordByTalk() === true && - $share->getExpirationDate() === $date && - $share->getNote() === 'note' && - $share->getLabel() === 'label' && - $share->getHideDownload() === true; + return $share->getPermissions() === Constants::PERMISSION_ALL + && $share->getPassword() === 'password' + && $share->getSendPasswordByTalk() === true + && $share->getExpirationDate() === $date + && $share->getNote() === 'note' + && $share->getLabel() === 'label' + && $share->getHideDownload() === true; }) )->willReturnArgument(0); @@ -4899,13 +4882,13 @@ class ShareAPIControllerTest extends TestCase { } /** - * @dataProvider dataFormatShare * * @param array $expects * @param IShare $share * @param array $users * @param $exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataFormatShare')] public function testFormatShare(array $expects, IShare $share, array $users, $exception): void { $this->userManager->method('get')->willReturnMap($users); @@ -5118,13 +5101,13 @@ class ShareAPIControllerTest extends TestCase { } /** - * @dataProvider dataFormatRoomShare * * @param array $expects * @param IShare $share * @param bool $helperAvailable * @param array $formatShareByHelper */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataFormatRoomShare')] public function testFormatRoomShare(array $expects, IShare $share, bool $helperAvailable, array $formatShareByHelper): void { $this->rootFolder->method('getUserFolder') ->with($this->currentUser) diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php index 27fa7ecf480..011210aff42 100644 --- a/apps/files_sharing/tests/Controller/ShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -175,7 +176,7 @@ class ShareControllerTest extends \Test\TestCase { ->expects($this->once()) ->method('getShareByToken') ->with('invalidtoken') - ->will($this->throwException(new ShareNotFound())); + ->willThrowException(new ShareNotFound()); $this->expectException(NotFoundException::class); @@ -612,9 +613,9 @@ class ShareControllerTest extends \Test\TestCase { $this->l10n->expects($this->any()) ->method('t') - ->will($this->returnCallback(function ($text, $parameters) { + ->willReturnCallback(function ($text, $parameters) { return vsprintf($text, $parameters); - })); + }); $this->defaults->expects(self::any()) ->method('getProductName') diff --git a/apps/files_sharing/tests/Controller/ShareInfoControllerTest.php b/apps/files_sharing/tests/Controller/ShareInfoControllerTest.php index 571647829f2..1a678610805 100644 --- a/apps/files_sharing/tests/Controller/ShareInfoControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareInfoControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php index c8113558f6c..18e1bf0347b 100644 --- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -69,7 +70,7 @@ class ShareesAPIControllerTest extends TestCase { ); } - public function dataSearch(): array { + public static function dataSearch(): array { $noRemote = [IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_EMAIL]; $allTypes = [IShare::TYPE_USER, IShare::TYPE_GROUP, IShare::TYPE_REMOTE, IShare::TYPE_REMOTE_GROUP, IShare::TYPE_EMAIL]; @@ -197,7 +198,6 @@ class ShareesAPIControllerTest extends TestCase { } /** - * @dataProvider dataSearch * * @param array $getData * @param string $apiSetting @@ -211,6 +211,7 @@ class ShareesAPIControllerTest extends TestCase { * @param bool $allowGroupSharing * @throws OCSBadRequestException */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataSearch')] public function testSearch( array $getData, string $apiSetting, @@ -301,7 +302,7 @@ class ShareesAPIControllerTest extends TestCase { $this->assertInstanceOf(DataResponse::class, $sharees->search($search, $itemType, $page, $perPage, $shareType)); } - public function dataSearchInvalid(): array { + public static function dataSearchInvalid(): array { return [ // Test invalid pagination [[ @@ -328,11 +329,11 @@ class ShareesAPIControllerTest extends TestCase { } /** - * @dataProvider dataSearchInvalid * * @param array $getData * @param string $message */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataSearchInvalid')] public function testSearchInvalid($getData, $message): void { $page = $getData['page'] ?? 1; $perPage = $getData['perPage'] ?? 200; @@ -376,7 +377,7 @@ class ShareesAPIControllerTest extends TestCase { } } - public function dataIsRemoteSharingAllowed() { + public static function dataIsRemoteSharingAllowed() { return [ ['file', true], ['folder', true], @@ -386,11 +387,11 @@ class ShareesAPIControllerTest extends TestCase { } /** - * @dataProvider dataIsRemoteSharingAllowed * * @param string $itemType * @param bool $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataIsRemoteSharingAllowed')] public function testIsRemoteSharingAllowed($itemType, $expected): void { $this->assertSame($expected, $this->invokePrivate($this->sharees, 'isRemoteSharingAllowed', [$itemType])); } @@ -419,7 +420,7 @@ class ShareesAPIControllerTest extends TestCase { $this->sharees->search('', null, 1, 10, [], false); } - public function dataGetPaginationLink() { + public static function dataGetPaginationLink() { return [ [1, '/ocs/v1.php', ['perPage' => 2], '<?perPage=2&page=2>; rel="next"'], [10, '/ocs/v2.php', ['perPage' => 2], '<?perPage=2&page=11>; rel="next"'], @@ -427,13 +428,13 @@ class ShareesAPIControllerTest extends TestCase { } /** - * @dataProvider dataGetPaginationLink * * @param int $page * @param string $scriptName * @param array $params * @param array $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataGetPaginationLink')] public function testGetPaginationLink($page, $scriptName, $params, $expected): void { $this->request->expects($this->once()) ->method('getScriptName') @@ -442,7 +443,7 @@ class ShareesAPIControllerTest extends TestCase { $this->assertEquals($expected, $this->invokePrivate($this->sharees, 'getPaginationLink', [$page, $params])); } - public function dataIsV2() { + public static function dataIsV2() { return [ ['/ocs/v1.php', false], ['/ocs/v2.php', true], @@ -450,11 +451,11 @@ class ShareesAPIControllerTest extends TestCase { } /** - * @dataProvider dataIsV2 * * @param string $scriptName * @param bool $expected */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataIsV2')] public function testIsV2($scriptName, $expected): void { $this->request->expects($this->once()) ->method('getScriptName') diff --git a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php index 727b0a16cc5..c245d157151 100644 --- a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php +++ b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/EncryptedSizePropagationTest.php b/apps/files_sharing/tests/EncryptedSizePropagationTest.php index 6bcded8b3e2..1be17df3957 100644 --- a/apps/files_sharing/tests/EncryptedSizePropagationTest.php +++ b/apps/files_sharing/tests/EncryptedSizePropagationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/EtagPropagationTest.php b/apps/files_sharing/tests/EtagPropagationTest.php index 930279a531c..d8580ea92d5 100644 --- a/apps/files_sharing/tests/EtagPropagationTest.php +++ b/apps/files_sharing/tests/EtagPropagationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/ExpireSharesJobTest.php b/apps/files_sharing/tests/ExpireSharesJobTest.php index e636a52c05c..42bc5a4b659 100644 --- a/apps/files_sharing/tests/ExpireSharesJobTest.php +++ b/apps/files_sharing/tests/ExpireSharesJobTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -89,7 +90,7 @@ class ExpireSharesJobTest extends \Test\TestCase { return $shares; } - public function dataExpireLinkShare() { + public static function dataExpireLinkShare() { return [ [false, '', false, false], [false, '', true, false], @@ -105,13 +106,13 @@ class ExpireSharesJobTest extends \Test\TestCase { } /** - * @dataProvider dataExpireLinkShare * * @param bool addExpiration Should we add an expire date * @param string $interval The dateInterval * @param bool $addInterval If true add to the current time if false subtract * @param bool $shouldExpire Should this share be expired */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataExpireLinkShare')] public function testExpireLinkShare($addExpiration, $interval, $addInterval, $shouldExpire): void { $this->loginAsUser($this->user1); diff --git a/apps/files_sharing/tests/External/CacheTest.php b/apps/files_sharing/tests/External/CacheTest.php index 5a862d8ddc0..60820013f11 100644 --- a/apps/files_sharing/tests/External/CacheTest.php +++ b/apps/files_sharing/tests/External/CacheTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/External/ManagerTest.php b/apps/files_sharing/tests/External/ManagerTest.php index 5314d1ec00f..fbe6eb1e85b 100644 --- a/apps/files_sharing/tests/External/ManagerTest.php +++ b/apps/files_sharing/tests/External/ManagerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -107,10 +108,10 @@ class ManagerTest extends TestCase { $this->userManager->expects($this->any())->method('get')->willReturn($this->user); $this->groupManager->expects($this->any())->method(('getUserGroups'))->willReturn([$group1, $group2]); $this->groupManager->expects($this->any())->method(('get')) - ->will($this->returnValueMap([ + ->willReturnMap([ ['group1', $group1], ['group2', $group2], - ])); + ]); } protected function tearDown(): void { diff --git a/apps/files_sharing/tests/External/ScannerTest.php b/apps/files_sharing/tests/External/ScannerTest.php index 6241174fb28..8b44d47f2b1 100644 --- a/apps/files_sharing/tests/External/ScannerTest.php +++ b/apps/files_sharing/tests/External/ScannerTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/ExternalStorageTest.php b/apps/files_sharing/tests/ExternalStorageTest.php index ef69e85d71b..1d9d2eed7bd 100644 --- a/apps/files_sharing/tests/ExternalStorageTest.php +++ b/apps/files_sharing/tests/ExternalStorageTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -19,7 +20,7 @@ use OCP\Http\Client\IResponse; * @group DB */ class ExternalStorageTest extends \Test\TestCase { - public function optionsProvider() { + public static function optionsProvider() { return [ [ 'http://remoteserver:8080/owncloud', @@ -87,9 +88,7 @@ class ExternalStorageTest extends \Test\TestCase { ); } - /** - * @dataProvider optionsProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('optionsProvider')] public function testStorageMountOptions($inputUri, $baseUri): void { $storage = $this->getTestStorage($inputUri); $this->assertEquals($baseUri, $storage->getBaseUri()); diff --git a/apps/files_sharing/tests/GroupEtagPropagationTest.php b/apps/files_sharing/tests/GroupEtagPropagationTest.php index f2c74789697..da9c7c6bd07 100644 --- a/apps/files_sharing/tests/GroupEtagPropagationTest.php +++ b/apps/files_sharing/tests/GroupEtagPropagationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/HelperTest.php b/apps/files_sharing/tests/HelperTest.php index d8b5b9a6f3f..4d0d747b3e4 100644 --- a/apps/files_sharing/tests/HelperTest.php +++ b/apps/files_sharing/tests/HelperTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/LockingTest.php b/apps/files_sharing/tests/LockingTest.php index eba1e662907..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. diff --git a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php index 30bae45f520..efc6b3f7f7f 100644 --- a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -72,12 +73,12 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase { } /** - * @dataProvider dataBeforeController * * @param Controller $controller * @param bool $enabled * @param bool $exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataBeforeController')] public function testBeforeController(Controller $controller, $enabled, $exception): void { $this->shareManager->method('shareApiEnabled')->willReturn($enabled); @@ -104,11 +105,11 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase { } /** - * @dataProvider dataAfterController * * @param Controller $controller * @param bool $called */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataAfterController')] public function testAfterController(Controller $controller): void { if ($controller instanceof ShareAPIController) { $controller->expects($this->once())->method('cleanup'); diff --git a/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php b/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php index 44ef3bebdc8..631b6a0f51c 100644 --- a/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php index 5b4f4de33d7..3d86007a54c 100644 --- a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -79,7 +80,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { $this->assertFalse(self::invokePrivate($this->sharingCheckMiddleware, 'isSharingEnabled')); } - public function externalSharesChecksDataProvider() { + public static function externalSharesChecksDataProvider() { $data = []; foreach ([false, true] as $annIn) { @@ -114,9 +115,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { return $data; } - /** - * @dataProvider externalSharesChecksDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('externalSharesChecksDataProvider')] public function testExternalSharesChecks($annotations, $config, $expectedResult): void { $this->reflector ->expects($this->atLeastOnce()) @@ -130,9 +129,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { $this->assertEquals($expectedResult, self::invokePrivate($this->sharingCheckMiddleware, 'externalSharesChecks')); } - /** - * @dataProvider externalSharesChecksDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('externalSharesChecksDataProvider')] public function testBeforeControllerWithExternalShareControllerWithSharingEnabled($annotations, $config, $noException): void { $this->appManager ->expects($this->once()) diff --git a/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php b/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php index 9dccfd80025..3cbbad0f8bc 100644 --- a/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php +++ b/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2017 ownCloud, Inc. diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php index 4a1eb673a06..e043a1cb1ef 100644 --- a/apps/files_sharing/tests/MountProviderTest.php +++ b/apps/files_sharing/tests/MountProviderTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -9,6 +10,7 @@ namespace OCA\Files_Sharing\Tests; use OC\Memcache\NullCache; use OC\Share20\Share; use OCA\Files_Sharing\MountProvider; +use OCA\Files_Sharing\SharedMount; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\IRootFolder; use OCP\Files\Mount\IMountManager; @@ -60,8 +62,8 @@ class MountProviderTest extends \Test\TestCase { $shareAttributes = $this->createMock(IShareAttributes::class); $shareAttributes->method('toArray')->willReturn($attrs); - $shareAttributes->method('getAttribute')->will( - $this->returnCallback(function ($scope, $key) use ($attrs) { + $shareAttributes->method('getAttribute')->willReturnCallback( + function ($scope, $key) use ($attrs) { $result = null; foreach ($attrs as $attr) { if ($attr['key'] === $key && $attr['scope'] === $scope) { @@ -69,7 +71,7 @@ class MountProviderTest extends \Test\TestCase { } } return $result; - }) + } ); return $shareAttributes; } @@ -81,7 +83,7 @@ class MountProviderTest extends \Test\TestCase { ->willReturn($permissions); $share->expects($this->any()) ->method('getAttributes') - ->will($this->returnValue($this->makeMockShareAttributes($attributes))); + ->willReturn($this->makeMockShareAttributes($attributes)); $share->expects($this->any()) ->method('getShareOwner') ->willReturn($owner); @@ -163,7 +165,7 @@ class MountProviderTest extends \Test\TestCase { $this->assertInstanceOf('OCA\Files_Sharing\SharedMount', $mounts[1]); $this->assertInstanceOf('OCA\Files_Sharing\SharedMount', $mounts[2]); $this->assertInstanceOf('OCA\Files_Sharing\SharedMount', $mounts[3]); - /** @var OCA\Files_Sharing\SharedMount[] $mounts */ + /** @var SharedMount[] $mounts */ $mountedShare1 = $mounts[0]->getShare(); $this->assertEquals('2', $mountedShare1->getId()); $this->assertEquals('user2', $mountedShare1->getShareOwner()); @@ -331,12 +333,12 @@ class MountProviderTest extends \Test\TestCase { * Happens when sharing the same entry to a user through multiple ways, * like several groups and also direct shares at the same time. * - * @dataProvider mergeSharesDataProvider * * @param array $userShares array of user share specs * @param array $groupShares array of group share specs * @param array $expectedShares array of expected supershare specs */ + #[\PHPUnit\Framework\Attributes\DataProvider('mergeSharesDataProvider')] public function testMergeShares($userShares, $groupShares, $expectedShares, $moveFails = false): void { $rootFolder = $this->createMock(IRootFolder::class); $userManager = $this->createMock(IUserManager::class); @@ -377,7 +379,7 @@ class MountProviderTest extends \Test\TestCase { if ($moveFails) { $this->shareManager->expects($this->any()) ->method('moveShare') - ->will($this->throwException(new \InvalidArgumentException())); + ->willThrowException(new \InvalidArgumentException()); } $mounts = $this->provider->getMountsForUser($this->user, $this->loader); @@ -389,7 +391,7 @@ class MountProviderTest extends \Test\TestCase { $this->assertInstanceOf('OCA\Files_Sharing\SharedMount', $mount); // supershare - /** @var OCA\Files_Sharing\SharedMount $mount */ + /** @var SharedMount $mount */ $share = $mount->getShare(); $this->assertEquals($expectedShare[0], $share->getId()); diff --git a/apps/files_sharing/tests/PropagationTestCase.php b/apps/files_sharing/tests/PropagationTestCase.php index 1c67b1b9337..98bf5ad92fd 100644 --- a/apps/files_sharing/tests/PropagationTestCase.php +++ b/apps/files_sharing/tests/PropagationTestCase.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/ShareTest.php b/apps/files_sharing/tests/ShareTest.php index a0458ab0ffb..737ad6dcb4e 100644 --- a/apps/files_sharing/tests/ShareTest.php +++ b/apps/files_sharing/tests/ShareTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -188,8 +189,8 @@ class ShareTest extends TestCase { /** * shared files should never have delete permissions - * @dataProvider dataProviderTestFileSharePermissions */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderTestFileSharePermissions')] public function testFileSharePermissions($permission, $expectedvalid): void { $pass = true; try { @@ -207,7 +208,7 @@ class ShareTest extends TestCase { $this->assertEquals($expectedvalid, $pass); } - public function dataProviderTestFileSharePermissions() { + public static function dataProviderTestFileSharePermissions() { $permission1 = Constants::PERMISSION_ALL; $permission3 = Constants::PERMISSION_READ; $permission4 = Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE; diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php index 56accb88db6..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. @@ -224,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 { @@ -243,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], diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php index 55c16c2ebb3..1c1f0a7b71d 100644 --- a/apps/files_sharing/tests/SharedStorageTest.php +++ b/apps/files_sharing/tests/SharedStorageTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -570,7 +571,7 @@ class SharedStorageTest extends TestCase { $share->method('getShareOwner')->willReturn(self::TEST_FILES_SHARING_API_USER1); $share->method('getNodeId')->willReturn(1); $ownerView = $this->createMock(View::class); - $ownerView->method('getPath')->will($this->throwException(new NotFoundException())); + $ownerView->method('getPath')->willThrowException(new NotFoundException()); $storage = new SharedStorage([ 'ownerView' => $ownerView, 'superShare' => $share, diff --git a/apps/files_sharing/tests/SharesReminderJobTest.php b/apps/files_sharing/tests/SharesReminderJobTest.php index 7a480fccb23..ce468e279ec 100644 --- a/apps/files_sharing/tests/SharesReminderJobTest.php +++ b/apps/files_sharing/tests/SharesReminderJobTest.php @@ -95,7 +95,7 @@ class SharesReminderJobTest extends \Test\TestCase { parent::tearDown(); } - public function dataSharesReminder() { + public static function dataSharesReminder() { $someMail = 'test@test.com'; $noExpirationDate = null; $today = new \DateTime(); @@ -144,7 +144,6 @@ class SharesReminderJobTest extends \Test\TestCase { } /** - * @dataProvider dataSharesReminder * * @param \DateTime|null $expirationDate Share expiration date * @param string $email Share with this email. If empty, the share is of type TYPE_USER and the sharee is user2 @@ -152,6 +151,7 @@ class SharesReminderJobTest extends \Test\TestCase { * @param int $permissions * @param bool $shouldBeReminded */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataSharesReminder')] public function testSharesReminder( ?\DateTime $expirationDate, string $email, bool $isEmpty, int $permissions, bool $shouldBeReminded, ): void { diff --git a/apps/files_sharing/tests/SizePropagationTest.php b/apps/files_sharing/tests/SizePropagationTest.php index 082348c31a0..e1b67abca90 100644 --- a/apps/files_sharing/tests/SizePropagationTest.php +++ b/apps/files_sharing/tests/SizePropagationTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/TestCase.php b/apps/files_sharing/tests/TestCase.php index 34e2d71fb02..9a6935e46b6 100644 --- a/apps/files_sharing/tests/TestCase.php +++ b/apps/files_sharing/tests/TestCase.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/UnshareChildrenTest.php b/apps/files_sharing/tests/UnshareChildrenTest.php index 61c4aa94213..ac870212c99 100644 --- a/apps/files_sharing/tests/UnshareChildrenTest.php +++ b/apps/files_sharing/tests/UnshareChildrenTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. diff --git a/apps/files_sharing/tests/UpdaterTest.php b/apps/files_sharing/tests/UpdaterTest.php index efdbeebdf3f..23044e0b2f3 100644 --- a/apps/files_sharing/tests/UpdaterTest.php +++ b/apps/files_sharing/tests/UpdaterTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -123,7 +124,7 @@ class UpdaterTest extends TestCase { Filesystem::getLoader()->removeStorageWrapper('oc_trashbin'); } - public function shareFolderProvider() { + public static function shareFolderProvider() { return [ ['/'], ['/my_shares'], @@ -133,10 +134,10 @@ class UpdaterTest extends TestCase { /** * if a file gets shared the etag for the recipients root should change * - * @dataProvider shareFolderProvider * * @param string $shareFolder share folder to use */ + #[\PHPUnit\Framework\Attributes\DataProvider('shareFolderProvider')] public function testShareFile($shareFolder): void { $config = Server::get(IConfig::class); $oldShareFolder = $config->getSystemValue('share_folder'); diff --git a/apps/files_sharing/tests/WatcherTest.php b/apps/files_sharing/tests/WatcherTest.php index 2d1568e6a31..15676836915 100644 --- a/apps/files_sharing/tests/WatcherTest.php +++ b/apps/files_sharing/tests/WatcherTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. |