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_external | |
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_external')
34 files changed, 148 insertions, 148 deletions
diff --git a/apps/files_external/tests/Auth/AuthMechanismTest.php b/apps/files_external/tests/Auth/AuthMechanismTest.php index 3297d93fe94..682d2e1326f 100644 --- a/apps/files_external/tests/Auth/AuthMechanismTest.php +++ b/apps/files_external/tests/Auth/AuthMechanismTest.php @@ -11,7 +11,7 @@ use OCA\Files_External\Lib\Backend\Backend; use OCA\Files_External\Lib\StorageConfig; class AuthMechanismTest extends \Test\TestCase { - public function testJsonSerialization() { + public function testJsonSerialization(): void { $mechanism = $this->getMockBuilder(AuthMechanism::class) ->setMethods(['jsonSerializeDefinition']) ->getMock(); @@ -38,7 +38,7 @@ class AuthMechanismTest extends \Test\TestCase { /** * @dataProvider validateStorageProvider */ - public function testValidateStorage($expectedSuccess, $scheme, $definitionSuccess) { + public function testValidateStorage($expectedSuccess, $scheme, $definitionSuccess): void { $mechanism = $this->getMockBuilder(AuthMechanism::class) ->setMethods(['validateStorageDefinition']) ->getMock(); diff --git a/apps/files_external/tests/Auth/Password/GlobalAuth.php b/apps/files_external/tests/Auth/Password/GlobalAuth.php index 85a2c1fb27c..9f7aa0ef03a 100644 --- a/apps/files_external/tests/Auth/Password/GlobalAuth.php +++ b/apps/files_external/tests/Auth/Password/GlobalAuth.php @@ -60,7 +60,7 @@ class GlobalAuthTest extends TestCase { return $storageConfig; } - public function testNoCredentials() { + public function testNoCredentials(): void { $this->credentialsManager->expects($this->once()) ->method('retrieve') ->willReturn(null); @@ -71,7 +71,7 @@ class GlobalAuthTest extends TestCase { $this->assertEquals([], $storage->getBackendOptions()); } - public function testSavedCredentials() { + public function testSavedCredentials(): void { $this->credentialsManager->expects($this->once()) ->method('retrieve') ->willReturn([ @@ -89,7 +89,7 @@ class GlobalAuthTest extends TestCase { } - public function testNoCredentialsPersonal() { + public function testNoCredentialsPersonal(): void { $this->expectException(\OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException::class); $this->credentialsManager->expects($this->never()) diff --git a/apps/files_external/tests/Backend/BackendTest.php b/apps/files_external/tests/Backend/BackendTest.php index 771c053982c..26aa5ebe6af 100644 --- a/apps/files_external/tests/Backend/BackendTest.php +++ b/apps/files_external/tests/Backend/BackendTest.php @@ -10,7 +10,7 @@ use OCA\Files_External\Lib\Backend\Backend; use OCA\Files_External\Lib\StorageConfig; class BackendTest extends \Test\TestCase { - public function testJsonSerialization() { + public function testJsonSerialization(): void { $backend = $this->getMockBuilder(Backend::class) ->setMethods(['jsonSerializeDefinition']) ->getMock(); @@ -42,7 +42,7 @@ class BackendTest extends \Test\TestCase { /** * @dataProvider validateStorageProvider */ - public function testValidateStorage($expectedSuccess, $definitionSuccess) { + public function testValidateStorage($expectedSuccess, $definitionSuccess): void { $backend = $this->getMockBuilder(Backend::class) ->setMethods(['validateStorageDefinition']) ->getMock(); @@ -57,7 +57,7 @@ class BackendTest extends \Test\TestCase { $this->assertEquals($expectedSuccess, $backend->validateStorage($storageConfig)); } - public function testLegacyAuthMechanismCallback() { + public function testLegacyAuthMechanismCallback(): void { $backend = new Backend(); $backend->setLegacyAuthMechanismCallback(function (array $params) { if (isset($params['ping'])) { diff --git a/apps/files_external/tests/Backend/LegacyBackendTest.php b/apps/files_external/tests/Backend/LegacyBackendTest.php index 2d041e69f26..303700c6611 100644 --- a/apps/files_external/tests/Backend/LegacyBackendTest.php +++ b/apps/files_external/tests/Backend/LegacyBackendTest.php @@ -21,7 +21,7 @@ class LegacyBackendTest extends \Test\TestCase { ]; } - public function testConstructor() { + public function testConstructor(): void { $auth = $this->getMockBuilder('\OCA\Files_External\Lib\Auth\Builtin') ->disableOriginalConstructor() ->getMock(); @@ -77,7 +77,7 @@ class LegacyBackendTest extends \Test\TestCase { $this->assertEquals(DefinitionParameter::FLAG_OPTIONAL, $parameters['optionalpassword']->getFlags()); } - public function testNoDependencies() { + public function testNoDependencies(): void { $auth = $this->getMockBuilder('\OCA\Files_External\Lib\Auth\Builtin') ->disableOriginalConstructor() ->getMock(); diff --git a/apps/files_external/tests/Command/ApplicableTest.php b/apps/files_external/tests/Command/ApplicableTest.php index d4caadad343..223b02706e5 100644 --- a/apps/files_external/tests/Command/ApplicableTest.php +++ b/apps/files_external/tests/Command/ApplicableTest.php @@ -28,7 +28,7 @@ class ApplicableTest extends CommandTest { return new Applicable($storageService, $userManager, $groupManager); } - public function testListEmpty() { + public function testListEmpty(): void { $mount = $this->getMount(1, '', ''); $storageService = $this->getGlobalStorageService([$mount]); @@ -45,7 +45,7 @@ class ApplicableTest extends CommandTest { $this->assertEquals(['users' => [], 'groups' => []], $result); } - public function testList() { + public function testList(): void { $mount = $this->getMount(1, '', '', '', [], [], ['test', 'asd']); $storageService = $this->getGlobalStorageService([$mount]); @@ -62,7 +62,7 @@ class ApplicableTest extends CommandTest { $this->assertEquals(['users' => ['test', 'asd'], 'groups' => []], $result); } - public function testAddSingle() { + public function testAddSingle(): void { $mount = $this->getMount(1, '', '', '', [], [], []); $storageService = $this->getGlobalStorageService([$mount]); @@ -80,7 +80,7 @@ class ApplicableTest extends CommandTest { $this->assertEquals(['foo'], $mount->getApplicableUsers()); } - public function testAddDuplicate() { + public function testAddDuplicate(): void { $mount = $this->getMount(1, '', '', '', [], [], ['foo']); $storageService = $this->getGlobalStorageService([$mount]); @@ -98,7 +98,7 @@ class ApplicableTest extends CommandTest { $this->assertEquals(['foo', 'bar'], $mount->getApplicableUsers()); } - public function testRemoveSingle() { + public function testRemoveSingle(): void { $mount = $this->getMount(1, '', '', '', [], [], ['foo', 'bar']); $storageService = $this->getGlobalStorageService([$mount]); @@ -116,7 +116,7 @@ class ApplicableTest extends CommandTest { $this->assertEquals(['foo'], $mount->getApplicableUsers()); } - public function testRemoveNonExisting() { + public function testRemoveNonExisting(): void { $mount = $this->getMount(1, '', '', '', [], [], ['foo', 'bar']); $storageService = $this->getGlobalStorageService([$mount]); @@ -134,7 +134,7 @@ class ApplicableTest extends CommandTest { $this->assertEquals(['foo'], $mount->getApplicableUsers()); } - public function testRemoveAddRemove() { + public function testRemoveAddRemove(): void { $mount = $this->getMount(1, '', '', '', [], [], ['foo', 'bar']); $storageService = $this->getGlobalStorageService([$mount]); diff --git a/apps/files_external/tests/Command/ListCommandTest.php b/apps/files_external/tests/Command/ListCommandTest.php index 8375ba89f2a..bd4430b4116 100644 --- a/apps/files_external/tests/Command/ListCommandTest.php +++ b/apps/files_external/tests/Command/ListCommandTest.php @@ -39,7 +39,7 @@ class ListCommandTest extends CommandTest { return new ListCommand($globalService, $userService, $userSession, $userManager); } - public function testListAuthIdentifier() { + public function testListAuthIdentifier(): void { $l10n = $this->createMock(IL10N::class); $session = $this->createMock(ISession::class); $crypto = $this->createMock(ICrypto::class); diff --git a/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php b/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php index 767ae04fc79..b3c7db9306f 100644 --- a/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php +++ b/apps/files_external/tests/Config/UserPlaceholderHandlerTest.php @@ -64,7 +64,7 @@ class UserPlaceholderHandlerTest extends \Test\TestCase { /** * @dataProvider optionProvider */ - public function testHandle($option, $expected) { + public function testHandle($option, $expected): void { $this->setUser(); $this->assertSame($expected, $this->handler->handle($option)); } @@ -72,7 +72,7 @@ class UserPlaceholderHandlerTest extends \Test\TestCase { /** * @dataProvider optionProvider */ - public function testHandleNoUser($option) { + public function testHandleNoUser($option): void { $this->shareManager->expects($this->once()) ->method('getShareByToken') ->willThrowException(new ShareNotFound()); diff --git a/apps/files_external/tests/Controller/AjaxControllerTest.php b/apps/files_external/tests/Controller/AjaxControllerTest.php index 4b2f973e9b0..dc9661732cc 100644 --- a/apps/files_external/tests/Controller/AjaxControllerTest.php +++ b/apps/files_external/tests/Controller/AjaxControllerTest.php @@ -52,7 +52,7 @@ class AjaxControllerTest extends TestCase { parent::setUp(); } - public function testGetSshKeys() { + public function testGetSshKeys(): void { $this->rsa ->expects($this->once()) ->method('createKey') @@ -73,7 +73,7 @@ class AjaxControllerTest extends TestCase { $this->assertEquals($expected, $this->ajaxController->getSshKeys()); } - public function testSaveGlobalCredentialsAsAdminForAnotherUser() { + public function testSaveGlobalCredentialsAsAdminForAnotherUser(): void { $user = $this->createMock(IUser::class); $user ->expects($this->once()) @@ -90,7 +90,7 @@ class AjaxControllerTest extends TestCase { $this->assertSame(false, $this->ajaxController->saveGlobalCredentials('UidOfTestUser', 'test', 'password')); } - public function testSaveGlobalCredentialsAsAdminForSelf() { + public function testSaveGlobalCredentialsAsAdminForSelf(): void { $user = $this->createMock(IUser::class); $user ->expects($this->once()) @@ -108,7 +108,7 @@ class AjaxControllerTest extends TestCase { $this->assertSame(true, $this->ajaxController->saveGlobalCredentials('MyAdminUid', 'test', 'password')); } - public function testSaveGlobalCredentialsAsNormalUserForSelf() { + public function testSaveGlobalCredentialsAsNormalUserForSelf(): void { $user = $this->createMock(IUser::class); $user ->method('getUID') @@ -123,7 +123,7 @@ class AjaxControllerTest extends TestCase { $this->assertSame(true, $this->ajaxController->saveGlobalCredentials('MyUserUid', 'test', 'password')); } - public function testSaveGlobalCredentialsAsNormalUserForAnotherUser() { + public function testSaveGlobalCredentialsAsNormalUserForAnotherUser(): void { $user = $this->createMock(IUser::class); $user ->method('getUID') diff --git a/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php b/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php index cc905a20ff4..4c318951d1b 100644 --- a/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php +++ b/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php @@ -53,7 +53,7 @@ class GlobalStoragesControllerTest extends StoragesControllerTest { ); } - public function testAddLocalStorageWhenDisabled() { + public function testAddLocalStorageWhenDisabled(): void { $this->controller = $this->createController(false); parent::testAddLocalStorageWhenDisabled(); } diff --git a/apps/files_external/tests/Controller/StoragesControllerTest.php b/apps/files_external/tests/Controller/StoragesControllerTest.php index 85f3ca81498..9e9595152ad 100644 --- a/apps/files_external/tests/Controller/StoragesControllerTest.php +++ b/apps/files_external/tests/Controller/StoragesControllerTest.php @@ -70,7 +70,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { return $authMech; } - public function testAddStorage() { + public function testAddStorage(): void { $authMech = $this->getAuthMechMock(); $authMech->method('validateStorage') ->willReturn(true); @@ -111,7 +111,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { $this->assertEquals($storageConfig->jsonSerialize(), $data); } - public function testAddLocalStorageWhenDisabled() { + public function testAddLocalStorageWhenDisabled(): void { $authMech = $this->getAuthMechMock(); $backend = $this->getBackendMock(); @@ -141,7 +141,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_FORBIDDEN, $response->getStatus()); } - public function testUpdateStorage() { + public function testUpdateStorage(): void { $authMech = $this->getAuthMechMock(); $authMech->method('validateStorage') ->willReturn(true); @@ -194,7 +194,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { /** * @dataProvider mountPointNamesProvider */ - public function testAddOrUpdateStorageInvalidMountPoint($mountPoint) { + public function testAddOrUpdateStorageInvalidMountPoint($mountPoint): void { $storageConfig = new StorageConfig(1); $storageConfig->setMountPoint($mountPoint); $storageConfig->setBackend($this->getBackendMock()); @@ -237,7 +237,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_UNPROCESSABLE_ENTITY, $response->getStatus()); } - public function testAddOrUpdateStorageInvalidBackend() { + public function testAddOrUpdateStorageInvalidBackend(): void { $this->service->expects($this->exactly(2)) ->method('createStorage') ->will($this->throwException(new \InvalidArgumentException())); @@ -274,7 +274,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_UNPROCESSABLE_ENTITY, $response->getStatus()); } - public function testUpdateStorageNonExisting() { + public function testUpdateStorageNonExisting(): void { $authMech = $this->getAuthMechMock(); $authMech->method('validateStorage') ->willReturn(true); @@ -314,7 +314,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_NOT_FOUND, $response->getStatus()); } - public function testDeleteStorage() { + public function testDeleteStorage(): void { $this->service->expects($this->once()) ->method('removeStorage'); @@ -322,7 +322,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_NO_CONTENT, $response->getStatus()); } - public function testDeleteStorageNonExisting() { + public function testDeleteStorageNonExisting(): void { $this->service->expects($this->once()) ->method('removeStorage') ->will($this->throwException(new NotFoundException())); @@ -331,7 +331,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_NOT_FOUND, $response->getStatus()); } - public function testGetStorage() { + public function testGetStorage(): void { $backend = $this->getBackendMock(); $authMech = $this->getAuthMechMock(); $storageConfig = new StorageConfig(1); @@ -365,7 +365,7 @@ abstract class StoragesControllerTest extends \Test\TestCase { /** * @dataProvider validateStorageProvider */ - public function testValidateStorage($backendValidate, $authMechValidate, $expectSuccess) { + public function testValidateStorage($backendValidate, $authMechValidate, $expectSuccess): void { $backend = $this->getBackendMock(); $backend->method('validateStorage') ->willReturn($backendValidate); diff --git a/apps/files_external/tests/Controller/UserStoragesControllerTest.php b/apps/files_external/tests/Controller/UserStoragesControllerTest.php index 0ac2197f67c..c15ded48ea7 100644 --- a/apps/files_external/tests/Controller/UserStoragesControllerTest.php +++ b/apps/files_external/tests/Controller/UserStoragesControllerTest.php @@ -60,12 +60,12 @@ class UserStoragesControllerTest extends StoragesControllerTest { ); } - public function testAddLocalStorageWhenDisabled() { + public function testAddLocalStorageWhenDisabled(): void { $this->controller = $this->createController(false); parent::testAddLocalStorageWhenDisabled(); } - public function testAddOrUpdateStorageDisallowedBackend() { + public function testAddOrUpdateStorageDisallowedBackend(): void { $backend = $this->getBackendMock(); $backend->method('isVisibleFor') ->with(BackendService::VISIBILITY_PERSONAL) diff --git a/apps/files_external/tests/DefinitionParameterTest.php b/apps/files_external/tests/DefinitionParameterTest.php index f9d50e7a34c..0b1d11bbf0c 100644 --- a/apps/files_external/tests/DefinitionParameterTest.php +++ b/apps/files_external/tests/DefinitionParameterTest.php @@ -9,7 +9,7 @@ namespace OCA\Files_External\Tests; use OCA\Files_External\Lib\DefinitionParameter as Param; class DefinitionParameterTest extends \Test\TestCase { - public function testJsonSerialization() { + public function testJsonSerialization(): void { $param = new Param('foo', 'bar'); $this->assertEquals([ 'value' => 'bar', @@ -70,7 +70,7 @@ class DefinitionParameterTest extends \Test\TestCase { /** * @dataProvider validateValueProvider */ - public function testValidateValue($type, $flags, $value, $success, $expectedValue = null) { + public function testValidateValue($type, $flags, $value, $success, $expectedValue = null): void { $param = new Param('foo', 'bar'); $param->setType($type); $param->setFlags($flags); diff --git a/apps/files_external/tests/FrontendDefinitionTraitTest.php b/apps/files_external/tests/FrontendDefinitionTraitTest.php index e5dc0547d74..bc5d88ff3f0 100644 --- a/apps/files_external/tests/FrontendDefinitionTraitTest.php +++ b/apps/files_external/tests/FrontendDefinitionTraitTest.php @@ -10,7 +10,7 @@ use OCA\Files_External\Lib\DefinitionParameter; use OCA\Files_External\Lib\StorageConfig; class FrontendDefinitionTraitTest extends \Test\TestCase { - public function testJsonSerialization() { + public function testJsonSerialization(): void { $param = $this->getMockBuilder(DefinitionParameter::class) ->disableOriginalConstructor() ->getMock(); @@ -42,7 +42,7 @@ class FrontendDefinitionTraitTest extends \Test\TestCase { /** * @dataProvider validateStorageProvider */ - public function testValidateStorage($expectedSuccess, $params) { + public function testValidateStorage($expectedSuccess, $params): void { $backendParams = []; foreach ($params as $name => $valid) { $param = $this->getMockBuilder(DefinitionParameter::class) @@ -74,7 +74,7 @@ class FrontendDefinitionTraitTest extends \Test\TestCase { $this->assertEquals($expectedSuccess, $trait->validateStorageDefinition($storageConfig)); } - public function testValidateStorageSet() { + public function testValidateStorageSet(): void { $param = $this->getMockBuilder(DefinitionParameter::class) ->disableOriginalConstructor() ->getMock(); diff --git a/apps/files_external/tests/LegacyDependencyCheckPolyfillTest.php b/apps/files_external/tests/LegacyDependencyCheckPolyfillTest.php index 931421551eb..5fcfe1dd1e6 100644 --- a/apps/files_external/tests/LegacyDependencyCheckPolyfillTest.php +++ b/apps/files_external/tests/LegacyDependencyCheckPolyfillTest.php @@ -20,7 +20,7 @@ class LegacyDependencyCheckPolyfillTest extends \Test\TestCase { ]; } - public function testCheckDependencies() { + public function testCheckDependencies(): void { $trait = $this->getMockForTrait('\OCA\Files_External\Lib\LegacyDependencyCheckPolyfill'); $trait->expects($this->once()) ->method('getStorageClass') diff --git a/apps/files_external/tests/Listener/StorePasswordListenerTest.php b/apps/files_external/tests/Listener/StorePasswordListenerTest.php index a028e1ac0ef..ec278f84331 100644 --- a/apps/files_external/tests/Listener/StorePasswordListenerTest.php +++ b/apps/files_external/tests/Listener/StorePasswordListenerTest.php @@ -76,7 +76,7 @@ class StorePasswordListenerTest extends TestCase { $storePasswordListener->handle($event); } - public function testClassicLoginSameCredentials() { + public function testClassicLoginSameCredentials(): void { $this->getMockedCredentialManager( [ 'user' => 'test', @@ -87,7 +87,7 @@ class StorePasswordListenerTest extends TestCase { ); } - public function testClassicLoginNewPassword() { + public function testClassicLoginNewPassword(): void { $this->getMockedCredentialManager( [ 'user' => 'test', @@ -101,7 +101,7 @@ class StorePasswordListenerTest extends TestCase { ); } - public function testClassicLoginNewUser() { + public function testClassicLoginNewUser(): void { $this->getMockedCredentialManager( [ 'user' => 'test', @@ -115,7 +115,7 @@ class StorePasswordListenerTest extends TestCase { ); } - public function testSSOLogin() { + public function testSSOLogin(): void { $this->getMockedCredentialManager( [ 'user' => 'test', @@ -126,7 +126,7 @@ class StorePasswordListenerTest extends TestCase { ); } - public function testPasswordUpdated() { + public function testPasswordUpdated(): void { $this->getMockedCredentialManager( [ 'user' => 'test', @@ -140,7 +140,7 @@ class StorePasswordListenerTest extends TestCase { ); } - public function testUserLoginWithToken() { + public function testUserLoginWithToken(): void { $this->getMockedCredentialManager( null, new UserLoggedInEvent($this->mockedUser, 'test', 'password', true), @@ -148,7 +148,7 @@ class StorePasswordListenerTest extends TestCase { ); } - public function testNoInitialCredentials() { + public function testNoInitialCredentials(): void { $this->getMockedCredentialManager( false, new PasswordUpdatedEvent($this->mockedUser, 'test', 'password'), diff --git a/apps/files_external/tests/OwnCloudFunctionsTest.php b/apps/files_external/tests/OwnCloudFunctionsTest.php index 9efefe8e4dd..99cb0cf94de 100644 --- a/apps/files_external/tests/OwnCloudFunctionsTest.php +++ b/apps/files_external/tests/OwnCloudFunctionsTest.php @@ -86,7 +86,7 @@ class OwnCloudFunctionsTest extends \Test\TestCase { /** * @dataProvider configUrlProvider */ - public function testConfig($config, $expectedUri) { + public function testConfig($config, $expectedUri): void { $config['user'] = 'someuser'; $config['password'] = 'somepassword'; $instance = new \OCA\Files_External\Lib\Storage\OwnCloud($config); diff --git a/apps/files_external/tests/PersonalMountTest.php b/apps/files_external/tests/PersonalMountTest.php index aec0a8b6f75..2d8f41c3e50 100644 --- a/apps/files_external/tests/PersonalMountTest.php +++ b/apps/files_external/tests/PersonalMountTest.php @@ -13,7 +13,7 @@ use OCA\Files_External\Lib\StorageConfig; use Test\TestCase; class PersonalMountTest extends TestCase { - public function testFindByStorageId() { + public function testFindByStorageId(): void { $storageConfig = $this->createMock(StorageConfig::class); /** @var \OCA\Files_External\Service\UserStoragesService $storageService */ $storageService = $this->getMockBuilder('\OCA\Files_External\Service\UserStoragesService') diff --git a/apps/files_external/tests/Service/BackendServiceTest.php b/apps/files_external/tests/Service/BackendServiceTest.php index bda96550317..6d9754a5335 100644 --- a/apps/files_external/tests/Service/BackendServiceTest.php +++ b/apps/files_external/tests/Service/BackendServiceTest.php @@ -51,7 +51,7 @@ class BackendServiceTest extends \Test\TestCase { return $backend; } - public function testRegisterBackend() { + public function testRegisterBackend(): void { $service = new BackendService($this->config); $backend = $this->getBackendMock('\Foo\Bar'); @@ -79,7 +79,7 @@ class BackendServiceTest extends \Test\TestCase { $this->assertArrayNotHasKey('identifier_alias', $backends); } - public function testBackendProvider() { + public function testBackendProvider(): void { $service = new BackendService($this->config); $backend1 = $this->getBackendMock('\Foo\Bar'); @@ -98,7 +98,7 @@ class BackendServiceTest extends \Test\TestCase { $this->assertCount(2, $service->getBackends()); } - public function testAuthMechanismProvider() { + public function testAuthMechanismProvider(): void { $service = new BackendService($this->config); $backend1 = $this->getAuthMechanismMock('\Foo\Bar'); @@ -117,7 +117,7 @@ class BackendServiceTest extends \Test\TestCase { $this->assertCount(2, $service->getAuthMechanisms()); } - public function testMultipleBackendProviders() { + public function testMultipleBackendProviders(): void { $service = new BackendService($this->config); $backend1a = $this->getBackendMock('\Foo\Bar'); @@ -145,7 +145,7 @@ class BackendServiceTest extends \Test\TestCase { $this->assertCount(3, $service->getBackends()); } - public function testUserMountingBackends() { + public function testUserMountingBackends(): void { $this->config->expects($this->exactly(2)) ->method('getAppValue') ->willReturnMap([ @@ -176,7 +176,7 @@ class BackendServiceTest extends \Test\TestCase { $service->registerBackend($backendAlias); } - public function testGetAvailableBackends() { + public function testGetAvailableBackends(): void { $service = new BackendService($this->config); $backendAvailable = $this->getBackendMock('\Backend\Available'); @@ -217,7 +217,7 @@ class BackendServiceTest extends \Test\TestCase { /** * @dataProvider invalidConfigPlaceholderProvider */ - public function testRegisterConfigHandlerInvalid(array $placeholders) { + public function testRegisterConfigHandlerInvalid(array $placeholders): void { $this->expectException(\RuntimeException::class); $service = new BackendService($this->config); @@ -230,7 +230,7 @@ class BackendServiceTest extends \Test\TestCase { } } - public function testConfigHandlers() { + public function testConfigHandlers(): void { $service = new BackendService($this->config); $mock = $this->createMock(IConfigHandler::class); $mock->expects($this->exactly(3)) diff --git a/apps/files_external/tests/Service/DBConfigServiceTest.php b/apps/files_external/tests/Service/DBConfigServiceTest.php index 1c2cafc93f0..968c166a505 100644 --- a/apps/files_external/tests/Service/DBConfigServiceTest.php +++ b/apps/files_external/tests/Service/DBConfigServiceTest.php @@ -45,7 +45,7 @@ class DBConfigServiceTest extends TestCase { return $id; } - public function testAddSimpleMount() { + public function testAddSimpleMount(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $mount = $this->dbConfig->getMountById($id); @@ -59,7 +59,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals([], $mount['options']); } - public function testAddApplicable() { + public function testAddApplicable(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->addApplicable($id, DBConfigService::APPLICABLE_TYPE_USER, 'test'); @@ -79,7 +79,7 @@ class DBConfigServiceTest extends TestCase { ], $mount['applicable']); } - public function testAddApplicableDouble() { + public function testAddApplicableDouble(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->addApplicable($id, DBConfigService::APPLICABLE_TYPE_USER, 'test'); $this->dbConfig->addApplicable($id, DBConfigService::APPLICABLE_TYPE_USER, 'test'); @@ -90,7 +90,7 @@ class DBConfigServiceTest extends TestCase { ], $mount['applicable']); } - public function testDeleteMount() { + public function testDeleteMount(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->removeMount($id); @@ -99,7 +99,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals(null, $mount); } - public function testRemoveApplicable() { + public function testRemoveApplicable(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->addApplicable($id, DBConfigService::APPLICABLE_TYPE_USER, 'test'); $this->dbConfig->removeApplicable($id, DBConfigService::APPLICABLE_TYPE_USER, 'test'); @@ -108,7 +108,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals([], $mount['applicable']); } - public function testRemoveApplicableGlobal() { + public function testRemoveApplicableGlobal(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->addApplicable($id, DBConfigService::APPLICABLE_TYPE_GLOBAL, null); $this->dbConfig->removeApplicable($id, DBConfigService::APPLICABLE_TYPE_GLOBAL, null); @@ -120,7 +120,7 @@ class DBConfigServiceTest extends TestCase { ], $mount['applicable']); } - public function testSetConfig() { + public function testSetConfig(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->setConfig($id, 'foo', 'bar'); @@ -133,7 +133,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals(['foo' => 'bar', 'foo2' => 'bar2'], $mount['config']); } - public function testSetConfigOverwrite() { + public function testSetConfigOverwrite(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->setConfig($id, 'foo', 'bar'); $this->dbConfig->setConfig($id, 'asd', '1'); @@ -143,7 +143,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals(['foo' => 'qwerty', 'asd' => '1'], $mount['config']); } - public function testSetOption() { + public function testSetOption(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->setOption($id, 'foo', 'bar'); @@ -156,7 +156,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals(['foo' => 'bar', 'foo2' => 'bar2'], $mount['options']); } - public function testSetOptionOverwrite() { + public function testSetOptionOverwrite(): void { $id = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->setOption($id, 'foo', 'bar'); $this->dbConfig->setOption($id, 'asd', '1'); @@ -166,7 +166,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals(['foo' => 'qwerty', 'asd' => '1'], $mount['options']); } - public function testGetMountsFor() { + public function testGetMountsFor(): void { $mounts = $this->dbConfig->getMountsFor(DBConfigService::APPLICABLE_TYPE_USER, 'test'); $this->assertEquals([], $mounts); @@ -179,7 +179,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals([['type' => DBConfigService::APPLICABLE_TYPE_USER, 'value' => 'test', 'mount_id' => $id]], $mounts[0]['applicable']); } - public function testGetAdminMounts() { + public function testGetAdminMounts(): void { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAL); @@ -188,7 +188,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals($id1, $mounts[0]['mount_id']); } - public function testGetAdminMountsFor() { + public function testGetAdminMountsFor(): void { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_ADMIN); $id3 = $this->addMount('/test3', 'foo3', 'bar3', 100, DBConfigService::MOUNT_TYPE_PERSONAL); @@ -202,7 +202,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals([['type' => DBConfigService::APPLICABLE_TYPE_USER, 'value' => 'test', 'mount_id' => $id1]], $mounts[0]['applicable']); } - public function testGetUserMountsFor() { + public function testGetUserMountsFor(): void { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAL); $id3 = $this->addMount('/test3', 'foo3', 'bar3', 100, DBConfigService::MOUNT_TYPE_PERSONAL); @@ -216,7 +216,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals([['type' => DBConfigService::APPLICABLE_TYPE_USER, 'value' => 'test', 'mount_id' => $id3]], $mounts[0]['applicable']); } - public function testGetAdminMountsForGlobal() { + public function testGetAdminMountsForGlobal(): void { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->addApplicable($id1, DBConfigService::APPLICABLE_TYPE_GLOBAL, null); @@ -227,7 +227,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals([['type' => DBConfigService::APPLICABLE_TYPE_GLOBAL, 'value' => null, 'mount_id' => $id1]], $mounts[0]['applicable']); } - public function testSetMountPoint() { + public function testSetMountPoint(): void { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $id2 = $this->addMount('/foo', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); @@ -241,7 +241,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals('/foo', $mount['mount_point']); } - public function testSetAuthBackend() { + public function testSetAuthBackend(): void { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $id2 = $this->addMount('/foo', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); @@ -255,7 +255,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals('bar', $mount['auth_backend']); } - public function testGetMountsForDuplicateByGroup() { + public function testGetMountsForDuplicateByGroup(): void { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->addApplicable($id1, DBConfigService::APPLICABLE_TYPE_GROUP, 'group1'); @@ -266,7 +266,7 @@ class DBConfigServiceTest extends TestCase { $this->assertEquals($id1, $mounts[0]['mount_id']); } - public function testGetAllMounts() { + public function testGetAllMounts(): void { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $id2 = $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAL); diff --git a/apps/files_external/tests/Service/GlobalStoragesServiceTest.php b/apps/files_external/tests/Service/GlobalStoragesServiceTest.php index 18fd9d174f2..0c9df2e858b 100644 --- a/apps/files_external/tests/Service/GlobalStoragesServiceTest.php +++ b/apps/files_external/tests/Service/GlobalStoragesServiceTest.php @@ -115,7 +115,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { /** * @dataProvider storageDataProvider */ - public function testAddStorage($storageParams) { + public function testAddStorage($storageParams): void { $storage = $this->makeStorageConfig($storageParams); $newStorage = $this->service->addStorage($storage); @@ -139,7 +139,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { /** * @dataProvider storageDataProvider */ - public function testUpdateStorage($updatedStorageParams) { + public function testUpdateStorage($updatedStorageParams): void { $updatedStorage = $this->makeStorageConfig($updatedStorageParams); $storage = $this->makeStorageConfig([ 'mountPoint' => 'mountpoint', @@ -281,7 +281,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { /** * @dataProvider hooksAddStorageDataProvider */ - public function testHooksAddStorage($applicableUsers, $applicableGroups, $expectedCalls) { + public function testHooksAddStorage($applicableUsers, $applicableGroups, $expectedCalls): void { $storage = $this->makeTestStorageData(); $storage->setApplicableUsers($applicableUsers); $storage->setApplicableGroups($applicableGroups); @@ -424,7 +424,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { $sourceApplicableGroups, $updatedApplicableUsers, $updatedApplicableGroups, - $expectedCalls) { + $expectedCalls): void { $storage = $this->makeTestStorageData(); $storage->setApplicableUsers($sourceApplicableUsers); $storage->setApplicableGroups($sourceApplicableGroups); @@ -452,7 +452,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { } - public function testHooksRenameMountPoint() { + public function testHooksRenameMountPoint(): void { $storage = $this->makeTestStorageData(); $storage->setApplicableUsers(['user1', 'user2']); $storage->setApplicableGroups(['group1', 'group2']); @@ -581,7 +581,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest { public function testHooksDeleteStorage( $sourceApplicableUsers, $sourceApplicableGroups, - $expectedCalls) { + $expectedCalls): void { $storage = $this->makeTestStorageData(); $storage->setApplicableUsers($sourceApplicableUsers); $storage->setApplicableGroups($sourceApplicableGroups); diff --git a/apps/files_external/tests/Service/StoragesServiceTest.php b/apps/files_external/tests/Service/StoragesServiceTest.php index 0936912b221..40cba73a74f 100644 --- a/apps/files_external/tests/Service/StoragesServiceTest.php +++ b/apps/files_external/tests/Service/StoragesServiceTest.php @@ -248,7 +248,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { $this->service->updateStorage($storage); } - public function testNonExistingStorage() { + public function testNonExistingStorage(): void { $this->expectException(\OCA\Files_External\NotFoundException::class); $this->ActualNonExistingStorageTest(); @@ -281,7 +281,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { /** * @dataProvider deleteStorageDataProvider */ - public function testDeleteStorage($backendOptions, $rustyStorageId) { + public function testDeleteStorage($backendOptions, $rustyStorageId): void { $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\DAV'); $authMechanism = $this->backendService->getAuthMechanism('identifier:\Auth\Mechanism'); $storage = new StorageConfig(255); @@ -352,13 +352,13 @@ abstract class StoragesServiceTest extends \Test\TestCase { $this->service->removeStorage(255); } - public function testDeleteUnexistingStorage() { + public function testDeleteUnexistingStorage(): void { $this->expectException(\OCA\Files_External\NotFoundException::class); $this->actualDeletedUnexistingStorageTest(); } - public function testCreateStorage() { + public function testCreateStorage(): void { $mountPoint = 'mount'; $backendIdentifier = 'identifier:\OCA\Files_External\Lib\Backend\SMB'; $authMechanismIdentifier = 'identifier:\Auth\Mechanism'; @@ -392,7 +392,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { $this->assertEquals($priority, $storage->getPriority()); } - public function testCreateStorageInvalidClass() { + public function testCreateStorageInvalidClass(): void { $storage = $this->service->createStorage( 'mount', 'identifier:\OC\Not\A\Backend', @@ -402,7 +402,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { $this->assertInstanceOf(InvalidBackend::class, $storage->getBackend()); } - public function testCreateStorageInvalidAuthMechanismClass() { + public function testCreateStorageInvalidAuthMechanismClass(): void { $storage = $this->service->createStorage( 'mount', 'identifier:\OCA\Files_External\Lib\Backend\SMB', @@ -412,7 +412,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { $this->assertInstanceOf(InvalidAuth::class, $storage->getAuthMechanism()); } - public function testGetStoragesBackendNotVisible() { + public function testGetStoragesBackendNotVisible(): void { $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); $backend->expects($this->once()) ->method('isVisibleFor') @@ -435,7 +435,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { $this->assertEmpty($this->service->getStorages()); } - public function testGetStoragesAuthMechanismNotVisible() { + public function testGetStoragesAuthMechanismNotVisible(): void { $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); $backend->method('isVisibleFor') ->with($this->service->getVisibilityType()) @@ -498,7 +498,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { ); } - public function testUpdateStorageMountPoint() { + public function testUpdateStorageMountPoint(): void { $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); $authMechanism = $this->backendService->getAuthMechanism('identifier:\Auth\Mechanism'); diff --git a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php index e08f3bd4d7d..992960a6ea1 100644 --- a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php +++ b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php @@ -108,7 +108,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { /** * @dataProvider applicableStorageProvider */ - public function testGetStorageWithApplicable($applicableUsers, $applicableGroups, $isVisible) { + public function testGetStorageWithApplicable($applicableUsers, $applicableGroups, $isVisible): void { $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); $authMechanism = $this->backendService->getAuthMechanism('identifier:\Auth\Mechanism'); @@ -139,7 +139,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { } - public function testAddStorage($storageParams = null) { + public function testAddStorage($storageParams = null): void { $this->expectException(\DomainException::class); $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); @@ -155,7 +155,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { } - public function testUpdateStorage($storageParams = null) { + public function testUpdateStorage($storageParams = null): void { $this->expectException(\DomainException::class); $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); @@ -175,7 +175,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { } - public function testNonExistingStorage() { + public function testNonExistingStorage(): void { $this->expectException(\DomainException::class); $this->ActualNonExistingStorageTest(); @@ -184,7 +184,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { /** * @dataProvider deleteStorageDataProvider */ - public function testDeleteStorage($backendOptions, $rustyStorageId) { + public function testDeleteStorage($backendOptions, $rustyStorageId): void { $this->expectException(\DomainException::class); $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); @@ -203,7 +203,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { } - public function testDeleteUnexistingStorage() { + public function testDeleteUnexistingStorage(): void { $this->expectException(\DomainException::class); $this->actualDeletedUnexistingStorageTest(); @@ -244,7 +244,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { $priority1, $applicableUsers1, $applicableGroups1, $priority2, $applicableUsers2, $applicableGroups2, $expectedPrecedence - ) { + ): void { $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); $backend->method('isVisibleFor') ->willReturn(true); @@ -284,67 +284,67 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { } } - public function testGetStoragesBackendNotVisible() { + public function testGetStoragesBackendNotVisible(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testGetStoragesAuthMechanismNotVisible() { + public function testGetStoragesAuthMechanismNotVisible(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testHooksAddStorage($a = null, $b = null, $c = null) { + public function testHooksAddStorage($a = null, $b = null, $c = null): void { // we don't test this here $this->addToAssertionCount(1); } - public function testHooksUpdateStorage($a = null, $b = null, $c = null, $d = null, $e = null) { + public function testHooksUpdateStorage($a = null, $b = null, $c = null, $d = null, $e = null): void { // we don't test this here $this->addToAssertionCount(1); } - public function testHooksRenameMountPoint() { + public function testHooksRenameMountPoint(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testHooksDeleteStorage($a = null, $b = null, $c = null) { + public function testHooksDeleteStorage($a = null, $b = null, $c = null): void { // we don't test this here $this->addToAssertionCount(1); } - public function testLegacyConfigConversionApplicableAll() { + public function testLegacyConfigConversionApplicableAll(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testLegacyConfigConversionApplicableUserAndGroup() { + public function testLegacyConfigConversionApplicableUserAndGroup(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testReadLegacyConfigAndGenerateConfigId() { + public function testReadLegacyConfigAndGenerateConfigId(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testReadLegacyConfigNoAuthMechanism() { + public function testReadLegacyConfigNoAuthMechanism(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testReadLegacyConfigClass() { + public function testReadLegacyConfigClass(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testReadEmptyMountPoint() { + public function testReadEmptyMountPoint(): void { // we don't test this here $this->addToAssertionCount(1); } - public function testUpdateStorageMountPoint() { + public function testUpdateStorageMountPoint(): void { // we don't test this here $this->addToAssertionCount(1); } diff --git a/apps/files_external/tests/Service/UserStoragesServiceTest.php b/apps/files_external/tests/Service/UserStoragesServiceTest.php index 370b34245c2..cb7abfaf725 100644 --- a/apps/files_external/tests/Service/UserStoragesServiceTest.php +++ b/apps/files_external/tests/Service/UserStoragesServiceTest.php @@ -65,7 +65,7 @@ class UserStoragesServiceTest extends StoragesServiceTest { ]); } - public function testAddStorage() { + public function testAddStorage(): void { $storage = $this->makeTestStorageData(); $newStorage = $this->service->addStorage($storage); @@ -93,7 +93,7 @@ class UserStoragesServiceTest extends StoragesServiceTest { $this->assertEquals($id + 1, $nextStorage->getId()); } - public function testUpdateStorage() { + public function testUpdateStorage(): void { $storage = $this->makeStorageConfig([ 'mountPoint' => 'mountpoint', 'backendIdentifier' => 'identifier:\OCA\Files_External\Lib\Backend\SMB', @@ -128,7 +128,7 @@ class UserStoragesServiceTest extends StoragesServiceTest { /** * @dataProvider deleteStorageDataProvider */ - public function testDeleteStorage($backendOptions, $rustyStorageId) { + public function testDeleteStorage($backendOptions, $rustyStorageId): void { parent::testDeleteStorage($backendOptions, $rustyStorageId); // hook called once for user (first one was during test creation) @@ -141,7 +141,7 @@ class UserStoragesServiceTest extends StoragesServiceTest { ); } - public function testHooksRenameMountPoint() { + public function testHooksRenameMountPoint(): void { $storage = $this->makeTestStorageData(); $storage = $this->service->addStorage($storage); @@ -170,7 +170,7 @@ class UserStoragesServiceTest extends StoragesServiceTest { } - public function testGetAdminStorage() { + public function testGetAdminStorage(): void { $this->expectException(\OCA\Files_External\NotFoundException::class); $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); diff --git a/apps/files_external/tests/Settings/AdminTest.php b/apps/files_external/tests/Settings/AdminTest.php index 1d584814da8..602e0124950 100644 --- a/apps/files_external/tests/Settings/AdminTest.php +++ b/apps/files_external/tests/Settings/AdminTest.php @@ -40,7 +40,7 @@ class AdminTest extends TestCase { ); } - public function testGetForm() { + public function testGetForm(): void { $this->encryptionManager ->expects($this->once()) ->method('isEnabled') @@ -85,11 +85,11 @@ class AdminTest extends TestCase { $this->assertEquals($expected, $this->admin->getForm()); } - public function testGetSection() { + public function testGetSection(): void { $this->assertSame('externalstorages', $this->admin->getSection()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(40, $this->admin->getPriority()); } } diff --git a/apps/files_external/tests/Settings/SectionTest.php b/apps/files_external/tests/Settings/SectionTest.php index e9f47cab19d..9154106ff8a 100644 --- a/apps/files_external/tests/Settings/SectionTest.php +++ b/apps/files_external/tests/Settings/SectionTest.php @@ -29,11 +29,11 @@ class SectionTest extends TestCase { ); } - public function testGetID() { + public function testGetID(): void { $this->assertSame('externalstorages', $this->section->getID()); } - public function testGetName() { + public function testGetName(): void { $this->l ->expects($this->once()) ->method('t') @@ -43,7 +43,7 @@ class SectionTest extends TestCase { $this->assertSame('External storage', $this->section->getName()); } - public function testGetPriority() { + public function testGetPriority(): void { $this->assertSame(10, $this->section->getPriority()); } } diff --git a/apps/files_external/tests/Storage/Amazons3MultiPartTest.php b/apps/files_external/tests/Storage/Amazons3MultiPartTest.php index 3db468b0fa0..1ac18406d24 100644 --- a/apps/files_external/tests/Storage/Amazons3MultiPartTest.php +++ b/apps/files_external/tests/Storage/Amazons3MultiPartTest.php @@ -40,11 +40,11 @@ class Amazons3MultiPartTest extends \Test\Files\Storage\Storage { parent::tearDown(); } - public function testStat() { + public function testStat(): void { $this->markTestSkipped('S3 doesn\'t update the parents folder mtime'); } - public function testHashInFileName() { + public function testHashInFileName(): void { $this->markTestSkipped('Localstack has a bug with hashes in filename'); } } diff --git a/apps/files_external/tests/Storage/Amazons3Test.php b/apps/files_external/tests/Storage/Amazons3Test.php index bffe98c3f4d..fd7fd9225c9 100644 --- a/apps/files_external/tests/Storage/Amazons3Test.php +++ b/apps/files_external/tests/Storage/Amazons3Test.php @@ -38,11 +38,11 @@ class Amazons3Test extends \Test\Files\Storage\Storage { parent::tearDown(); } - public function testStat() { + public function testStat(): void { $this->markTestSkipped('S3 doesn\'t update the parents folder mtime'); } - public function testHashInFileName() { + public function testHashInFileName(): void { $this->markTestSkipped('Localstack has a bug with hashes in filename'); } } diff --git a/apps/files_external/tests/Storage/FtpTest.php b/apps/files_external/tests/Storage/FtpTest.php index 24f7c511e93..c6a1d8f77ba 100644 --- a/apps/files_external/tests/Storage/FtpTest.php +++ b/apps/files_external/tests/Storage/FtpTest.php @@ -55,7 +55,7 @@ class FtpTest extends \Test\Files\Storage\Storage { /** * mtime for folders is only with a minute resolution */ - public function testStat() { + public function testStat(): void { $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; $ctimeStart = time(); $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile)); diff --git a/apps/files_external/tests/Storage/SFTP_KeyTest.php b/apps/files_external/tests/Storage/SFTP_KeyTest.php index c1aaf0b13a3..9be3cb7d3e8 100644 --- a/apps/files_external/tests/Storage/SFTP_KeyTest.php +++ b/apps/files_external/tests/Storage/SFTP_KeyTest.php @@ -41,39 +41,39 @@ class SFTP_KeyTest extends \Test\Files\Storage\Storage { } - public function testInvalidAddressShouldThrowException() { + public function testInvalidAddressShouldThrowException(): void { $this->expectException(\InvalidArgumentException::class); // I'd use example.com for this, but someone decided to break the spec and make it resolve $this->instance->assertHostAddressValid('notarealaddress...'); } - public function testValidAddressShouldPass() { + public function testValidAddressShouldPass(): void { $this->assertTrue($this->instance->assertHostAddressValid('localhost')); } - public function testNegativePortNumberShouldThrowException() { + public function testNegativePortNumberShouldThrowException(): void { $this->expectException(\InvalidArgumentException::class); $this->instance->assertPortNumberValid('-1'); } - public function testNonNumericalPortNumberShouldThrowException() { + public function testNonNumericalPortNumberShouldThrowException(): void { $this->expectException(\InvalidArgumentException::class); $this->instance->assertPortNumberValid('a'); } - public function testHighPortNumberShouldThrowException() { + public function testHighPortNumberShouldThrowException(): void { $this->expectException(\InvalidArgumentException::class); $this->instance->assertPortNumberValid('65536'); } - public function testValidPortNumberShouldPass() { + public function testValidPortNumberShouldPass(): void { $this->assertTrue($this->instance->assertPortNumberValid('22222')); } } diff --git a/apps/files_external/tests/Storage/SftpTest.php b/apps/files_external/tests/Storage/SftpTest.php index ce7d7461ba8..cc29486f426 100644 --- a/apps/files_external/tests/Storage/SftpTest.php +++ b/apps/files_external/tests/Storage/SftpTest.php @@ -47,7 +47,7 @@ class SftpTest extends \Test\Files\Storage\Storage { /** * @dataProvider configProvider */ - public function testStorageId($config, $expectedStorageId) { + public function testStorageId($config, $expectedStorageId): void { $instance = new SFTP($config); $this->assertEquals($expectedStorageId, $instance->getId()); } diff --git a/apps/files_external/tests/Storage/SmbTest.php b/apps/files_external/tests/Storage/SmbTest.php index 437ef9a1cdf..d5a83905112 100644 --- a/apps/files_external/tests/Storage/SmbTest.php +++ b/apps/files_external/tests/Storage/SmbTest.php @@ -54,14 +54,14 @@ class SmbTest extends \Test\Files\Storage\Storage { return [['folder']]; } - public function testRenameWithSpaces() { + public function testRenameWithSpaces(): void { $this->instance->mkdir('with spaces'); $result = $this->instance->rename('with spaces', 'foo bar'); $this->assertTrue($result); $this->assertTrue($this->instance->is_dir('foo bar')); } - public function testStorageId() { + public function testStorageId(): void { $this->instance = new SMB([ 'host' => 'testhost', 'user' => 'testuser', @@ -73,7 +73,7 @@ class SmbTest extends \Test\Files\Storage\Storage { $this->instance = null; } - public function testNotifyGetChanges() { + public function testNotifyGetChanges(): void { $lastError = null; for ($i = 0; $i < 5; $i++) { try { @@ -130,7 +130,7 @@ class SmbTest extends \Test\Files\Storage\Storage { } } - public function testNotifyListen() { + public function testNotifyListen(): void { $notifyHandler = $this->instance->notify(''); usleep(100 * 1000); //give time for the notify to start $this->instance->file_put_contents('/newfile.txt', 'test content'); @@ -153,7 +153,7 @@ class SmbTest extends \Test\Files\Storage\Storage { } } - public function testRenameRoot() { + public function testRenameRoot(): void { // root can't be renamed $this->assertFalse($this->instance->rename('', 'foo1')); @@ -162,12 +162,12 @@ class SmbTest extends \Test\Files\Storage\Storage { $this->instance->rmdir('foo2'); } - public function testUnlinkRoot() { + public function testUnlinkRoot(): void { // root can't be deleted $this->assertFalse($this->instance->unlink('')); } - public function testRmdirRoot() { + public function testRmdirRoot(): void { // root can't be deleted $this->assertFalse($this->instance->rmdir('')); } diff --git a/apps/files_external/tests/Storage/SwiftTest.php b/apps/files_external/tests/Storage/SwiftTest.php index 53ca499e4eb..c21c8c6f506 100644 --- a/apps/files_external/tests/Storage/SwiftTest.php +++ b/apps/files_external/tests/Storage/SwiftTest.php @@ -53,7 +53,7 @@ class SwiftTest extends \Test\Files\Storage\Storage { parent::tearDown(); } - public function testStat() { + public function testStat(): void { $this->markTestSkipped('Swift doesn\'t update the parents folder mtime'); } } diff --git a/apps/files_external/tests/Storage/WebdavTest.php b/apps/files_external/tests/Storage/WebdavTest.php index a063ddebb0d..872f1b5d0e2 100644 --- a/apps/files_external/tests/Storage/WebdavTest.php +++ b/apps/files_external/tests/Storage/WebdavTest.php @@ -41,7 +41,7 @@ class WebdavTest extends \Test\Files\Storage\Storage { parent::tearDown(); } - public function testMimetypeFallback() { + public function testMimetypeFallback(): void { $this->instance->file_put_contents('foo.bar', 'asd'); /** @var Detection $mimeDetector */ diff --git a/apps/files_external/tests/StorageConfigTest.php b/apps/files_external/tests/StorageConfigTest.php index fbbd9de94be..b67d69a3ce7 100644 --- a/apps/files_external/tests/StorageConfigTest.php +++ b/apps/files_external/tests/StorageConfigTest.php @@ -12,7 +12,7 @@ use OCA\Files_External\Lib\DefinitionParameter; use OCA\Files_External\Lib\StorageConfig; class StorageConfigTest extends \Test\TestCase { - public function testJsonSerialization() { + public function testJsonSerialization(): void { $backend = $this->getMockBuilder(Backend::class) ->disableOriginalConstructor() ->getMock(); |