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/federatedfilesharing/tests | |
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/federatedfilesharing/tests')
7 files changed, 31 insertions, 31 deletions
diff --git a/apps/federatedfilesharing/tests/AddressHandlerTest.php b/apps/federatedfilesharing/tests/AddressHandlerTest.php index 3fb2a938a66..e235314e008 100644 --- a/apps/federatedfilesharing/tests/AddressHandlerTest.php +++ b/apps/federatedfilesharing/tests/AddressHandlerTest.php @@ -96,7 +96,7 @@ class AddressHandlerTest extends \Test\TestCase { * @param string $expectedUser * @param string $expectedUrl */ - public function testSplitUserRemote($remote, $expectedUser, $expectedUrl) { + public function testSplitUserRemote($remote, $expectedUser, $expectedUrl): void { $this->contactsManager->expects($this->any()) ->method('search') ->willReturn([]); @@ -129,7 +129,7 @@ class AddressHandlerTest extends \Test\TestCase { * * @param string $id */ - public function testSplitUserRemoteError($id) { + public function testSplitUserRemoteError($id): void { $this->expectException(\OCP\HintException::class); $this->addressHandler->splitUserRemote($id); @@ -144,7 +144,7 @@ class AddressHandlerTest extends \Test\TestCase { * @param string $server2 * @param bool $expected */ - public function testCompareAddresses($user1, $server1, $user2, $server2, $expected) { + public function testCompareAddresses($user1, $server1, $user2, $server2, $expected): void { $this->assertSame($expected, $this->addressHandler->compareAddresses($user1, $server1, $user2, $server2) ); @@ -176,7 +176,7 @@ class AddressHandlerTest extends \Test\TestCase { * @param string $url * @param string $expectedResult */ - public function testRemoveProtocolFromUrl($url, $expectedResult) { + public function testRemoveProtocolFromUrl($url, $expectedResult): void { $result = $this->addressHandler->removeProtocolFromUrl($url); $this->assertSame($expectedResult, $result); } @@ -195,7 +195,7 @@ class AddressHandlerTest extends \Test\TestCase { * @param string $url * @param bool $expectedResult */ - public function testUrlContainProtocol($url, $expectedResult) { + public function testUrlContainProtocol($url, $expectedResult): void { $result = $this->addressHandler->urlContainProtocol($url); $this->assertSame($expectedResult, $result); } diff --git a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php index 61487689cde..6eb7ce30274 100644 --- a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php @@ -130,7 +130,7 @@ class MountPublicLinkControllerTest extends \Test\TestCase { $createSuccessful, $expectedReturnData, $permissions - ) { + ): void { $this->federatedShareProvider->expects($this->any()) ->method('isOutgoingServer2serverShareEnabled') ->willReturn($outgoingSharesAllowed); diff --git a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php index dc128021b28..cce1ee8830a 100644 --- a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php @@ -130,7 +130,7 @@ class RequestHandlerControllerTest extends \Test\TestCase { ); } - public function testCreateShare() { + public function testCreateShare(): void { $this->cloudFederationFactory->expects($this->once())->method('getCloudFederationShare') ->with( $this->user2, @@ -160,7 +160,7 @@ class RequestHandlerControllerTest extends \Test\TestCase { $this->assertInstanceOf(DataResponse::class, $result); } - public function testDeclineShare() { + public function testDeclineShare(): void { $id = 42; $notification = [ @@ -183,7 +183,7 @@ class RequestHandlerControllerTest extends \Test\TestCase { } - public function testAcceptShare() { + public function testAcceptShare(): void { $id = 42; $notification = [ diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php index 8f54207626f..5255a84b461 100644 --- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php +++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php @@ -139,7 +139,7 @@ class FederatedShareProviderTest extends \Test\TestCase { /** * @dataProvider dataTestCreate */ - public function testCreate($expirationDate, $expectedDataDate) { + public function testCreate($expirationDate, $expectedDataDate): void { $share = $this->shareManager->newShare(); /** @var File|MockObject $node */ @@ -222,7 +222,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->assertEquals($expirationDate, $share->getExpirationDate()); } - public function testCreateCouldNotFindServer() { + public function testCreateCouldNotFindServer(): void { $share = $this->shareManager->newShare(); $node = $this->getMockBuilder(File::class)->getMock(); @@ -283,7 +283,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->assertFalse($data); } - public function testCreateException() { + public function testCreateException(): void { $share = $this->shareManager->newShare(); $node = $this->getMockBuilder(File::class)->getMock(); @@ -344,7 +344,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->assertFalse($data); } - public function testCreateShareWithSelf() { + public function testCreateShareWithSelf(): void { $share = $this->shareManager->newShare(); $node = $this->getMockBuilder(File::class)->getMock(); @@ -387,7 +387,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->assertFalse($data); } - public function testCreateAlreadyShared() { + public function testCreateAlreadyShared(): void { $share = $this->shareManager->newShare(); $node = $this->getMockBuilder(File::class)->getMock(); @@ -441,7 +441,7 @@ class FederatedShareProviderTest extends \Test\TestCase { /** * @dataProvider dataTestUpdate */ - public function testUpdate($owner, $sharedBy, $expirationDate) { + public function testUpdate($owner, $sharedBy, $expirationDate): void { $this->provider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider') ->setConstructorArgs( [ @@ -525,7 +525,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ]; } - public function testGetSharedBy() { + public function testGetSharedBy(): void { $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -571,7 +571,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->assertEquals('sharedBy', $shares[0]->getSharedBy()); } - public function testGetSharedByWithNode() { + public function testGetSharedByWithNode(): void { $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -618,7 +618,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->assertEquals(43, $shares[0]->getNodeId()); } - public function testGetSharedByWithReshares() { + public function testGetSharedByWithReshares(): void { $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -660,7 +660,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->assertCount(2, $shares); } - public function testGetSharedByWithLimit() { + public function testGetSharedByWithLimit(): void { $node = $this->getMockBuilder(File::class)->getMock(); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); @@ -730,7 +730,7 @@ class FederatedShareProviderTest extends \Test\TestCase { * @param string $deletedUser The user that is deleted * @param bool $rowDeleted Is the row deleted in this setup */ - public function testDeleteUser($owner, $initiator, $recipient, $deletedUser, $rowDeleted) { + public function testDeleteUser($owner, $initiator, $recipient, $deletedUser, $rowDeleted): void { $qb = $this->connection->getQueryBuilder(); $qb->insert('share') ->setValue('share_type', $qb->createNamedParameter(IShare::TYPE_REMOTE)) @@ -765,7 +765,7 @@ class FederatedShareProviderTest extends \Test\TestCase { * @param string $isEnabled * @param bool $expected */ - public function testIsOutgoingServer2serverShareEnabled($internalOnly, $isEnabled, $expected) { + public function testIsOutgoingServer2serverShareEnabled($internalOnly, $isEnabled, $expected): void { $this->gsConfig->expects($this->once())->method('onlyInternalFederation') ->willReturn($internalOnly); $this->config->expects($this->any())->method('getAppValue') @@ -792,7 +792,7 @@ class FederatedShareProviderTest extends \Test\TestCase { * @param string $isEnabled * @param bool $expected */ - public function testIsIncomingServer2serverShareEnabled($onlyInternal, $isEnabled, $expected) { + public function testIsIncomingServer2serverShareEnabled($onlyInternal, $isEnabled, $expected): void { $this->gsConfig->expects($this->once())->method('onlyInternalFederation') ->willReturn($onlyInternal); $this->config->expects($this->any())->method('getAppValue') @@ -819,7 +819,7 @@ class FederatedShareProviderTest extends \Test\TestCase { * @param string $isEnabled * @param bool $expected */ - public function testIsLookupServerQueriesEnabled($gsEnabled, $isEnabled, $expected) { + public function testIsLookupServerQueriesEnabled($gsEnabled, $isEnabled, $expected): void { $this->gsConfig->expects($this->once())->method('isGlobalScaleEnabled') ->willReturn($gsEnabled); $this->config->expects($this->any())->method('getAppValue') @@ -847,7 +847,7 @@ class FederatedShareProviderTest extends \Test\TestCase { * @param string $isEnabled * @param bool $expected */ - public function testIsLookupServerUploadEnabled($gsEnabled, $isEnabled, $expected) { + public function testIsLookupServerUploadEnabled($gsEnabled, $isEnabled, $expected): void { $this->gsConfig->expects($this->once())->method('isGlobalScaleEnabled') ->willReturn($gsEnabled); $this->config->expects($this->any())->method('getAppValue') @@ -868,7 +868,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ]; } - public function testGetSharesInFolder() { + public function testGetSharesInFolder(): void { $userManager = \OC::$server->getUserManager(); $rootFolder = \OC::$server->getRootFolder(); @@ -922,7 +922,7 @@ class FederatedShareProviderTest extends \Test\TestCase { $u2->delete(); } - public function testGetAccessList() { + public function testGetAccessList(): void { $userManager = \OC::$server->getUserManager(); $rootFolder = \OC::$server->getRootFolder(); diff --git a/apps/federatedfilesharing/tests/NotificationsTest.php b/apps/federatedfilesharing/tests/NotificationsTest.php index d0f5283e7a9..868591cb4dd 100644 --- a/apps/federatedfilesharing/tests/NotificationsTest.php +++ b/apps/federatedfilesharing/tests/NotificationsTest.php @@ -102,7 +102,7 @@ class NotificationsTest extends \Test\TestCase { * @param array $httpRequestResult * @param bool $expected */ - public function testSendUpdateToRemote($try, $httpRequestResult, $expected) { + public function testSendUpdateToRemote($try, $httpRequestResult, $expected): void { $remote = 'http://remote'; $id = 42; $timestamp = 63576; diff --git a/apps/federatedfilesharing/tests/Settings/AdminTest.php b/apps/federatedfilesharing/tests/Settings/AdminTest.php index 29f15b0199d..031d19c2cb8 100644 --- a/apps/federatedfilesharing/tests/Settings/AdminTest.php +++ b/apps/federatedfilesharing/tests/Settings/AdminTest.php @@ -58,7 +58,7 @@ class AdminTest extends TestCase { * @dataProvider sharingStateProvider * @param bool $state */ - public function testGetForm($state) { + public function testGetForm($state): void { $this->federatedShareProvider ->expects($this->once()) ->method('isOutgoingServer2serverShareEnabled') @@ -112,11 +112,11 @@ class AdminTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('sharing', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(20, $this->admin->getPriority()); } } diff --git a/apps/federatedfilesharing/tests/TokenHandlerTest.php b/apps/federatedfilesharing/tests/TokenHandlerTest.php index f6b4a2fa9e9..9ed20779857 100644 --- a/apps/federatedfilesharing/tests/TokenHandlerTest.php +++ b/apps/federatedfilesharing/tests/TokenHandlerTest.php @@ -29,7 +29,7 @@ class TokenHandlerTest extends \Test\TestCase { $this->tokenHandler = new TokenHandler($this->secureRandom); } - public function testGenerateToken() { + public function testGenerateToken(): void { $this->secureRandom->expects($this->once())->method('generate') ->with( $this->expectedTokenLength, |