diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2024-09-15 22:32:31 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2024-09-15 22:32:31 +0200 |
commit | 49dd79eabb2b8902559a7a4e8f8fcad54f46b604 (patch) | |
tree | 2af18db46ba463368dc4461d7436fb69577923de /apps/files_sharing | |
parent | 4281ce6fa1bb8235426099d720734d2394bec203 (diff) | |
download | nextcloud-server-49dd79eabb2b8902559a7a4e8f8fcad54f46b604.tar.gz nextcloud-server-49dd79eabb2b8902559a7a4e8f8fcad54f46b604.zip |
refactor: Add void return type to PHPUnit test methods
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/files_sharing')
33 files changed, 285 insertions, 285 deletions
diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index 9b95ac78770..fe0739cfcde 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -125,7 +125,7 @@ class ApiTest extends TestCase { ); } - public function testCreateShareUserFile() { + public function testCreateShareUserFile(): void { $this->setUp(); // for some reasons phpunit refuses to do this for us only for this test $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2); @@ -143,7 +143,7 @@ class ApiTest extends TestCase { $ocs->cleanup(); } - public function testCreateShareUserFolder() { + public function testCreateShareUserFolder(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2); $ocs->cleanup(); @@ -160,7 +160,7 @@ class ApiTest extends TestCase { } - public function testCreateShareGroupFile() { + public function testCreateShareGroupFile(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1); $ocs->cleanup(); @@ -176,7 +176,7 @@ class ApiTest extends TestCase { $ocs->cleanup(); } - public function testCreateShareGroupFolder() { + public function testCreateShareGroupFolder(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1); $ocs->cleanup(); @@ -195,7 +195,7 @@ class ApiTest extends TestCase { /** * @group RoutingWeirdness */ - public function testCreateShareLink() { + public function testCreateShareLink(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK); $ocs->cleanup(); @@ -220,7 +220,7 @@ class ApiTest extends TestCase { /** * @group RoutingWeirdness */ - public function testCreateShareLinkPublicUpload() { + public function testCreateShareLinkPublicUpload(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true'); $ocs->cleanup(); @@ -248,7 +248,7 @@ class ApiTest extends TestCase { $ocs->cleanup(); } - public function testEnforceLinkPassword() { + public function testEnforceLinkPassword(): void { $password = md5(time()); $config = \OC::$server->getConfig(); $config->setAppValue('core', 'shareapi_enforce_links_password', 'yes'); @@ -302,7 +302,7 @@ class ApiTest extends TestCase { /** * @medium */ - public function testSharePermissions() { + public function testSharePermissions(): void { // sharing file to a user should work if shareapi_exclude_groups is set // to no \OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups', 'no'); @@ -353,7 +353,7 @@ class ApiTest extends TestCase { /** * @medium */ - public function testGetAllShares() { + public function testGetAllShares(): void { $node = $this->userFolder->get($this->filename); $share = $this->shareManager->newShare(); @@ -374,7 +374,7 @@ class ApiTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testGetAllSharesWithMe() { + public function testGetAllSharesWithMe(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); $this->logout(); @@ -414,7 +414,7 @@ class ApiTest extends TestCase { * @medium * @group RoutingWeirdness */ - public function testPublicLinkUrl() { + public function testPublicLinkUrl(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK); $ocs->cleanup(); @@ -463,7 +463,7 @@ class ApiTest extends TestCase { * @depends testCreateShareUserFile * @depends testCreateShareLink */ - public function testGetShareFromSource() { + public function testGetShareFromSource(): void { $node = $this->userFolder->get($this->filename); $share = $this->shareManager->newShare(); $share->setNode($node) @@ -496,7 +496,7 @@ class ApiTest extends TestCase { * @depends testCreateShareUserFile * @depends testCreateShareLink */ - public function testGetShareFromSourceWithReshares() { + public function testGetShareFromSourceWithReshares(): void { $node = $this->userFolder->get($this->filename); $share1 = $this->shareManager->newShare(); $share1->setNode($node) @@ -537,7 +537,7 @@ class ApiTest extends TestCase { * @medium * @depends testCreateShareUserFile */ - public function testGetShareFromId() { + public function testGetShareFromId(): void { $node = $this->userFolder->get($this->filename); $share1 = $this->shareManager->newShare(); $share1->setNode($node) @@ -561,7 +561,7 @@ class ApiTest extends TestCase { /** * @medium */ - public function testGetShareFromFolder() { + public function testGetShareFromFolder(): void { $node1 = $this->userFolder->get($this->filename); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -591,7 +591,7 @@ class ApiTest extends TestCase { $this->shareManager->deleteShare($share2); } - public function testGetShareFromFolderWithFile() { + public function testGetShareFromFolderWithFile(): void { $node1 = $this->userFolder->get($this->filename); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -617,7 +617,7 @@ class ApiTest extends TestCase { * share a folder, than reshare a file within the shared folder and check if we construct the correct path * @medium */ - public function testGetShareFromFolderReshares() { + public function testGetShareFromFolderReshares(): void { $node1 = $this->userFolder->get($this->folder); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -677,7 +677,7 @@ class ApiTest extends TestCase { * reshare a sub folder and check if we get the correct path * @medium */ - public function testGetShareFromSubFolderReShares() { + public function testGetShareFromSubFolderReShares(): void { $node1 = $this->userFolder->get($this->folder . $this->subfolder); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -796,7 +796,7 @@ class ApiTest extends TestCase { * test multiple shared folder if the path gets constructed correctly * @medium */ - public function testGetShareMultipleSharedFolder() { + public function testGetShareMultipleSharedFolder(): void { $this->setUp(); $node1 = $this->userFolder->get($this->folder . $this->subfolder); $share1 = $this->shareManager->newShare(); @@ -861,7 +861,7 @@ class ApiTest extends TestCase { * test re-re-share of folder if the path gets constructed correctly * @medium */ - public function testGetShareFromFileReReShares() { + public function testGetShareFromFileReReShares(): void { $node1 = $this->userFolder->get($this->folder . $this->subfolder); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -916,7 +916,7 @@ class ApiTest extends TestCase { /** * @medium */ - public function testGetShareFromUnknownId() { + public function testGetShareFromUnknownId(): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER3); try { $ocs->getShare(0); @@ -932,7 +932,7 @@ class ApiTest extends TestCase { * @depends testCreateShareUserFile * @depends testCreateShareLink */ - public function testUpdateShare() { + public function testUpdateShare(): void { $password = md5(time()); $node1 = $this->userFolder->get($this->filename); @@ -992,7 +992,7 @@ class ApiTest extends TestCase { /** * @medium */ - public function testUpdateShareUpload() { + public function testUpdateShareUpload(): void { $node1 = $this->userFolder->get($this->folder); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -1023,7 +1023,7 @@ class ApiTest extends TestCase { /** * @medium */ - public function testUpdateShareExpireDate() { + public function testUpdateShareExpireDate(): void { $node1 = $this->userFolder->get($this->folder); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -1096,7 +1096,7 @@ class ApiTest extends TestCase { * @medium * @depends testCreateShareUserFile */ - public function testDeleteShare() { + public function testDeleteShare(): void { $node1 = $this->userFolder->get($this->filename); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -1128,7 +1128,7 @@ class ApiTest extends TestCase { /** * test unshare of a reshared file */ - public function testDeleteReshare() { + public function testDeleteReshare(): void { $node1 = $this->userFolder->get($this->folder); $share1 = $this->shareManager->newShare(); $share1->setNode($node1) @@ -1163,7 +1163,7 @@ class ApiTest extends TestCase { /** * share a folder which contains a share mount point, should be forbidden */ - public function testShareFolderWithAMountPoint() { + public function testShareFolderWithAMountPoint(): void { // user 1 shares a folder with user2 self::loginHelper(self::TEST_FILES_SHARING_API_USER1); @@ -1230,7 +1230,7 @@ class ApiTest extends TestCase { /** * Tests mounting a folder that is an external storage mount point. */ - public function testShareStorageMountPoint() { + public function testShareStorageMountPoint(): void { $tempStorage = new \OC\Files\Storage\Temporary([]); $tempStorage->file_put_contents('test.txt', 'abcdef'); $tempStorage->getScanner()->scan(''); @@ -1286,7 +1286,7 @@ class ApiTest extends TestCase { * @dataProvider datesProvider * @group RoutingWeirdness */ - public function testPublicLinkExpireDate($date, $valid) { + public function testPublicLinkExpireDate($date, $valid): void { $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); try { @@ -1318,7 +1318,7 @@ class ApiTest extends TestCase { /** * @group RoutingWeirdness */ - public function testCreatePublicLinkExpireDateValid() { + public function testCreatePublicLinkExpireDateValid(): void { $config = \OC::$server->getConfig(); // enforce expire date, by default 7 days after the file was shared @@ -1350,7 +1350,7 @@ class ApiTest extends TestCase { $config->setAppValue('core', 'shareapi_enforce_expire_date', 'no'); } - public function testCreatePublicLinkExpireDateInvalidFuture() { + public function testCreatePublicLinkExpireDateInvalidFuture(): void { $config = \OC::$server->getConfig(); // enforce expire date, by default 7 days after the file was shared @@ -1400,7 +1400,7 @@ class ApiTest extends TestCase { * test for no invisible shares * See: https://github.com/owncloud/core/issues/22295 */ - public function testInvisibleSharesUser() { + public function testInvisibleSharesUser(): void { // simulate a post request $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, self::TEST_FILES_SHARING_API_USER2); @@ -1432,7 +1432,7 @@ class ApiTest extends TestCase { * test for no invisible shares * See: https://github.com/owncloud/core/issues/22295 */ - public function testInvisibleSharesGroup() { + public function testInvisibleSharesGroup(): void { // simulate a post request $ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1); $result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1); diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php index 9f4a4b9e2ea..4db3adf34a6 100644 --- a/apps/files_sharing/tests/CacheTest.php +++ b/apps/files_sharing/tests/CacheTest.php @@ -188,7 +188,7 @@ class CacheTest extends TestCase { * we cannot use a dataProvider because that would cause the stray hook detection to remove the hooks * that were added in setUpBeforeClass. */ - public function testSearch() { + public function testSearch(): void { foreach ($this->searchDataProvider() as $data) { [$pattern, $expectedFiles] = $data; @@ -200,7 +200,7 @@ class CacheTest extends TestCase { /** * Test searching by mime type */ - public function testSearchByMime() { + public function testSearchByMime(): void { $results = $this->sharedStorage->getCache()->searchByMime('text'); $check = [ [ @@ -219,7 +219,7 @@ class CacheTest extends TestCase { $this->verifyFiles($check, $results); } - public function testGetFolderContentsInRoot() { + public function testGetFolderContentsInRoot(): void { $results = $this->user2View->getDirectoryContent('/'); $results = (array_filter($results, function ($file) { return $file->getName() !== 'welcome.txt'; @@ -249,7 +249,7 @@ class CacheTest extends TestCase { ); } - public function testGetFolderContentsInSubdir() { + public function testGetFolderContentsInSubdir(): void { $results = $this->user2View->getDirectoryContent('/shareddir'); $this->verifyFiles( @@ -287,7 +287,7 @@ class CacheTest extends TestCase { * * https://github.com/nextcloud/server/issues/39879 */ - public function testShareRenameOriginalFileInRecentResults() { + public function testShareRenameOriginalFileInRecentResults(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $rootFolder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1); @@ -316,7 +316,7 @@ class CacheTest extends TestCase { }, $recents)); } - public function testGetFolderContentsWhenSubSubdirShared() { + public function testGetFolderContentsWhenSubSubdirShared(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $rootFolder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1); @@ -400,7 +400,7 @@ class CacheTest extends TestCase { } } - public function testGetPathByIdDirectShare() { + public function testGetPathByIdDirectShare(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); \OC\Files\Filesystem::file_put_contents('test.txt', 'foo'); $info = \OC\Files\Filesystem::getFileInfo('test.txt'); @@ -430,7 +430,7 @@ class CacheTest extends TestCase { $this->assertEquals('', $sharedCache->getPathById($info->getId())); } - public function testGetPathByIdShareSubFolder() { + public function testGetPathByIdShareSubFolder(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); \OC\Files\Filesystem::mkdir('foo'); \OC\Files\Filesystem::mkdir('foo/bar'); @@ -463,7 +463,7 @@ class CacheTest extends TestCase { $this->assertEquals('bar/test.txt', $sharedCache->getPathById($fileInfo->getId())); } - public function testNumericStorageId() { + public function testNumericStorageId(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); \OC\Files\Filesystem::mkdir('foo'); @@ -490,7 +490,7 @@ class CacheTest extends TestCase { $this->assertEquals($sourceStorage->getCache()->getNumericStorageId(), $sharedStorage->getCache()->getNumericStorageId()); } - public function testShareJailedStorage() { + public function testShareJailedStorage(): void { $sourceStorage = new Temporary(); $sourceStorage->mkdir('jail'); $sourceStorage->mkdir('jail/sub'); @@ -529,7 +529,7 @@ class CacheTest extends TestCase { $this->assertTrue($sourceStorage->getCache()->inCache('jail/sub/bar.txt')); } - public function testSearchShareJailedStorage() { + public function testSearchShareJailedStorage(): void { $sourceStorage = new Temporary(); $sourceStorage->mkdir('jail'); $sourceStorage->mkdir('jail/sub'); diff --git a/apps/files_sharing/tests/CapabilitiesTest.php b/apps/files_sharing/tests/CapabilitiesTest.php index 69911100f56..c188cbfdfcc 100644 --- a/apps/files_sharing/tests/CapabilitiesTest.php +++ b/apps/files_sharing/tests/CapabilitiesTest.php @@ -81,7 +81,7 @@ class CapabilitiesTest extends \Test\TestCase { return $result; } - public function testEnabledSharingAPI() { + public function testEnabledSharingAPI(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ]; @@ -92,7 +92,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertArrayHasKey('resharing', $result); } - public function testDisabledSharingAPI() { + public function testDisabledSharingAPI(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'no'], ]; @@ -103,7 +103,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['resharing']); } - public function testNoLinkSharing() { + public function testNoLinkSharing(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'no'], @@ -113,7 +113,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['public']['enabled']); } - public function testOnlyLinkSharing() { + public function testOnlyLinkSharing(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -124,7 +124,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['public']['enabled']); } - public function testLinkPassword() { + public function testLinkPassword(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -137,7 +137,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['public']['password']['enforced']); } - public function testLinkNoPassword() { + public function testLinkNoPassword(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -150,7 +150,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['public']['password']['enforced']); } - public function testLinkNoExpireDate() { + public function testLinkNoExpireDate(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -163,7 +163,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['public']['expire_date']['enabled']); } - public function testLinkExpireDate() { + public function testLinkExpireDate(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -180,7 +180,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['public']['expire_date']['enforced']); } - public function testLinkExpireDateEnforced() { + public function testLinkExpireDateEnforced(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -194,7 +194,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['public']['expire_date']['enforced']); } - public function testLinkSendMail() { + public function testLinkSendMail(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -205,7 +205,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['public']['send_mail']); } - public function testLinkNoSendMail() { + public function testLinkNoSendMail(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -216,7 +216,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['public']['send_mail']); } - public function testResharing() { + public function testResharing(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_resharing', 'yes', 'yes'], @@ -226,7 +226,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['resharing']); } - public function testNoResharing() { + public function testNoResharing(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_resharing', 'yes', 'no'], @@ -236,7 +236,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['resharing']); } - public function testLinkPublicUpload() { + public function testLinkPublicUpload(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -248,7 +248,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['public']['upload_files_drop']); } - public function testLinkNoPublicUpload() { + public function testLinkNoPublicUpload(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], @@ -260,7 +260,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['public']['upload_files_drop']); } - public function testNoGroupSharing() { + public function testNoGroupSharing(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_group_sharing', 'yes', 'no'], @@ -269,7 +269,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['group_sharing']); } - public function testGroupSharing() { + public function testGroupSharing(): void { $map = [ ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_group_sharing', 'yes', 'yes'], @@ -278,7 +278,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['group_sharing']); } - public function testFederatedSharingIncoming() { + public function testFederatedSharingIncoming(): void { $map = [ ['files_sharing', 'incoming_server2server_share_enabled', 'yes', 'yes'], ]; @@ -287,7 +287,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['federation']['incoming']); } - public function testFederatedSharingNoIncoming() { + public function testFederatedSharingNoIncoming(): void { $map = [ ['files_sharing', 'incoming_server2server_share_enabled', 'yes', 'no'], ]; @@ -296,7 +296,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['federation']['incoming']); } - public function testFederatedSharingOutgoing() { + public function testFederatedSharingOutgoing(): void { $map = [ ['files_sharing', 'outgoing_server2server_share_enabled', 'yes', 'yes'], ]; @@ -305,7 +305,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertTrue($result['federation']['outgoing']); } - public function testFederatedSharingNoOutgoing() { + public function testFederatedSharingNoOutgoing(): void { $map = [ ['files_sharing', 'outgoing_server2server_share_enabled', 'yes', 'no'], ]; @@ -314,7 +314,7 @@ class CapabilitiesTest extends \Test\TestCase { $this->assertFalse($result['federation']['outgoing']); } - public function testFederatedSharingExpirationDate() { + public function testFederatedSharingExpirationDate(): void { $result = $this->getResults([]); $this->assertArrayHasKey('federation', $result); $this->assertEquals(['enabled' => true], $result['federation']['expire_date']); diff --git a/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php b/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php index 309bb84d6df..83dde42f37b 100644 --- a/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php +++ b/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php @@ -38,7 +38,7 @@ class ShareRecipientSorterTest extends TestCase { * @dataProvider sortDataProvider * @param $data */ - public function testSort($data) { + public function testSort($data): void { $node = $this->createMock(Node::class); /** @var Folder|\PHPUnit\Framework\MockObject\MockObject $folder */ @@ -79,7 +79,7 @@ class ShareRecipientSorterTest extends TestCase { $this->assertEquals($data['expected'], $workArray); } - public function testSortNoNodes() { + public function testSortNoNodes(): void { /** @var Folder|\PHPUnit\Framework\MockObject\MockObject $folder */ $folder = $this->createMock(Folder::class); $this->rootFolder->expects($this->any()) diff --git a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php index 803ee1d02c9..05b412a60b6 100644 --- a/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php +++ b/apps/files_sharing/tests/Command/CleanupRemoteStoragesTest.php @@ -163,7 +163,7 @@ class CleanupRemoteStoragesTest extends TestCase { /** * Test cleanup of orphaned storages */ - public function testCleanup() { + public function testCleanup(): void { $input = $this->getMockBuilder(InputInterface::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php b/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php index 3b4173ba7fa..eac37a3f3a5 100644 --- a/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ExternalShareControllerTest.php @@ -53,7 +53,7 @@ class ExternalShareControllerTest extends \Test\TestCase { ); } - public function testIndex() { + public function testIndex(): void { $this->externalManager ->expects($this->once()) ->method('getOpenShares') @@ -62,7 +62,7 @@ class ExternalShareControllerTest extends \Test\TestCase { $this->assertEquals(new JSONResponse(['MyDummyArray']), $this->getExternalShareController()->index()); } - public function testCreate() { + public function testCreate(): void { $this->externalManager ->expects($this->once()) ->method('acceptShare') @@ -71,7 +71,7 @@ class ExternalShareControllerTest extends \Test\TestCase { $this->assertEquals(new JSONResponse(), $this->getExternalShareController()->create(4)); } - public function testDestroy() { + public function testDestroy(): void { $this->externalManager ->expects($this->once()) ->method('declineShare') @@ -80,7 +80,7 @@ class ExternalShareControllerTest extends \Test\TestCase { $this->assertEquals(new JSONResponse(), $this->getExternalShareController()->destroy(4)); } - public function testRemoteWithValidHttps() { + public function testRemoteWithValidHttps(): void { $client = $this->createMock(IClient::class); $response = $this->createMock(IResponse::class); $response @@ -103,7 +103,7 @@ class ExternalShareControllerTest extends \Test\TestCase { $this->assertEquals(new DataResponse('https'), $this->getExternalShareController()->testRemote('nextcloud.com')); } - public function testRemoteWithWorkingHttp() { + public function testRemoteWithWorkingHttp(): void { $client = $this->createMock(IClient::class); $response = $this->createMock(IResponse::class); $client @@ -127,7 +127,7 @@ class ExternalShareControllerTest extends \Test\TestCase { $this->assertEquals(new DataResponse('http'), $this->getExternalShareController()->testRemote('nextcloud.com')); } - public function testRemoteWithInvalidRemote() { + public function testRemoteWithInvalidRemote(): void { $client = $this->createMock(IClient::class); $response = $this->createMock(IResponse::class); $client @@ -158,7 +158,7 @@ class ExternalShareControllerTest extends \Test\TestCase { * @dataProvider dataRemoteWithInvalidRemoteURLs * @param string $remote */ - public function testRemoteWithInvalidRemoteURLs(string $remote) { + public function testRemoteWithInvalidRemoteURLs(string $remote): void { $this->clientService ->expects($this->never()) ->method('newClient'); diff --git a/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php b/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php index d1e542cc5d9..700406c97ba 100644 --- a/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php +++ b/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php @@ -57,28 +57,28 @@ class PublicPreviewControllerTest extends TestCase { ); } - public function testInvalidToken() { + public function testInvalidToken(): void { $res = $this->controller->getPreview('', 'file', 10, 10, ''); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } - public function testInvalidWidth() { + public function testInvalidWidth(): void { $res = $this->controller->getPreview('token', 'file', 0); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } - public function testInvalidHeight() { + public function testInvalidHeight(): void { $res = $this->controller->getPreview('token', 'file', 10, 0); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } - public function testInvalidShare() { + public function testInvalidShare(): void { $this->shareManager->method('getShareByToken') ->with($this->equalTo('token')) ->willThrowException(new ShareNotFound()); @@ -89,7 +89,7 @@ class PublicPreviewControllerTest extends TestCase { $this->assertEquals($expected, $res); } - public function testShareNotAccessable() { + public function testShareNotAccessable(): void { $share = $this->createMock(IShare::class); $this->shareManager->method('getShareByToken') ->with($this->equalTo('token')) @@ -104,7 +104,7 @@ class PublicPreviewControllerTest extends TestCase { $this->assertEquals($expected, $res); } - public function testPreviewFile() { + public function testPreviewFile(): void { $share = $this->createMock(IShare::class); $this->shareManager->method('getShareByToken') ->with($this->equalTo('token')) @@ -133,7 +133,7 @@ class PublicPreviewControllerTest extends TestCase { $this->assertEquals($expected, $res); } - public function testPreviewFolderInvalidFile() { + public function testPreviewFolderInvalidFile(): void { $share = $this->createMock(IShare::class); $this->shareManager->method('getShareByToken') ->with($this->equalTo('token')) @@ -156,7 +156,7 @@ class PublicPreviewControllerTest extends TestCase { } - public function testPreviewFolderValidFile() { + public function testPreviewFolderValidFile(): void { $share = $this->createMock(IShare::class); $this->shareManager->method('getShareByToken') ->with($this->equalTo('token')) diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index fd1c60ff842..f28302b4ccd 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -174,7 +174,7 @@ class ShareAPIControllerTest extends TestCase { return [$shareAttributes, \json_encode($formattedShareAttributes)]; } - public function testDeleteShareShareNotFound() { + public function testDeleteShareShareNotFound(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Wrong share ID, share does not exist'); @@ -194,7 +194,7 @@ class ShareAPIControllerTest extends TestCase { $this->ocs->deleteShare(42); } - public function testDeleteShare() { + public function testDeleteShare(): void { $node = $this->getMockBuilder(File::class)->getMock(); $share = $this->newShare(); @@ -222,7 +222,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testDeleteShareLocked() { + public function testDeleteShareLocked(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Could not delete share'); @@ -256,7 +256,7 @@ class ShareAPIControllerTest extends TestCase { /** * You can always remove a share that was shared with you */ - public function testDeleteShareWithMe() { + public function testDeleteShareWithMe(): void { $node = $this->getMockBuilder(File::class)->getMock(); $share = $this->newShare(); @@ -288,7 +288,7 @@ class ShareAPIControllerTest extends TestCase { /** * You can always delete a share you own */ - public function testDeleteShareOwner() { + public function testDeleteShareOwner(): void { $node = $this->getMockBuilder(File::class)->getMock(); $share = $this->newShare(); @@ -320,7 +320,7 @@ class ShareAPIControllerTest extends TestCase { * You can always delete a share when you own * the file path it belong to */ - public function testDeleteShareFileOwner() { + public function testDeleteShareFileOwner(): void { $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(1); @@ -353,7 +353,7 @@ class ShareAPIControllerTest extends TestCase { * You can remove (the mountpoint, not the share) * a share if you're in the group the share is shared with */ - public function testDeleteSharedWithMyGroup() { + public function testDeleteSharedWithMyGroup(): void { $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(1); @@ -413,7 +413,7 @@ class ShareAPIControllerTest extends TestCase { * You cannot remove a share if you're not * in the group the share is shared with */ - public function testDeleteSharedWithGroupIDontBelongTo() { + public function testDeleteSharedWithGroupIDontBelongTo(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Wrong share ID, share does not exist'); @@ -730,7 +730,7 @@ class ShareAPIControllerTest extends TestCase { /** * @dataProvider dataGetShare */ - public function testGetShare(\OCP\Share\IShare $share, array $result) { + public function testGetShare(\OCP\Share\IShare $share, array $result): void { /** @var ShareAPIController|\PHPUnit\Framework\MockObject\MockObject $ocs */ $ocs = $this->getMockBuilder(ShareAPIController::class) ->setConstructorArgs([ @@ -819,7 +819,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testGetShareInvalidNode() { + public function testGetShareInvalidNode(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Wrong share ID, share does not exist'); @@ -1364,7 +1364,7 @@ class ShareAPIControllerTest extends TestCase { /** * @dataProvider dataGetShares */ - public function testGetShares(array $getSharesParameters, array $shares, array $extraShareTypes, array $expected) { + public function testGetShares(array $getSharesParameters, array $shares, array $extraShareTypes, array $expected): void { /** @var \OCA\Files_Sharing\Controller\ShareAPIController $ocs */ $ocs = $this->getMockBuilder(ShareAPIController::class) ->setConstructorArgs([ @@ -1445,7 +1445,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected, $result->getData()); } - public function testCanAccessShare() { + public function testCanAccessShare(): void { $share = $this->getMockBuilder(IShare::class)->getMock(); $share->method('getShareOwner')->willReturn($this->currentUser); $this->assertTrue($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); @@ -1556,7 +1556,7 @@ class ShareAPIControllerTest extends TestCase { * @param bool helperAvailable * @param bool canAccessShareByHelper */ - public function testCanAccessRoomShare(bool $expected, \OCP\Share\IShare $share, bool $helperAvailable, bool $canAccessShareByHelper) { + public function testCanAccessRoomShare(bool $expected, \OCP\Share\IShare $share, bool $helperAvailable, bool $canAccessShareByHelper): void { $userFolder = $this->getMockBuilder(Folder::class)->getMock(); $this->rootFolder->method('getUserFolder') ->with($this->currentUser) @@ -1591,7 +1591,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareNoPath() { + public function testCreateShareNoPath(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Please specify a file or folder path'); @@ -1599,7 +1599,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareInvalidPath() { + public function testCreateShareInvalidPath(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Wrong path, file/folder does not exist'); @@ -1618,7 +1618,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareInvalidPermissions() { + public function testCreateShareInvalidPermissions(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Invalid permissions'); @@ -1647,7 +1647,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareUserNoShareWith() { + public function testCreateShareUserNoShareWith(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Please specify a valid account to share with'); @@ -1675,7 +1675,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareUserNoValidShareWith() { + public function testCreateShareUserNoValidShareWith(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Please specify a valid account to share with'); @@ -1704,7 +1704,7 @@ class ShareAPIControllerTest extends TestCase { $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_USER, 'invalidUser'); } - public function testCreateShareUser() { + public function testCreateShareUser(): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); @@ -1773,7 +1773,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareGroupNoValidShareWith() { + public function testCreateShareGroupNoValidShareWith(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Please specify a valid group'); @@ -1802,7 +1802,7 @@ class ShareAPIControllerTest extends TestCase { $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_GROUP, 'invalidGroup'); } - public function testCreateShareGroup() { + public function testCreateShareGroup(): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); @@ -1880,7 +1880,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareGroupNotAllowed() { + public function testCreateShareGroupNotAllowed(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Group sharing is disabled by the administrator'); @@ -1910,7 +1910,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareLinkNoLinksAllowed() { + public function testCreateShareLinkNoLinksAllowed(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Public link sharing is disabled by the administrator'); @@ -1941,7 +1941,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareLinkNoPublicUpload() { + public function testCreateShareLinkNoPublicUpload(): void { $this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class); $this->expectExceptionMessage('Public upload disabled by the administrator'); @@ -1966,7 +1966,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareLinkPublicUploadFile() { + public function testCreateShareLinkPublicUploadFile(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Public upload is only possible for publicly shared folders'); @@ -1991,7 +1991,7 @@ class ShareAPIControllerTest extends TestCase { $this->ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'true'); } - public function testCreateShareLinkPublicUploadFolder() { + public function testCreateShareLinkPublicUploadFolder(): void { $ocs = $this->mockFormatShare(); $path = $this->getMockBuilder(Folder::class)->getMock(); @@ -2030,7 +2030,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareLinkPassword() { + public function testCreateShareLinkPassword(): void { $ocs = $this->mockFormatShare(); $path = $this->getMockBuilder(Folder::class)->getMock(); @@ -2069,7 +2069,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareLinkSendPasswordByTalk() { + public function testCreateShareLinkSendPasswordByTalk(): void { $ocs = $this->mockFormatShare(); $path = $this->getMockBuilder(Folder::class)->getMock(); @@ -2112,7 +2112,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareLinkSendPasswordByTalkWithTalkDisabled() { + public function testCreateShareLinkSendPasswordByTalkWithTalkDisabled(): void { $this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class); $this->expectExceptionMessage('Sharing valid-path sending the password by Nextcloud Talk failed because Nextcloud Talk is not enabled'); @@ -2144,7 +2144,7 @@ class ShareAPIControllerTest extends TestCase { $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', 'password', 'true', ''); } - public function testCreateShareValidExpireDate() { + public function testCreateShareValidExpireDate(): void { $ocs = $this->mockFormatShare(); $this->request @@ -2197,7 +2197,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareInvalidExpireDate() { + public function testCreateShareInvalidExpireDate(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Invalid date, date format must be YYYY-MM-DD'); @@ -2224,7 +2224,7 @@ class ShareAPIControllerTest extends TestCase { $ocs->createShare('valid-path', \OCP\Constants::PERMISSION_ALL, IShare::TYPE_LINK, null, 'false', '', null, 'a1b2d3'); } - public function testCreateShareRemote() { + public function testCreateShareRemote(): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); @@ -2294,7 +2294,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareRemoteGroup() { + public function testCreateShareRemoteGroup(): void { $share = $this->newShare(); $this->shareManager->method('newShare')->willReturn($share); @@ -2364,7 +2364,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testCreateShareRoom() { + public function testCreateShareRoom(): void { $ocs = $this->mockFormatShare(); $share = $this->newShare(); @@ -2439,7 +2439,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareRoomHelperNotAvailable() { + public function testCreateShareRoomHelperNotAvailable(): void { $this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class); $this->expectExceptionMessage('Sharing valid-path failed because the back end does not support room shares'); @@ -2476,7 +2476,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testCreateShareRoomHelperThrowException() { + public function testCreateShareRoomHelperThrowException(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Exception thrown by the helper'); @@ -2537,7 +2537,7 @@ class ShareAPIControllerTest extends TestCase { * Test for https://github.com/owncloud/core/issues/22587 * TODO: Remove once proper solution is in place */ - public function testCreateReshareOfFederatedMountNoDeletePermissions() { + public function testCreateReshareOfFederatedMountNoDeletePermissions(): void { $share = \OC::$server->getShareManager()->newShare(); $this->shareManager->method('newShare')->willReturn($share); @@ -2605,7 +2605,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testUpdateShareCantAccess() { + public function testUpdateShareCantAccess(): void { $this->expectException(\OCP\AppFramework\OCS\OCSNotFoundException::class); $this->expectExceptionMessage('Wrong share ID, share does not exist'); @@ -2631,7 +2631,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testUpdateNoParametersLink() { + public function testUpdateNoParametersLink(): void { $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class); $this->expectExceptionMessage('Wrong or no update parameter given'); @@ -2652,7 +2652,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testUpdateNoParametersOther() { + public function testUpdateNoParametersOther(): void { $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class); $this->expectExceptionMessage('Wrong or no update parameter given'); @@ -2672,7 +2672,7 @@ class ShareAPIControllerTest extends TestCase { $this->ocs->updateShare(42); } - public function testUpdateLinkShareClear() { + public function testUpdateLinkShareClear(): void { $ocs = $this->mockFormatShare(); [$userFolder, $node] = $this->getNonSharedUserFolder(); @@ -2733,7 +2733,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkShareSet() { + public function testUpdateLinkShareSet(): void { $ocs = $this->mockFormatShare(); [$userFolder, $folder] = $this->getNonSharedUserFolder(); @@ -2790,7 +2790,7 @@ class ShareAPIControllerTest extends TestCase { /** * @dataProvider publicUploadParamsProvider */ - public function testUpdateLinkShareEnablePublicUpload($permissions, $publicUpload, $expireDate, $password) { + public function testUpdateLinkShareEnablePublicUpload($permissions, $publicUpload, $expireDate, $password): void { $ocs = $this->mockFormatShare(); [$userFolder, $folder] = $this->getNonSharedUserFolder(); @@ -2851,7 +2851,7 @@ class ShareAPIControllerTest extends TestCase { /** * @dataProvider publicLinkValidPermissionsProvider */ - public function testUpdateLinkShareSetCRUDPermissions($permissions) { + public function testUpdateLinkShareSetCRUDPermissions($permissions): void { $ocs = $this->mockFormatShare(); [$userFolder, $folder] = $this->getNonSharedUserFolder(); @@ -2906,7 +2906,7 @@ class ShareAPIControllerTest extends TestCase { /** * @dataProvider publicLinkInvalidPermissionsProvider1 */ - public function testUpdateLinkShareSetInvalidCRUDPermissions1($permissions) { + public function testUpdateLinkShareSetInvalidCRUDPermissions1($permissions): void { $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class); $this->expectExceptionMessage('Share must at least have READ or CREATE permissions'); @@ -2923,14 +2923,14 @@ class ShareAPIControllerTest extends TestCase { /** * @dataProvider publicLinkInvalidPermissionsProvider2 */ - public function testUpdateLinkShareSetInvalidCRUDPermissions2($permissions) { + public function testUpdateLinkShareSetInvalidCRUDPermissions2($permissions): void { $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class); $this->expectExceptionMessage('Share must have READ permission if UPDATE or DELETE permission is set'); $this->testUpdateLinkShareSetCRUDPermissions($permissions); } - public function testUpdateLinkShareInvalidDate() { + public function testUpdateLinkShareInvalidDate(): void { $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class); $this->expectExceptionMessage('Invalid date. Format must be YYYY-MM-DD'); @@ -2977,7 +2977,7 @@ class ShareAPIControllerTest extends TestCase { /** * @dataProvider publicUploadParamsProvider */ - public function testUpdateLinkSharePublicUploadNotAllowed($permissions, $publicUpload, $expireDate, $password) { + public function testUpdateLinkSharePublicUploadNotAllowed($permissions, $publicUpload, $expireDate, $password): void { $this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class); $this->expectExceptionMessage('Public upload disabled by the administrator'); @@ -3005,7 +3005,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testUpdateLinkSharePublicUploadOnFile() { + public function testUpdateLinkSharePublicUploadOnFile(): void { $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class); $this->expectExceptionMessage('Public upload is only possible for publicly shared folders'); @@ -3086,7 +3086,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkShareSendPasswordByTalkDoesNotChangeOther() { + public function testUpdateLinkShareSendPasswordByTalkDoesNotChangeOther(): void { $ocs = $this->mockFormatShare(); $date = new \DateTime('2000-01-01'); @@ -3141,7 +3141,7 @@ class ShareAPIControllerTest extends TestCase { } - public function testUpdateLinkShareSendPasswordByTalkWithTalkDisabledDoesNotChangeOther() { + public function testUpdateLinkShareSendPasswordByTalkWithTalkDisabledDoesNotChangeOther(): void { $this->expectException(\OCP\AppFramework\OCS\OCSForbiddenException::class); $this->expectExceptionMessage('"Sending the password by Nextcloud Talk" for sharing a file or folder failed because Nextcloud Talk is not enabled.'); @@ -3184,7 +3184,7 @@ class ShareAPIControllerTest extends TestCase { $ocs->updateShare(42, null, null, 'true', null, null, null, null, null); } - public function testUpdateLinkShareDoNotSendPasswordByTalkDoesNotChangeOther() { + public function testUpdateLinkShareDoNotSendPasswordByTalkDoesNotChangeOther(): void { $ocs = $this->mockFormatShare(); $date = new \DateTime('2000-01-01'); @@ -3238,7 +3238,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkShareDoNotSendPasswordByTalkWithTalkDisabledDoesNotChangeOther() { + public function testUpdateLinkShareDoNotSendPasswordByTalkWithTalkDisabledDoesNotChangeOther(): void { $ocs = $this->mockFormatShare(); $date = new \DateTime('2000-01-01'); @@ -3308,7 +3308,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkShareExpireDateDoesNotChangeOther() { + public function testUpdateLinkShareExpireDateDoesNotChangeOther(): void { $ocs = $this->mockFormatShare(); [$userFolder, $node] = $this->getNonSharedUserFolder(); @@ -3370,7 +3370,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkSharePublicUploadDoesNotChangeOther() { + public function testUpdateLinkSharePublicUploadDoesNotChangeOther(): void { $ocs = $this->mockFormatShare(); $date = new \DateTime('2000-01-01'); @@ -3431,7 +3431,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkSharePermissions() { + public function testUpdateLinkSharePermissions(): void { $ocs = $this->mockFormatShare(); $date = new \DateTime('2000-01-01'); @@ -3491,7 +3491,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateLinkSharePermissionsShare() { + public function testUpdateLinkSharePermissionsShare(): void { $ocs = $this->mockFormatShare(); $date = new \DateTime('2000-01-01'); @@ -3551,7 +3551,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateOtherPermissions() { + public function testUpdateOtherPermissions(): void { $ocs = $this->mockFormatShare(); [$userFolder, $file] = $this->getNonSharedUserFolder(); @@ -3597,7 +3597,7 @@ class ShareAPIControllerTest extends TestCase { $this->assertEquals($expected->getData(), $result->getData()); } - public function testUpdateShareCannotIncreasePermissions() { + public function testUpdateShareCannotIncreasePermissions(): void { $ocs = $this->mockFormatShare(); [$userFolder, $folder] = $this->getNonSharedUserFolder(); @@ -3669,7 +3669,7 @@ class ShareAPIControllerTest extends TestCase { } } - public function testUpdateShareCanIncreasePermissionsIfOwner() { + public function testUpdateShareCanIncreasePermissionsIfOwner(): void { $ocs = $this->mockFormatShare(); [$userFolder, $folder] = $this->getNonSharedUserFolder(); @@ -4665,7 +4665,7 @@ class ShareAPIControllerTest extends TestCase { * @param array $users * @param $exception */ - public function testFormatShare(array $expects, \OCP\Share\IShare $share, array $users, $exception) { + public function testFormatShare(array $expects, \OCP\Share\IShare $share, array $users, $exception): void { $this->userManager->method('get')->willReturnMap($users); $recipientGroup = $this->createMock(IGroup::class); @@ -4882,7 +4882,7 @@ class ShareAPIControllerTest extends TestCase { * @param bool $helperAvailable * @param array $formatShareByHelper */ - public function testFormatRoomShare(array $expects, \OCP\Share\IShare $share, bool $helperAvailable, array $formatShareByHelper) { + public function testFormatRoomShare(array $expects, \OCP\Share\IShare $share, bool $helperAvailable, array $formatShareByHelper): void { $this->rootFolder->method('getUserFolder') ->with($this->currentUser) ->willReturnSelf(); diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php index 09b02be5f66..cfe9d935f7f 100644 --- a/apps/files_sharing/tests/Controller/ShareControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php @@ -165,7 +165,7 @@ class ShareControllerTest extends \Test\TestCase { parent::tearDown(); } - public function testShowShareInvalidToken() { + public function testShowShareInvalidToken(): void { $this->shareController->setToken('invalidtoken'); $this->shareManager @@ -180,7 +180,7 @@ class ShareControllerTest extends \Test\TestCase { $this->shareController->showShare(); } - public function testShowShareNotAuthenticated() { + public function testShowShareNotAuthenticated(): void { $this->shareController->setToken('validtoken'); $share = \OC::$server->getShareManager()->newShare(); @@ -199,7 +199,7 @@ class ShareControllerTest extends \Test\TestCase { } - public function testShowShare() { + public function testShowShare(): void { $note = 'personal note'; $filename = 'file1.txt'; @@ -347,7 +347,7 @@ class ShareControllerTest extends \Test\TestCase { $this->assertEquals($expectedResponse, $response); } - public function testShowFileDropShare() { + public function testShowFileDropShare(): void { $filename = 'folder1'; $this->shareController->setToken('token'); @@ -484,7 +484,7 @@ class ShareControllerTest extends \Test\TestCase { $this->assertEquals($expectedResponse, $response); } - public function testShowShareWithPrivateName() { + public function testShowShareWithPrivateName(): void { $note = 'personal note'; $filename = 'file1.txt'; @@ -614,7 +614,7 @@ class ShareControllerTest extends \Test\TestCase { } - public function testShowShareInvalid() { + public function testShowShareInvalid(): void { $this->expectException(\OCP\Files\NotFoundException::class); $filename = 'file1.txt'; @@ -664,7 +664,7 @@ class ShareControllerTest extends \Test\TestCase { $this->shareController->showShare(); } - public function testDownloadShareWithCreateOnlyShare() { + public function testDownloadShareWithCreateOnlyShare(): void { $share = $this->getMockBuilder(IShare::class)->getMock(); $share->method('getPassword')->willReturn('password'); $share @@ -684,7 +684,7 @@ class ShareControllerTest extends \Test\TestCase { $this->assertEquals($expectedResponse, $response); } - public function testDisabledOwner() { + public function testDisabledOwner(): void { $this->shareController->setToken('token'); $owner = $this->getMockBuilder(IUser::class)->getMock(); @@ -725,7 +725,7 @@ class ShareControllerTest extends \Test\TestCase { $this->shareController->showShare(); } - public function testDisabledInitiator() { + public function testDisabledInitiator(): void { $this->shareController->setToken('token'); $owner = $this->getMockBuilder(IUser::class)->getMock(); diff --git a/apps/files_sharing/tests/Controller/ShareInfoControllerTest.php b/apps/files_sharing/tests/Controller/ShareInfoControllerTest.php index 59d7afc28d6..f2df74fd01b 100644 --- a/apps/files_sharing/tests/Controller/ShareInfoControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareInfoControllerTest.php @@ -41,7 +41,7 @@ class ShareInfoControllerTest extends TestCase { ->getMock(); } - public function testNoShare() { + public function testNoShare(): void { $this->shareManager->method('getShareByToken') ->with('token') ->willThrowException(new ShareNotFound()); @@ -51,7 +51,7 @@ class ShareInfoControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->info('token')); } - public function testWrongPassword() { + public function testWrongPassword(): void { $share = $this->createMock(IShare::class); $share->method('getPassword') ->willReturn('sharePass'); @@ -68,7 +68,7 @@ class ShareInfoControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->info('token', 'pass')); } - public function testNoReadPermissions() { + public function testNoReadPermissions(): void { $share = $this->createMock(IShare::class); $share->method('getPassword') ->willReturn('sharePass'); @@ -107,7 +107,7 @@ class ShareInfoControllerTest extends TestCase { return $file; } - public function testInfoFile() { + public function testInfoFile(): void { $file = $this->prepareFile(); $share = $this->createMock(IShare::class); @@ -139,7 +139,7 @@ class ShareInfoControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->info('token', 'pass')); } - public function testInfoFileRO() { + public function testInfoFileRO(): void { $file = $this->prepareFile(); $share = $this->createMock(IShare::class); @@ -221,7 +221,7 @@ class ShareInfoControllerTest extends TestCase { return $root; } - public function testInfoFolder() { + public function testInfoFolder(): void { $file = $this->prepareFolder(); $share = $this->createMock(IShare::class); diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php index f787607f5a8..bf02e8114df 100644 --- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php @@ -223,7 +223,7 @@ class ShareesAPIControllerTest extends TestCase { bool $shareWithGroupOnly, bool $shareeEnumeration, bool $allowGroupSharing, - ) { + ): void { $search = $getData['search'] ?? ''; $itemType = $getData['itemType'] ?? 'irrelevant'; $page = $getData['page'] ?? 1; @@ -333,7 +333,7 @@ class ShareesAPIControllerTest extends TestCase { * @param array $getData * @param string $message */ - public function testSearchInvalid($getData, $message) { + public function testSearchInvalid($getData, $message): void { $page = $getData['page'] ?? 1; $perPage = $getData['perPage'] ?? 200; @@ -391,11 +391,11 @@ class ShareesAPIControllerTest extends TestCase { * @param string $itemType * @param bool $expected */ - public function testIsRemoteSharingAllowed($itemType, $expected) { + public function testIsRemoteSharingAllowed($itemType, $expected): void { $this->assertSame($expected, $this->invokePrivate($this->sharees, 'isRemoteSharingAllowed', [$itemType])); } - public function testSearchSharingDisabled() { + public function testSearchSharingDisabled(): void { $this->shareManager->expects($this->once()) ->method('sharingDisabledForUser') ->with($this->uid) @@ -412,7 +412,7 @@ class ShareesAPIControllerTest extends TestCase { $this->assertInstanceOf(DataResponse::class, $this->sharees->search('', null, 1, 10, [], false)); } - public function testSearchNoItemType() { + public function testSearchNoItemType(): void { $this->expectException(\OCP\AppFramework\OCS\OCSBadRequestException::class); $this->expectExceptionMessage('Missing itemType'); @@ -434,7 +434,7 @@ class ShareesAPIControllerTest extends TestCase { * @param array $params * @param array $expected */ - public function testGetPaginationLink($page, $scriptName, $params, $expected) { + public function testGetPaginationLink($page, $scriptName, $params, $expected): void { $this->request->expects($this->once()) ->method('getScriptName') ->willReturn($scriptName); @@ -455,7 +455,7 @@ class ShareesAPIControllerTest extends TestCase { * @param string $scriptName * @param bool $expected */ - public function testIsV2($scriptName, $expected) { + public function testIsV2($scriptName, $expected): void { $this->request->expects($this->once()) ->method('getScriptName') ->willReturn($scriptName); diff --git a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php index 20365ebb842..e0d2d67d45f 100644 --- a/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php +++ b/apps/files_sharing/tests/DeleteOrphanedSharesJobTest.php @@ -107,7 +107,7 @@ class DeleteOrphanedSharesJobTest extends \Test\TestCase { /** * Test clearing orphaned shares */ - public function testClearShares() { + public function testClearShares(): void { $this->loginAsUser($this->user1); $user1Folder = \OC::$server->getUserFolder($this->user1); diff --git a/apps/files_sharing/tests/EtagPropagationTest.php b/apps/files_sharing/tests/EtagPropagationTest.php index 3f9ddfc413d..5a65b1b5389 100644 --- a/apps/files_sharing/tests/EtagPropagationTest.php +++ b/apps/files_sharing/tests/EtagPropagationTest.php @@ -171,7 +171,7 @@ class EtagPropagationTest extends PropagationTestCase { } } - public function testOwnerWritesToShare() { + public function testOwnerWritesToShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::file_put_contents('/sub1/sub2/folder/asd.txt', 'bar'); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4]); @@ -181,7 +181,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerWritesToSingleFileShare() { + public function testOwnerWritesToSingleFileShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::file_put_contents('/foo.txt', 'longer_bar'); $t = (int)Filesystem::filemtime('/foo.txt') - 1; @@ -192,7 +192,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerWritesToShareWithReshare() { + public function testOwnerWritesToShareWithReshare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::file_put_contents('/sub1/sub2/folder/inside/bar.txt', 'bar'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -201,7 +201,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerRenameInShare() { + public function testOwnerRenameInShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4]); Filesystem::rename('/sub1/sub2/folder/file.txt', '/sub1/sub2/folder/renamed.txt'); @@ -211,7 +211,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerRenameInReShare() { + public function testOwnerRenameInReShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::rename('/sub1/sub2/folder/inside/file.txt', '/sub1/sub2/folder/inside/renamed.txt'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -220,7 +220,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerRenameIntoReShare() { + public function testOwnerRenameIntoReShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::rename('/sub1/sub2/folder/file.txt', '/sub1/sub2/folder/inside/renamed.txt'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -229,7 +229,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerRenameOutOfReShare() { + public function testOwnerRenameOutOfReShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::rename('/sub1/sub2/folder/inside/file.txt', '/sub1/sub2/folder/renamed.txt'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -238,7 +238,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerDeleteInShare() { + public function testOwnerDeleteInShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::unlink('/sub1/sub2/folder/file.txt'); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4]); @@ -248,7 +248,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerDeleteInReShare() { + public function testOwnerDeleteInReShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::unlink('/sub1/sub2/folder/inside/file.txt'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -257,7 +257,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerUnshares() { + public function testOwnerUnshares(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); $folderInfo = $this->rootView->getFileInfo('/' . self::TEST_FILES_SHARING_API_USER1 . '/files/sub1/sub2/folder'); $this->assertInstanceOf('\OC\Files\FileInfo', $folderInfo); @@ -280,7 +280,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testOwnerUnsharesFlatReshares() { + public function testOwnerUnsharesFlatReshares(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); $folderInfo = $this->rootView->getFileInfo('/' . self::TEST_FILES_SHARING_API_USER1 . '/files/sub1/sub2/folder/inside'); $this->assertInstanceOf('\OC\Files\FileInfo', $folderInfo); @@ -301,7 +301,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientUnsharesFromSelf() { + public function testRecipientUnsharesFromSelf(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); $ls = $this->rootView->getDirectoryContent('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/sub1/sub2/'); $this->assertTrue( @@ -315,7 +315,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientWritesToShare() { + public function testRecipientWritesToShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); Filesystem::file_put_contents('/sub1/sub2/folder/asd.txt', 'bar'); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4]); @@ -328,7 +328,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientWritesToReshare() { + public function testRecipientWritesToReshare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); Filesystem::file_put_contents('/sub1/sub2/folder/inside/asd.txt', 'bar'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -337,7 +337,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientWritesToOtherRecipientsReshare() { + public function testRecipientWritesToOtherRecipientsReshare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER3); Filesystem::file_put_contents('/sub1/sub2/folder/inside/asd.txt', 'bar'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -346,7 +346,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientRenameInShare() { + public function testRecipientRenameInShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); Filesystem::rename('/sub1/sub2/folder/file.txt', '/sub1/sub2/folder/renamed.txt'); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4]); @@ -356,7 +356,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientRenameInReShare() { + public function testRecipientRenameInReShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); Filesystem::rename('/sub1/sub2/folder/inside/file.txt', '/sub1/sub2/folder/inside/renamed.txt'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -365,7 +365,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientRenameResharedFolder() { + public function testRecipientRenameResharedFolder(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); Filesystem::rename('/directReshare', '/sub1/directReshare'); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER3, self::TEST_FILES_SHARING_API_USER4]); @@ -376,7 +376,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientDeleteInShare() { + public function testRecipientDeleteInShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); Filesystem::unlink('/sub1/sub2/folder/file.txt'); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER4]); @@ -386,7 +386,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientDeleteInReShare() { + public function testRecipientDeleteInReShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); Filesystem::unlink('/sub1/sub2/folder/inside/file.txt'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -395,7 +395,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testReshareRecipientWritesToReshare() { + public function testReshareRecipientWritesToReshare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER4); Filesystem::file_put_contents('/sub1/sub2/inside/asd.txt', 'bar'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -404,7 +404,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testReshareRecipientRenameInReShare() { + public function testReshareRecipientRenameInReShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER4); Filesystem::rename('/sub1/sub2/inside/file.txt', '/sub1/sub2/inside/renamed.txt'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -413,7 +413,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testReshareRecipientDeleteInReShare() { + public function testReshareRecipientDeleteInReShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER4); Filesystem::unlink('/sub1/sub2/inside/file.txt'); $this->assertEtagsForFoldersChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, @@ -422,7 +422,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientUploadInDirectReshare() { + public function testRecipientUploadInDirectReshare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); Filesystem::file_put_contents('/directReshare/test.txt', 'sad'); $this->assertEtagsNotChanged([self::TEST_FILES_SHARING_API_USER3]); @@ -431,7 +431,7 @@ class EtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testEtagChangeOnPermissionsChange() { + public function testEtagChangeOnPermissionsChange(): void { $userFolder = $this->rootFolder->getUserFolder(self::TEST_FILES_SHARING_API_USER1); $node = $userFolder->get('/sub1/sub2/folder'); diff --git a/apps/files_sharing/tests/ExpireSharesJobTest.php b/apps/files_sharing/tests/ExpireSharesJobTest.php index e6383d12ded..cf7be7b20a0 100644 --- a/apps/files_sharing/tests/ExpireSharesJobTest.php +++ b/apps/files_sharing/tests/ExpireSharesJobTest.php @@ -107,7 +107,7 @@ class ExpireSharesJobTest extends \Test\TestCase { * @param bool $addInterval If true add to the current time if false subtract * @param bool $shouldExpire Should this share be expired */ - public function testExpireLinkShare($addExpiration, $interval, $addInterval, $shouldExpire) { + public function testExpireLinkShare($addExpiration, $interval, $addInterval, $shouldExpire): void { $this->loginAsUser($this->user1); $user1Folder = \OC::$server->getUserFolder($this->user1); @@ -164,7 +164,7 @@ class ExpireSharesJobTest extends \Test\TestCase { } } - public function testDoNotExpireOtherShares() { + public function testDoNotExpireOtherShares(): void { $this->loginAsUser($this->user1); $user1Folder = \OC::$server->getUserFolder($this->user1); diff --git a/apps/files_sharing/tests/External/CacheTest.php b/apps/files_sharing/tests/External/CacheTest.php index 6259fc98e1f..2fb99e15715 100644 --- a/apps/files_sharing/tests/External/CacheTest.php +++ b/apps/files_sharing/tests/External/CacheTest.php @@ -91,7 +91,7 @@ class CacheTest extends TestCase { parent::tearDown(); } - public function testGetInjectsOwnerDisplayName() { + public function testGetInjectsOwnerDisplayName(): void { $info = $this->cache->get('test.txt'); $this->assertEquals( $this->remoteUser . '@example.com/owncloud', @@ -99,12 +99,12 @@ class CacheTest extends TestCase { ); } - public function testGetReturnsFalseIfNotFound() { + public function testGetReturnsFalseIfNotFound(): void { $info = $this->cache->get('unexisting-entry.txt'); $this->assertFalse($info); } - public function testGetFolderPopulatesOwner() { + public function testGetFolderPopulatesOwner(): void { $dirId = $this->cache->put( 'subdir', [ diff --git a/apps/files_sharing/tests/External/ManagerTest.php b/apps/files_sharing/tests/External/ManagerTest.php index 0687d567453..7302fd307f2 100644 --- a/apps/files_sharing/tests/External/ManagerTest.php +++ b/apps/files_sharing/tests/External/ManagerTest.php @@ -181,7 +181,7 @@ class ManagerTest extends TestCase { $this->mountManager->addMount(new MountPoint(Temporary::class, '', [])); } - public function testAddUserShare() { + public function testAddUserShare(): void { $this->doTestAddShare([ 'remote' => 'http://localhost', 'token' => 'token1', @@ -195,7 +195,7 @@ class ManagerTest extends TestCase { ], false); } - public function testAddGroupShare() { + public function testAddGroupShare(): void { $this->doTestAddShare([ 'remote' => 'http://localhost', 'token' => 'token1', @@ -474,7 +474,7 @@ class ManagerTest extends TestCase { return [$shareData, $groupShare]; } - public function testAcceptOriginalGroupShare() { + public function testAcceptOriginalGroupShare(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); $this->assertTrue($this->manager->acceptShare($groupShare['id'])); $this->verifyAcceptedGroupShare($shareData); @@ -484,7 +484,7 @@ class ManagerTest extends TestCase { $this->verifyAcceptedGroupShare($shareData); } - public function testAcceptGroupShareAgainThroughGroupShare() { + public function testAcceptGroupShareAgainThroughGroupShare(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); $this->assertTrue($this->manager->acceptShare($groupShare['id'])); $this->verifyAcceptedGroupShare($shareData); @@ -506,7 +506,7 @@ class ManagerTest extends TestCase { $this->verifyAcceptedGroupShare($shareData, '/SharedFolder'); } - public function testAcceptGroupShareAgainThroughSubShare() { + public function testAcceptGroupShareAgainThroughSubShare(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); $this->assertTrue($this->manager->acceptShare($groupShare['id'])); $this->verifyAcceptedGroupShare($shareData); @@ -528,7 +528,7 @@ class ManagerTest extends TestCase { $this->verifyAcceptedGroupShare($shareData); } - public function testDeclineOriginalGroupShare() { + public function testDeclineOriginalGroupShare(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); $this->assertTrue($this->manager->declineShare($groupShare['id'])); $this->verifyDeclinedGroupShare($shareData); @@ -538,7 +538,7 @@ class ManagerTest extends TestCase { $this->verifyDeclinedGroupShare($shareData); } - public function testDeclineGroupShareAgainThroughGroupShare() { + public function testDeclineGroupShareAgainThroughGroupShare(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); $this->assertTrue($this->manager->acceptShare($groupShare['id'])); $this->verifyAcceptedGroupShare($shareData); @@ -552,7 +552,7 @@ class ManagerTest extends TestCase { $this->verifyDeclinedGroupShare($shareData, '/SharedFolder'); } - public function testDeclineGroupShareAgainThroughSubshare() { + public function testDeclineGroupShareAgainThroughSubshare(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); $this->assertTrue($this->manager->acceptShare($groupShare['id'])); $this->verifyAcceptedGroupShare($shareData); @@ -570,7 +570,7 @@ class ManagerTest extends TestCase { $this->verifyDeclinedGroupShare($shareData, '/SharedFolder'); } - public function testDeclineGroupShareAgainThroughMountPoint() { + public function testDeclineGroupShareAgainThroughMountPoint(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); $this->assertTrue($this->manager->acceptShare($groupShare['id'])); $this->verifyAcceptedGroupShare($shareData); @@ -583,7 +583,7 @@ class ManagerTest extends TestCase { $this->assertFalse($this->manager->removeShare($this->uid . '/files/' . $shareData['name'])); } - public function testDeclineThenAcceptGroupShareAgainThroughGroupShare() { + public function testDeclineThenAcceptGroupShareAgainThroughGroupShare(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); // decline, this creates a declined sub-share $this->assertTrue($this->manager->declineShare($groupShare['id'])); @@ -601,7 +601,7 @@ class ManagerTest extends TestCase { $this->verifyAcceptedGroupShare($shareData, '/SharedFolder'); } - public function testDeclineThenAcceptGroupShareAgainThroughSubShare() { + public function testDeclineThenAcceptGroupShareAgainThroughSubShare(): void { [$shareData, $groupShare] = $this->createTestGroupShare(); // decline, this creates a declined sub-share $this->assertTrue($this->manager->declineShare($groupShare['id'])); @@ -619,7 +619,7 @@ class ManagerTest extends TestCase { $this->verifyAcceptedGroupShare($shareData); } - public function testDeleteUserShares() { + public function testDeleteUserShares(): void { // user 1 shares $shareData = $this->createTestUserShare($this->uid); @@ -666,7 +666,7 @@ class ManagerTest extends TestCase { $this->assertEquals($user2Shares[1]['user'], 'user2'); } - public function testDeleteGroupShares() { + public function testDeleteGroupShares(): void { $shareData = $this->createTestUserShare($this->uid); [$shareData, $groupShare] = $this->createTestGroupShare(); diff --git a/apps/files_sharing/tests/External/ScannerTest.php b/apps/files_sharing/tests/External/ScannerTest.php index c828fd59a08..7daa5f229d2 100644 --- a/apps/files_sharing/tests/External/ScannerTest.php +++ b/apps/files_sharing/tests/External/ScannerTest.php @@ -35,7 +35,7 @@ class ScannerTest extends TestCase { $this->scanner = new Scanner($this->storage); } - public function testScan() { + public function testScan(): void { $this->storage->expects($this->any()) ->method('getShareInfo') ->willReturn(['status' => 'success', 'data' => []]); @@ -47,7 +47,7 @@ class ScannerTest extends TestCase { $this->addToAssertionCount(1); } - public function testScanFile() { + public function testScanFile(): void { // FIXME add real tests, we are currently only checking for // Declaration of OCA\Files_Sharing\External\Scanner::*() should be // compatible with OC\Files\Cache\Scanner::*() diff --git a/apps/files_sharing/tests/ExternalStorageTest.php b/apps/files_sharing/tests/ExternalStorageTest.php index 4d807526f0d..56a1f320030 100644 --- a/apps/files_sharing/tests/ExternalStorageTest.php +++ b/apps/files_sharing/tests/ExternalStorageTest.php @@ -89,12 +89,12 @@ class ExternalStorageTest extends \Test\TestCase { /** * @dataProvider optionsProvider */ - public function testStorageMountOptions($inputUri, $baseUri) { + public function testStorageMountOptions($inputUri, $baseUri): void { $storage = $this->getTestStorage($inputUri); $this->assertEquals($baseUri, $storage->getBaseUri()); } - public function testIfTestReturnsTheValue() { + public function testIfTestReturnsTheValue(): void { $result = $this->getTestStorage('https://remoteserver')->test(); $this->assertSame(true, $result); } diff --git a/apps/files_sharing/tests/GroupEtagPropagationTest.php b/apps/files_sharing/tests/GroupEtagPropagationTest.php index 280b091b5f7..9b2b63b0181 100644 --- a/apps/files_sharing/tests/GroupEtagPropagationTest.php +++ b/apps/files_sharing/tests/GroupEtagPropagationTest.php @@ -89,7 +89,7 @@ class GroupEtagPropagationTest extends PropagationTestCase { } } - public function testGroupReShareRecipientWrites() { + public function testGroupReShareRecipientWrites(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER3); Filesystem::file_put_contents('/test/sub/file.txt', 'asd'); @@ -99,7 +99,7 @@ class GroupEtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testGroupReShareSubFolderRecipientWrites() { + public function testGroupReShareSubFolderRecipientWrites(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER4); Filesystem::file_put_contents('/sub/file.txt', 'asd'); @@ -109,7 +109,7 @@ class GroupEtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientUnsharesFromSelf() { + public function testRecipientUnsharesFromSelf(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); $this->assertTrue( $this->rootView->unlink('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/test') @@ -119,7 +119,7 @@ class GroupEtagPropagationTest extends PropagationTestCase { $this->assertAllUnchanged(); } - public function testRecipientUnsharesFromSelfUniqueGroupShare() { + public function testRecipientUnsharesFromSelfUniqueGroupShare(): void { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); // rename to create an extra entry in the share table $this->rootView->rename('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/test', '/' . self::TEST_FILES_SHARING_API_USER2 . '/files/test_renamed'); diff --git a/apps/files_sharing/tests/HelperTest.php b/apps/files_sharing/tests/HelperTest.php index cc5c0d27e60..d72afc4d4aa 100644 --- a/apps/files_sharing/tests/HelperTest.php +++ b/apps/files_sharing/tests/HelperTest.php @@ -16,7 +16,7 @@ class HelperTest extends TestCase { /** * test set and get share folder */ - public function testSetGetShareFolder() { + public function testSetGetShareFolder(): void { $this->assertSame('/', \OCA\Files_Sharing\Helper::getShareFolder()); \OCA\Files_Sharing\Helper::setShareFolder('/Shared/Folder'); diff --git a/apps/files_sharing/tests/LockingTest.php b/apps/files_sharing/tests/LockingTest.php index 0ca204ef215..c69cf99f185 100644 --- a/apps/files_sharing/tests/LockingTest.php +++ b/apps/files_sharing/tests/LockingTest.php @@ -61,7 +61,7 @@ class LockingTest extends TestCase { } - public function testLockAsRecipient() { + public function testLockAsRecipient(): void { $this->expectException(\OCP\Lock\LockedException::class); $this->loginAsUser($this->ownerUid); @@ -73,7 +73,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 +84,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); diff --git a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php index b5c7e1ce890..30bae45f520 100644 --- a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php @@ -78,7 +78,7 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase { * @param bool $enabled * @param bool $exception */ - public function testBeforeController(Controller $controller, $enabled, $exception) { + public function testBeforeController(Controller $controller, $enabled, $exception): void { $this->shareManager->method('shareApiEnabled')->willReturn($enabled); try { @@ -109,7 +109,7 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase { * @param Controller $controller * @param bool $called */ - public function testAfterController(Controller $controller) { + 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 5ba21255a8d..88fa56a9bcb 100644 --- a/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php @@ -29,14 +29,14 @@ class ShareInfoMiddlewareTest extends TestCase { $this->middleware = new ShareInfoMiddleware($this->shareManager); } - public function testBeforeControllerNoShareInfo() { + public function testBeforeControllerNoShareInfo(): void { $this->shareManager->expects($this->never()) ->method($this->anything()); $this->middleware->beforeController($this->createMock(ShareInfoMiddlewareTestController::class), 'foo'); } - public function testBeforeControllerShareInfoNoS2s() { + public function testBeforeControllerShareInfoNoS2s(): void { $this->shareManager->expects($this->once()) ->method('outgoingServer2ServerSharesAllowed') ->willReturn(false); @@ -45,7 +45,7 @@ class ShareInfoMiddlewareTest extends TestCase { $this->middleware->beforeController($this->createMock(ShareInfoController::class), 'foo'); } - public function testBeforeControllerShareInfo() { + public function testBeforeControllerShareInfo(): void { $this->shareManager->expects($this->once()) ->method('outgoingServer2ServerSharesAllowed') ->willReturn(true); @@ -53,7 +53,7 @@ class ShareInfoMiddlewareTest extends TestCase { $this->middleware->beforeController($this->createMock(ShareInfoController::class), 'foo'); } - public function testAfterExceptionNoShareInfo() { + public function testAfterExceptionNoShareInfo(): void { $exeption = new \Exception(); try { @@ -65,7 +65,7 @@ class ShareInfoMiddlewareTest extends TestCase { } - public function testAfterExceptionNoS2S() { + public function testAfterExceptionNoS2S(): void { $exeption = new \Exception(); try { @@ -76,7 +76,7 @@ class ShareInfoMiddlewareTest extends TestCase { } } - public function testAfterExceptionS2S() { + public function testAfterExceptionS2S(): void { $expected = new JSONResponse([], Http::STATUS_NOT_FOUND); $this->assertEquals( @@ -85,7 +85,7 @@ class ShareInfoMiddlewareTest extends TestCase { ); } - public function testAfterControllerNoShareInfo() { + public function testAfterControllerNoShareInfo(): void { $response = $this->createMock(Http\Response::class); $this->assertEquals( @@ -94,7 +94,7 @@ class ShareInfoMiddlewareTest extends TestCase { ); } - public function testAfterControllerNoJSON() { + public function testAfterControllerNoJSON(): void { $response = $this->createMock(Http\Response::class); $this->assertEquals( @@ -103,7 +103,7 @@ class ShareInfoMiddlewareTest extends TestCase { ); } - public function testAfterControllerJSONok() { + public function testAfterControllerJSONok(): void { $data = ['foo' => 'bar']; $response = new JSONResponse($data); @@ -118,7 +118,7 @@ class ShareInfoMiddlewareTest extends TestCase { ); } - public function testAfterControllerJSONerror() { + public function testAfterControllerJSONerror(): void { $data = ['foo' => 'bar']; $response = new JSONResponse($data, Http::STATUS_FORBIDDEN); diff --git a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php index 580295a26ec..99fcb4eaea0 100644 --- a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php @@ -59,7 +59,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { $this->request); } - public function testIsSharingEnabledWithAppEnabled() { + public function testIsSharingEnabledWithAppEnabled(): void { $this->appManager ->expects($this->once()) ->method('isEnabledForUser') @@ -69,7 +69,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { $this->assertTrue(self::invokePrivate($this->sharingCheckMiddleware, 'isSharingEnabled')); } - public function testIsSharingEnabledWithAppDisabled() { + public function testIsSharingEnabledWithAppDisabled(): void { $this->appManager ->expects($this->once()) ->method('isEnabledForUser') @@ -117,7 +117,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { /** * @dataProvider externalSharesChecksDataProvider */ - public function testExternalSharesChecks($annotations, $config, $expectedResult) { + public function testExternalSharesChecks($annotations, $config, $expectedResult): void { $this->reflector ->expects($this->atLeastOnce()) ->method('hasAnnotation') @@ -133,7 +133,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { /** * @dataProvider externalSharesChecksDataProvider */ - public function testBeforeControllerWithExternalShareControllerWithSharingEnabled($annotations, $config, $noException) { + public function testBeforeControllerWithExternalShareControllerWithSharingEnabled($annotations, $config, $noException): void { $this->appManager ->expects($this->once()) ->method('isEnabledForUser') @@ -162,7 +162,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { $this->assertNotEquals($noException, $exceptionThrown); } - public function testBeforeControllerWithShareControllerWithSharingEnabled() { + public function testBeforeControllerWithShareControllerWithSharingEnabled(): void { $share = $this->createMock(IShare::class); $this->appManager @@ -177,7 +177,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { } - public function testBeforeControllerWithSharingDisabled() { + public function testBeforeControllerWithSharingDisabled(): void { $this->expectException(\OCP\Files\NotFoundException::class); $this->expectExceptionMessage('Sharing is disabled.'); @@ -191,18 +191,18 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { } - public function testAfterExceptionWithRegularException() { + public function testAfterExceptionWithRegularException(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('My Exception message'); $this->sharingCheckMiddleware->afterException($this->controllerMock, 'myMethod', new \Exception('My Exception message')); } - public function testAfterExceptionWithNotFoundException() { + public function testAfterExceptionWithNotFoundException(): void { $this->assertEquals(new NotFoundResponse(), $this->sharingCheckMiddleware->afterException($this->controllerMock, 'myMethod', new NotFoundException('My Exception message'))); } - public function testAfterExceptionWithS2SException() { + public function testAfterExceptionWithS2SException(): void { $this->assertEquals(new JSONResponse('My Exception message', 405), $this->sharingCheckMiddleware->afterException($this->controllerMock, 'myMethod', new S2SException('My Exception message'))); } } diff --git a/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php b/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php index eb377412a2e..e15914f6ba1 100644 --- a/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php +++ b/apps/files_sharing/tests/Migration/SetPasswordColumnTest.php @@ -50,7 +50,7 @@ class SetPasswordColumnTest extends TestCase { $query->delete($this->table)->execute(); } - public function testAddPasswordColumn() { + public function testAddPasswordColumn(): void { $this->config->expects($this->once()) ->method('getAppValue') ->with('files_sharing', 'installed_version', '0.0.0') diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php index f565d2e3656..2dc5365ae2b 100644 --- a/apps/files_sharing/tests/MountProviderTest.php +++ b/apps/files_sharing/tests/MountProviderTest.php @@ -113,7 +113,7 @@ class MountProviderTest extends \Test\TestCase { * - shares that were opted out of (permissions === 0) * - shares with a group in which the owner is already in */ - public function testExcludeShares() { + public function testExcludeShares(): void { $rootFolder = $this->createMock(IRootFolder::class); $userManager = $this->createMock(IUserManager::class); $attr1 = []; @@ -346,7 +346,7 @@ class MountProviderTest extends \Test\TestCase { * @param array $groupShares array of group share specs * @param array $expectedShares array of expected supershare specs */ - public function testMergeShares($userShares, $groupShares, $expectedShares, $moveFails = false) { + public function testMergeShares($userShares, $groupShares, $expectedShares, $moveFails = false): void { $rootFolder = $this->createMock(IRootFolder::class); $userManager = $this->createMock(IUserManager::class); diff --git a/apps/files_sharing/tests/ShareTest.php b/apps/files_sharing/tests/ShareTest.php index a1580c97fcf..651341a5607 100644 --- a/apps/files_sharing/tests/ShareTest.php +++ b/apps/files_sharing/tests/ShareTest.php @@ -48,7 +48,7 @@ class ShareTest extends TestCase { parent::tearDown(); } - public function testUnshareFromSelf() { + public function testUnshareFromSelf(): void { $groupManager = \OC::$server->getGroupManager(); $userManager = \OC::$server->getUserManager(); @@ -108,7 +108,7 @@ class ShareTest extends TestCase { } } - public function testShareWithDifferentShareFolder() { + public function testShareWithDifferentShareFolder(): void { $fileinfo = $this->view->getFileInfo($this->filename); $folderinfo = $this->view->getFileInfo($this->folder); @@ -139,7 +139,7 @@ class ShareTest extends TestCase { \OC::$server->getConfig()->deleteSystemValue('share_folder'); } - public function testShareWithGroupUniqueName() { + public function testShareWithGroupUniqueName(): void { $this->markTestSkipped('TODO: Disable because fails on drone'); $this->loginHelper(self::TEST_FILES_SHARING_API_USER1); @@ -182,7 +182,7 @@ class ShareTest extends TestCase { * shared files should never have delete permissions * @dataProvider dataProviderTestFileSharePermissions */ - public function testFileSharePermissions($permission, $expectedvalid) { + public function testFileSharePermissions($permission, $expectedvalid): void { $pass = true; try { $this->share( @@ -215,7 +215,7 @@ class ShareTest extends TestCase { ]; } - public function testFileOwner() { + public function testFileOwner(): void { $this->share( IShare::TYPE_USER, $this->filename, diff --git a/apps/files_sharing/tests/SharedMountTest.php b/apps/files_sharing/tests/SharedMountTest.php index c8d42460b8b..82c0770440d 100644 --- a/apps/files_sharing/tests/SharedMountTest.php +++ b/apps/files_sharing/tests/SharedMountTest.php @@ -65,7 +65,7 @@ class SharedMountTest extends TestCase { /** * test if the mount point moves up if the parent folder no longer exists */ - public function testShareMountLoseParentFolder() { + public function testShareMountLoseParentFolder(): void { // share to user $share = $this->share( @@ -97,7 +97,7 @@ class SharedMountTest extends TestCase { /** * @medium */ - public function testDeleteParentOfMountPoint() { + public function testDeleteParentOfMountPoint(): void { // share to user $share = $this->share( IShare::TYPE_USER, @@ -137,7 +137,7 @@ class SharedMountTest extends TestCase { $this->view->unlink($this->folder); } - public function testMoveSharedFile() { + public function testMoveSharedFile(): void { $share = $this->share( IShare::TYPE_USER, $this->filename, @@ -171,7 +171,7 @@ class SharedMountTest extends TestCase { * share file with a group if a user renames the file the filename should not change * for the other users */ - public function testMoveGroupShare() { + public function testMoveGroupShare(): void { $testGroup = $this->groupManager->createGroup('testGroup'); $user1 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER1); $user2 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER2); @@ -223,7 +223,7 @@ class SharedMountTest extends TestCase { * @param string $expectedResult * @param bool $exception if a exception is expected */ - public function testStripUserFilesPath($path, $expectedResult, $exception) { + public function testStripUserFilesPath($path, $expectedResult, $exception): void { $testClass = new DummyTestClassSharedMount(null, null); try { $result = $testClass->stripUserFilesPathDummy($path); @@ -252,7 +252,7 @@ class SharedMountTest extends TestCase { * If the permissions on a group share are upgraded be sure to still respect * removed shares by a member of that group */ - public function testPermissionUpgradeOnUserDeletedGroupShare() { + public function testPermissionUpgradeOnUserDeletedGroupShare(): void { $testGroup = $this->groupManager->createGroup('testGroup'); $user1 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER1); $user2 = $this->userManager->get(self::TEST_FILES_SHARING_API_USER2); @@ -314,7 +314,7 @@ class SharedMountTest extends TestCase { /** * test if the mount point gets renamed if a folder exists at the target */ - public function testShareMountOverFolder() { + public function testShareMountOverFolder(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER2); $this->view2->mkdir('bar'); @@ -349,7 +349,7 @@ class SharedMountTest extends TestCase { /** * test if the mount point gets renamed if another share exists at the target */ - public function testShareMountOverShare() { + public function testShareMountOverShare(): void { // create a shared cache $caches = []; $cacheFactory = $this->createMock(ICacheFactory::class); diff --git a/apps/files_sharing/tests/SharedStorageTest.php b/apps/files_sharing/tests/SharedStorageTest.php index 521167f1d88..5f907ad8de3 100644 --- a/apps/files_sharing/tests/SharedStorageTest.php +++ b/apps/files_sharing/tests/SharedStorageTest.php @@ -56,7 +56,7 @@ class SharedStorageTest extends TestCase { * * @medium */ - public function testParentOfMountPointIsGone() { + public function testParentOfMountPointIsGone(): void { // share to user $share = $this->share( @@ -101,7 +101,7 @@ class SharedStorageTest extends TestCase { /** * @medium */ - public function testRenamePartFile() { + public function testRenamePartFile(): void { // share to user $share = $this->share( @@ -139,7 +139,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testFilesize() { + public function testFilesize(): void { $folderSize = $this->view->filesize($this->folder); $file1Size = $this->view->filesize($this->folder . $this->filename); $file2Size = $this->view->filesize($this->filename); @@ -173,7 +173,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share2); } - public function testGetPermissions() { + public function testGetPermissions(): void { $share = $this->share( IShare::TYPE_USER, $this->folder, @@ -203,7 +203,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testFopenWithReadOnlyPermission() { + public function testFopenWithReadOnlyPermission(): void { $this->view->file_put_contents($this->folder . '/existing.txt', 'foo'); $share = $this->share( @@ -235,7 +235,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testFopenWithCreateOnlyPermission() { + public function testFopenWithCreateOnlyPermission(): void { $this->view->file_put_contents($this->folder . '/existing.txt', 'foo'); $fileinfoFolder = $this->view->getFileInfo($this->folder); @@ -282,7 +282,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testFopenWithUpdateOnlyPermission() { + public function testFopenWithUpdateOnlyPermission(): void { $this->view->file_put_contents($this->folder . '/existing.txt', 'foo'); $share = $this->share( @@ -328,7 +328,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testFopenWithDeleteOnlyPermission() { + public function testFopenWithDeleteOnlyPermission(): void { $this->view->file_put_contents($this->folder . '/existing.txt', 'foo'); $share = $this->share( @@ -360,7 +360,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testMountSharesOtherUser() { + public function testMountSharesOtherUser(): void { $rootView = new \OC\Files\View(''); self::loginHelper(self::TEST_FILES_SHARING_API_USER1); @@ -401,7 +401,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share2); } - public function testCopyFromStorage() { + public function testCopyFromStorage(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $share = $this->share( @@ -434,7 +434,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testMoveFromStorage() { + public function testMoveFromStorage(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $share = $this->share( @@ -467,7 +467,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testNameConflict() { + public function testNameConflict(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $view1 = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files'); $view1->mkdir('foo'); @@ -518,7 +518,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share2); } - public function testOwnerPermissions() { + public function testOwnerPermissions(): void { self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $share = $this->share( @@ -545,7 +545,7 @@ class SharedStorageTest extends TestCase { $this->shareManager->deleteShare($share); } - public function testInitWithNonExistingUser() { + public function testInitWithNonExistingUser(): void { $share = $this->createMock(IShare::class); $share->method('getShareOwner')->willReturn('unexist'); $ownerView = $this->createMock(View::class); @@ -561,7 +561,7 @@ class SharedStorageTest extends TestCase { $this->assertInstanceOf(\OC\Files\Cache\FailedCache::class, $storage->getCache()); } - public function testInitWithNotFoundSource() { + public function testInitWithNotFoundSource(): void { $share = $this->createMock(IShare::class); $share->method('getShareOwner')->willReturn(self::TEST_FILES_SHARING_API_USER1); $share->method('getNodeId')->willReturn(1); diff --git a/apps/files_sharing/tests/SizePropagationTest.php b/apps/files_sharing/tests/SizePropagationTest.php index 1112cb03425..de830c508cd 100644 --- a/apps/files_sharing/tests/SizePropagationTest.php +++ b/apps/files_sharing/tests/SizePropagationTest.php @@ -28,7 +28,7 @@ class SizePropagationTest extends TestCase { return new View('/' . $name . '/files'); } - public function testSizePropagationWhenOwnerChangesFile() { + public function testSizePropagationWhenOwnerChangesFile(): void { $recipientView = $this->setupUser(self::TEST_FILES_SHARING_API_USER1); $ownerView = $this->setupUser(self::TEST_FILES_SHARING_API_USER2); @@ -63,7 +63,7 @@ class SizePropagationTest extends TestCase { $this->assertEquals($ownerRootInfo->getSize() + 3, $newOwnerRootInfo->getSize()); } - public function testSizePropagationWhenRecipientChangesFile() { + public function testSizePropagationWhenRecipientChangesFile(): void { $recipientView = $this->setupUser(self::TEST_FILES_SHARING_API_USER1); $ownerView = $this->setupUser(self::TEST_FILES_SHARING_API_USER2); diff --git a/apps/files_sharing/tests/UnshareChildrenTest.php b/apps/files_sharing/tests/UnshareChildrenTest.php index 70445635e38..e95c1c68ecb 100644 --- a/apps/files_sharing/tests/UnshareChildrenTest.php +++ b/apps/files_sharing/tests/UnshareChildrenTest.php @@ -54,7 +54,7 @@ class UnshareChildrenTest extends TestCase { /** * @medium */ - public function testUnshareChildren() { + public function testUnshareChildren(): void { $fileInfo2 = \OC\Files\Filesystem::getFileInfo($this->folder); $this->share( diff --git a/apps/files_sharing/tests/UpdaterTest.php b/apps/files_sharing/tests/UpdaterTest.php index aeefbac5934..9d26ff873a5 100644 --- a/apps/files_sharing/tests/UpdaterTest.php +++ b/apps/files_sharing/tests/UpdaterTest.php @@ -50,7 +50,7 @@ class UpdaterTest extends TestCase { * points should be unshared before the folder gets deleted so * that the mount point doesn't end up at the trash bin */ - public function testDeleteParentFolder() { + public function testDeleteParentFolder(): void { $status = \OC::$server->getAppManager()->isEnabledForUser('files_trashbin'); (new \OC_App())->enable('files_trashbin'); @@ -128,7 +128,7 @@ class UpdaterTest extends TestCase { * * @param string $shareFolder share folder to use */ - public function testShareFile($shareFolder) { + public function testShareFile($shareFolder): void { $config = \OC::$server->getConfig(); $oldShareFolder = $config->getSystemValue('share_folder'); $config->setSystemValue('share_folder', $shareFolder); @@ -178,7 +178,7 @@ class UpdaterTest extends TestCase { /** * if a folder gets renamed all children mount points should be renamed too */ - public function testRename() { + public function testRename(): void { $fileinfo = \OC\Files\Filesystem::getFileInfo($this->folder); $share = $this->share( @@ -225,7 +225,7 @@ class UpdaterTest extends TestCase { * |-subfolder2 * |-file2.txt --> shared with user3 */ - public function testMovedIntoShareChangeOwner() { + public function testMovedIntoShareChangeOwner(): void { $this->markTestSkipped('Skipped because this is failing with S3 as primary as file id are change when moved.'); // user1 creates folder1 diff --git a/apps/files_sharing/tests/WatcherTest.php b/apps/files_sharing/tests/WatcherTest.php index c116f542fba..012acdcd691 100644 --- a/apps/files_sharing/tests/WatcherTest.php +++ b/apps/files_sharing/tests/WatcherTest.php @@ -87,7 +87,7 @@ class WatcherTest extends TestCase { * Tests that writing a file using the shared storage will propagate the file * size to the owner's parent folders. */ - public function testFolderSizePropagationToOwnerStorage() { + public function testFolderSizePropagationToOwnerStorage(): void { $initialSizes = self::getOwnerDirSizes('files/container/shareddir'); $textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; @@ -117,7 +117,7 @@ class WatcherTest extends TestCase { * Tests that writing a file using the shared storage will propagate the file * size to the owner's parent folders. */ - public function testSubFolderSizePropagationToOwnerStorage() { + public function testSubFolderSizePropagationToOwnerStorage(): void { $initialSizes = self::getOwnerDirSizes('files/container/shareddir/subdir'); $textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |