diff options
Diffstat (limited to 'tests/Core')
63 files changed, 279 insertions, 279 deletions
diff --git a/tests/Core/Command/Config/App/DeleteConfigTest.php b/tests/Core/Command/Config/App/DeleteConfigTest.php index 643c7ca3ca1..ebbbb15e1b6 100644 --- a/tests/Core/Command/Config/App/DeleteConfigTest.php +++ b/tests/Core/Command/Config/App/DeleteConfigTest.php @@ -80,7 +80,7 @@ class DeleteConfigTest extends TestCase { * @param int $expectedReturn * @param string $expectedMessage */ - public function testDelete($configName, $configExists, $checkIfExists, $expectedReturn, $expectedMessage) { + public function testDelete($configName, $configExists, $checkIfExists, $expectedReturn, $expectedMessage): void { $this->config->expects(($checkIfExists) ? $this->once() : $this->never()) ->method('getAppKeys') ->with('app-name') diff --git a/tests/Core/Command/Config/App/GetConfigTest.php b/tests/Core/Command/Config/App/GetConfigTest.php index 150fceca92f..c1a6265db40 100644 --- a/tests/Core/Command/Config/App/GetConfigTest.php +++ b/tests/Core/Command/Config/App/GetConfigTest.php @@ -94,7 +94,7 @@ class GetConfigTest extends TestCase { * @param int $expectedReturn * @param string $expectedMessage */ - public function testGet($configName, $value, $configExists, $defaultValue, $hasDefault, $outputFormat, $expectedReturn, $expectedMessage) { + public function testGet($configName, $value, $configExists, $defaultValue, $hasDefault, $outputFormat, $expectedReturn, $expectedMessage): void { if (!$expectedReturn) { if ($configExists) { $this->config->expects($this->once()) diff --git a/tests/Core/Command/Config/App/SetConfigTest.php b/tests/Core/Command/Config/App/SetConfigTest.php index 6563dd13fc2..1d599bf3234 100644 --- a/tests/Core/Command/Config/App/SetConfigTest.php +++ b/tests/Core/Command/Config/App/SetConfigTest.php @@ -72,7 +72,7 @@ class SetConfigTest extends TestCase { * @param bool $updated * @param string $expectedMessage */ - public function testSet($configName, $newValue, $configExists, $updateOnly, $updated, $expectedMessage) { + public function testSet($configName, $newValue, $configExists, $updateOnly, $updated, $expectedMessage): void { $this->config->expects($this->any()) ->method('hasKey') ->with('app-name', $configName) diff --git a/tests/Core/Command/Config/ImportTest.php b/tests/Core/Command/Config/ImportTest.php index 91485955e60..0077f84f82b 100644 --- a/tests/Core/Command/Config/ImportTest.php +++ b/tests/Core/Command/Config/ImportTest.php @@ -53,7 +53,7 @@ class ImportTest extends TestCase { * * @param mixed $configValue */ - public function testValidateAppsArray($configValue) { + public function testValidateAppsArray($configValue): void { $this->invokePrivate($this->command, 'validateAppsArray', [['app' => ['name' => $configValue]]]); $this->assertTrue(true, 'Asserting that no exception is thrown'); } @@ -72,7 +72,7 @@ class ImportTest extends TestCase { * * @param mixed $configValue */ - public function testValidateAppsArrayThrows($configValue) { + public function testValidateAppsArrayThrows($configValue): void { try { $this->invokePrivate($this->command, 'validateAppsArray', [['app' => ['name' => $configValue]]]); $this->fail('Did not throw expected UnexpectedValueException'); @@ -102,7 +102,7 @@ class ImportTest extends TestCase { * * @param mixed $configValue */ - public function testCheckTypeRecursively($configValue) { + public function testCheckTypeRecursively($configValue): void { $this->invokePrivate($this->command, 'checkTypeRecursively', [$configValue, 'name']); $this->assertTrue(true, 'Asserting that no exception is thrown'); } @@ -121,7 +121,7 @@ class ImportTest extends TestCase { * * @param mixed $configValue */ - public function testCheckTypeRecursivelyThrows($configValue) { + public function testCheckTypeRecursivelyThrows($configValue): void { try { $this->invokePrivate($this->command, 'checkTypeRecursively', [$configValue, 'name']); $this->fail('Did not throw expected UnexpectedValueException'); @@ -143,7 +143,7 @@ class ImportTest extends TestCase { * * @param array $configArray */ - public function testValidateArray($configArray) { + public function testValidateArray($configArray): void { $this->invokePrivate($this->command, 'validateArray', [$configArray]); $this->assertTrue(true, 'Asserting that no exception is thrown'); } @@ -162,7 +162,7 @@ class ImportTest extends TestCase { * @param mixed $configArray * @param string $expectedException */ - public function testValidateArrayThrows($configArray, $expectedException) { + public function testValidateArrayThrows($configArray, $expectedException): void { try { $this->invokePrivate($this->command, 'validateArray', [$configArray]); $this->fail('Did not throw expected UnexpectedValueException'); diff --git a/tests/Core/Command/Config/ListConfigsTest.php b/tests/Core/Command/Config/ListConfigsTest.php index 8b6fdf39192..0cee870d45c 100644 --- a/tests/Core/Command/Config/ListConfigsTest.php +++ b/tests/Core/Command/Config/ListConfigsTest.php @@ -262,7 +262,7 @@ class ListConfigsTest extends TestCase { * @param bool $private * @param string $expected */ - public function testList($app, $systemConfigs, $systemConfigMap, $appConfig, $private, $expected) { + public function testList($app, $systemConfigs, $systemConfigMap, $appConfig, $private, $expected): void { $this->systemConfig->expects($this->any()) ->method('getKeys') ->willReturn($systemConfigs); diff --git a/tests/Core/Command/Config/System/DeleteConfigTest.php b/tests/Core/Command/Config/System/DeleteConfigTest.php index 9b5b018687e..872079ef4c2 100644 --- a/tests/Core/Command/Config/System/DeleteConfigTest.php +++ b/tests/Core/Command/Config/System/DeleteConfigTest.php @@ -80,7 +80,7 @@ class DeleteConfigTest extends TestCase { * @param int $expectedReturn * @param string $expectedMessage */ - public function testDelete($configName, $configExists, $checkIfExists, $expectedReturn, $expectedMessage) { + public function testDelete($configName, $configExists, $checkIfExists, $expectedReturn, $expectedMessage): void { $this->systemConfig->expects(($checkIfExists) ? $this->once() : $this->never()) ->method('getKeys') ->willReturn($configExists ? [$configName] : []); @@ -175,7 +175,7 @@ class DeleteConfigTest extends TestCase { * @param int $expectedReturn * @param string $expectedMessage */ - public function testArrayDelete(array $configNames, $configKeyExists, $checkIfKeyExists, $configValue, $updateValue, $expectedReturn, $expectedMessage) { + public function testArrayDelete(array $configNames, $configKeyExists, $checkIfKeyExists, $configValue, $updateValue, $expectedReturn, $expectedMessage): void { $this->systemConfig->expects(($checkIfKeyExists) ? $this->once() : $this->never()) ->method('getKeys') ->willReturn($configKeyExists ? [$configNames[0]] : []); diff --git a/tests/Core/Command/Config/System/GetConfigTest.php b/tests/Core/Command/Config/System/GetConfigTest.php index db96331680b..f05d0e384ee 100644 --- a/tests/Core/Command/Config/System/GetConfigTest.php +++ b/tests/Core/Command/Config/System/GetConfigTest.php @@ -99,7 +99,7 @@ class GetConfigTest extends TestCase { * @param int $expectedReturn * @param string $expectedMessage */ - public function testGet($configNames, $value, $configExists, $defaultValue, $hasDefault, $outputFormat, $expectedReturn, $expectedMessage) { + public function testGet($configNames, $value, $configExists, $defaultValue, $hasDefault, $outputFormat, $expectedReturn, $expectedMessage): void { if (is_array($configNames)) { $configName = $configNames[0]; } else { diff --git a/tests/Core/Command/Config/System/SetConfigTest.php b/tests/Core/Command/Config/System/SetConfigTest.php index d5c54a5e720..2905af5c3d7 100644 --- a/tests/Core/Command/Config/System/SetConfigTest.php +++ b/tests/Core/Command/Config/System/SetConfigTest.php @@ -55,7 +55,7 @@ class SetConfigTest extends TestCase { * @param mixed $existingData * @param mixed $expectedValue */ - public function testSet($configNames, $newValue, $existingData, $expectedValue) { + public function testSet($configNames, $newValue, $existingData, $expectedValue): void { $this->systemConfig->expects($this->once()) ->method('setValue') ->with($configNames[0], $expectedValue); @@ -88,7 +88,7 @@ class SetConfigTest extends TestCase { /** * @dataProvider setUpdateOnlyProvider */ - public function testSetUpdateOnly($configNames, $existingData) { + public function testSetUpdateOnly($configNames, $existingData): void { $this->expectException(\UnexpectedValueException::class); $this->systemConfig->expects($this->never()) @@ -135,7 +135,7 @@ class SetConfigTest extends TestCase { /** * @dataProvider castValueProvider */ - public function testCastValue($value, $type, $expectedValue) { + public function testCastValue($value, $type, $expectedValue): void { $this->assertSame($expectedValue, $this->invokePrivate($this->command, 'castValue', [$value, $type]) ); @@ -156,7 +156,7 @@ class SetConfigTest extends TestCase { /** * @dataProvider castValueInvalidProvider */ - public function testCastValueInvalid($value, $type) { + public function testCastValueInvalid($value, $type): void { $this->expectException(\InvalidArgumentException::class); $this->invokePrivate($this->command, 'castValue', [$value, $type]); diff --git a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php index 85271565192..b124a27f9ab 100644 --- a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php +++ b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php @@ -79,7 +79,7 @@ class ChangeKeyStorageRootTest extends TestCase { /** * @dataProvider dataTestExecute */ - public function testExecute($newRoot, $answer, $successMoveKey) { + public function testExecute($newRoot, $answer, $successMoveKey): void { $changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot') ->setConstructorArgs( [ @@ -132,7 +132,7 @@ class ChangeKeyStorageRootTest extends TestCase { ]; } - public function testMoveAllKeys() { + public function testMoveAllKeys(): void { /** @var \OC\Core\Command\Encryption\ChangeKeyStorageRoot $changeKeyStorageRoot */ $changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot') ->setConstructorArgs( @@ -152,7 +152,7 @@ class ChangeKeyStorageRootTest extends TestCase { $this->invokePrivate($changeKeyStorageRoot, 'moveAllKeys', ['oldRoot', 'newRoot', $this->outputInterface]); } - public function testPrepareNewRoot() { + public function testPrepareNewRoot(): void { $this->view->expects($this->once())->method('is_dir')->with('newRoot') ->willReturn(true); @@ -169,7 +169,7 @@ class ChangeKeyStorageRootTest extends TestCase { * @param bool $dirExists * @param bool $couldCreateFile */ - public function testPrepareNewRootException($dirExists, $couldCreateFile) { + public function testPrepareNewRootException($dirExists, $couldCreateFile): void { $this->expectException(\Exception::class); $this->view->expects($this->once())->method('is_dir')->with('newRoot') @@ -194,7 +194,7 @@ class ChangeKeyStorageRootTest extends TestCase { * @param bool $targetExists * @param bool $executeRename */ - public function testMoveSystemKeys($dirExists, $targetExists, $executeRename) { + public function testMoveSystemKeys($dirExists, $targetExists, $executeRename): void { $changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot') ->setConstructorArgs( [ @@ -231,7 +231,7 @@ class ChangeKeyStorageRootTest extends TestCase { } - public function testMoveUserKeys() { + public function testMoveUserKeys(): void { $changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot') ->setConstructorArgs( [ @@ -261,7 +261,7 @@ class ChangeKeyStorageRootTest extends TestCase { * @param bool $targetExists * @param bool $shouldRename */ - public function testMoveUserEncryptionFolder($userExists, $isDir, $targetExists, $shouldRename) { + public function testMoveUserEncryptionFolder($userExists, $isDir, $targetExists, $shouldRename): void { $changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot') ->setConstructorArgs( [ @@ -309,7 +309,7 @@ class ChangeKeyStorageRootTest extends TestCase { /** * @dataProvider dataTestPrepareParentFolder */ - public function testPrepareParentFolder($path, $pathExists) { + public function testPrepareParentFolder($path, $pathExists): void { $this->view->expects($this->any())->method('file_exists') ->willReturnCallback( function ($fileExistsPath) use ($path, $pathExists) { @@ -341,7 +341,7 @@ class ChangeKeyStorageRootTest extends TestCase { ]; } - public function testTargetExists() { + public function testTargetExists(): void { $this->view->expects($this->once())->method('file_exists')->with('path') ->willReturn(false); @@ -351,7 +351,7 @@ class ChangeKeyStorageRootTest extends TestCase { } - public function testTargetExistsException() { + public function testTargetExistsException(): void { $this->expectException(\Exception::class); $this->view->expects($this->once())->method('file_exists')->with('path') diff --git a/tests/Core/Command/Encryption/DecryptAllTest.php b/tests/Core/Command/Encryption/DecryptAllTest.php index 46cd2cfc4bc..6ed4cbbea99 100644 --- a/tests/Core/Command/Encryption/DecryptAllTest.php +++ b/tests/Core/Command/Encryption/DecryptAllTest.php @@ -70,7 +70,7 @@ class DecryptAllTest extends TestCase { ->with('files_trashbin')->willReturn(true); } - public function testMaintenanceAndTrashbin() { + public function testMaintenanceAndTrashbin(): void { // on construct we enable single-user-mode and disable the trash bin // on destruct we disable single-user-mode again and enable the trash bin $this->config->expects($this->exactly(2)) @@ -108,7 +108,7 @@ class DecryptAllTest extends TestCase { /** * @dataProvider dataTestExecute */ - public function testExecute($encryptionEnabled, $continue) { + public function testExecute($encryptionEnabled, $continue): void { $instance = new DecryptAll( $this->encryptionManager, $this->appManager, @@ -162,7 +162,7 @@ class DecryptAllTest extends TestCase { } - public function testExecuteFailure() { + public function testExecuteFailure(): void { $this->expectException(\Exception::class); $instance = new DecryptAll( diff --git a/tests/Core/Command/Encryption/DisableTest.php b/tests/Core/Command/Encryption/DisableTest.php index 6c962399e11..913d03a8850 100644 --- a/tests/Core/Command/Encryption/DisableTest.php +++ b/tests/Core/Command/Encryption/DisableTest.php @@ -52,7 +52,7 @@ class DisableTest extends TestCase { * @param bool $isUpdating * @param string $expectedString */ - public function testDisable($oldStatus, $isUpdating, $expectedString) { + public function testDisable($oldStatus, $isUpdating, $expectedString): void { $this->config->expects($this->once()) ->method('getAppValue') ->with('core', 'encryption_enabled', $this->anything()) diff --git a/tests/Core/Command/Encryption/EnableTest.php b/tests/Core/Command/Encryption/EnableTest.php index b535c80b0a8..2d463452add 100644 --- a/tests/Core/Command/Encryption/EnableTest.php +++ b/tests/Core/Command/Encryption/EnableTest.php @@ -65,7 +65,7 @@ class EnableTest extends TestCase { * @param string $expectedString * @param string $expectedDefaultModuleString */ - public function testEnable($oldStatus, $defaultModule, $availableModules, $isUpdating, $expectedString, $expectedDefaultModuleString) { + public function testEnable($oldStatus, $defaultModule, $availableModules, $isUpdating, $expectedString, $expectedDefaultModuleString): void { if ($isUpdating) { $this->config->expects($this->once()) ->method('setAppValue') diff --git a/tests/Core/Command/Encryption/EncryptAllTest.php b/tests/Core/Command/Encryption/EncryptAllTest.php index 994aa43a938..933f919ba7f 100644 --- a/tests/Core/Command/Encryption/EncryptAllTest.php +++ b/tests/Core/Command/Encryption/EncryptAllTest.php @@ -67,7 +67,7 @@ class EncryptAllTest extends TestCase { $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); } - public function testEncryptAll() { + public function testEncryptAll(): void { // trash bin needs to be disabled in order to avoid adding dummy files to the users // trash bin which gets deleted during the encryption process $this->appManager->expects($this->once())->method('disableApp')->with('files_trashbin'); @@ -89,7 +89,7 @@ class EncryptAllTest extends TestCase { /** * @dataProvider dataTestExecute */ - public function testExecute($answer, $askResult) { + public function testExecute($answer, $askResult): void { $command = new EncryptAll($this->encryptionManager, $this->appManager, $this->config, $this->questionHelper); $this->encryptionManager->expects($this->once())->method('isEnabled')->willReturn(true); @@ -115,7 +115,7 @@ class EncryptAllTest extends TestCase { } - public function testExecuteException() { + public function testExecuteException(): void { $this->expectException(\Exception::class); $command = new EncryptAll($this->encryptionManager, $this->appManager, $this->config, $this->questionHelper); diff --git a/tests/Core/Command/Encryption/SetDefaultModuleTest.php b/tests/Core/Command/Encryption/SetDefaultModuleTest.php index 9c4259fb04e..0a2c2a81c28 100644 --- a/tests/Core/Command/Encryption/SetDefaultModuleTest.php +++ b/tests/Core/Command/Encryption/SetDefaultModuleTest.php @@ -60,7 +60,7 @@ class SetDefaultModuleTest extends TestCase { * @param bool $updateSuccess * @param string $expectedString */ - public function testSetDefaultModule($oldModule, $newModule, $updateModule, $updateSuccess, $expectedString) { + public function testSetDefaultModule($oldModule, $newModule, $updateModule, $updateSuccess, $expectedString): void { $this->consoleInput->expects($this->once()) ->method('getArgument') ->with('module') @@ -98,7 +98,7 @@ class SetDefaultModuleTest extends TestCase { * @param bool $updateSuccess * @param string $expectedString */ - public function testMaintenanceMode($oldModule, $newModule, $updateModule, $updateSuccess, $expectedString) { + public function testMaintenanceMode($oldModule, $newModule, $updateModule, $updateSuccess, $expectedString): void { $this->consoleInput->expects($this->never()) ->method('getArgument') ->with('module') diff --git a/tests/Core/Command/Group/AddTest.php b/tests/Core/Command/Group/AddTest.php index 76ef4a74f6a..c953199766f 100644 --- a/tests/Core/Command/Group/AddTest.php +++ b/tests/Core/Command/Group/AddTest.php @@ -43,7 +43,7 @@ class AddTest extends TestCase { $this->output = $this->createMock(OutputInterface::class); } - public function testGroupExists() { + public function testGroupExists(): void { $gid = 'myGroup'; $group = $this->createMock(IGroup::class); $this->groupManager->method('get') @@ -59,7 +59,7 @@ class AddTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - public function testAdd() { + public function testAdd(): void { $gid = 'myGroup'; $group = $this->createMock(IGroup::class); $group->method('getGID') diff --git a/tests/Core/Command/Group/AddUserTest.php b/tests/Core/Command/Group/AddUserTest.php index 8c8f4902a16..4bbf54f7b3f 100644 --- a/tests/Core/Command/Group/AddUserTest.php +++ b/tests/Core/Command/Group/AddUserTest.php @@ -51,7 +51,7 @@ class AddUserTest extends TestCase { $this->output = $this->createMock(OutputInterface::class); } - public function testNoGroup() { + public function testNoGroup(): void { $this->groupManager->method('get') ->with('myGroup') ->willReturn(null); @@ -63,7 +63,7 @@ class AddUserTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - public function testNoUser() { + public function testNoUser(): void { $group = $this->createMock(IGroup::class); $this->groupManager->method('get') ->with('myGroup') @@ -80,7 +80,7 @@ class AddUserTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - public function testAdd() { + public function testAdd(): void { $group = $this->createMock(IGroup::class); $this->groupManager->method('get') ->with('myGroup') diff --git a/tests/Core/Command/Group/DeleteTest.php b/tests/Core/Command/Group/DeleteTest.php index fe1aaff64bc..4b4f16feb76 100644 --- a/tests/Core/Command/Group/DeleteTest.php +++ b/tests/Core/Command/Group/DeleteTest.php @@ -36,7 +36,7 @@ class DeleteTest extends TestCase { $this->output = $this->createMock(OutputInterface::class); } - public function testDoesNotExists() { + public function testDoesNotExists(): void { $gid = 'myGroup'; $this->input->method('getArgument') ->willReturnCallback(function ($arg) use ($gid) { @@ -58,7 +58,7 @@ class DeleteTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - public function testDeleteAdmin() { + public function testDeleteAdmin(): void { $gid = 'admin'; $this->input->method('getArgument') ->willReturnCallback(function ($arg) use ($gid) { @@ -77,7 +77,7 @@ class DeleteTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - public function testDeleteFailed() { + public function testDeleteFailed(): void { $gid = 'myGroup'; $this->input->method('getArgument') ->willReturnCallback(function ($arg) use ($gid) { @@ -103,7 +103,7 @@ class DeleteTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - public function testDelete() { + public function testDelete(): void { $gid = 'myGroup'; $this->input->method('getArgument') ->willReturnCallback(function ($arg) use ($gid) { diff --git a/tests/Core/Command/Group/InfoTest.php b/tests/Core/Command/Group/InfoTest.php index 6f5a9cce02b..869b6741866 100644 --- a/tests/Core/Command/Group/InfoTest.php +++ b/tests/Core/Command/Group/InfoTest.php @@ -39,7 +39,7 @@ class InfoTest extends TestCase { $this->output = $this->createMock(OutputInterface::class); } - public function testDoesNotExists() { + public function testDoesNotExists(): void { $gid = 'myGroup'; $this->input->method('getArgument') ->willReturnCallback(function ($arg) use ($gid) { @@ -59,7 +59,7 @@ class InfoTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - public function testInfo() { + public function testInfo(): void { $gid = 'myGroup'; $this->input->method('getArgument') ->willReturnCallback(function ($arg) use ($gid) { diff --git a/tests/Core/Command/Group/ListCommandTest.php b/tests/Core/Command/Group/ListCommandTest.php index a995bdc0b20..93d472af388 100644 --- a/tests/Core/Command/Group/ListCommandTest.php +++ b/tests/Core/Command/Group/ListCommandTest.php @@ -40,7 +40,7 @@ class ListCommandTest extends TestCase { $this->output = $this->createMock(OutputInterface::class); } - public function testExecute() { + public function testExecute(): void { $group1 = $this->createMock(IGroup::class); $group1->method('getGID')->willReturn('group1'); $group2 = $this->createMock(IGroup::class); @@ -109,7 +109,7 @@ class ListCommandTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - public function testInfo() { + public function testInfo(): void { $group1 = $this->createMock(IGroup::class); $group1->method('getGID')->willReturn('group1'); $group1->method('getDisplayName')->willReturn('Group 1'); diff --git a/tests/Core/Command/Group/RemoveUserTest.php b/tests/Core/Command/Group/RemoveUserTest.php index 47c782b6f44..98fe41784f1 100644 --- a/tests/Core/Command/Group/RemoveUserTest.php +++ b/tests/Core/Command/Group/RemoveUserTest.php @@ -51,7 +51,7 @@ class RemoveUserTest extends TestCase { $this->output = $this->createMock(OutputInterface::class); } - public function testNoGroup() { + public function testNoGroup(): void { $this->groupManager->method('get') ->with('myGroup') ->willReturn(null); @@ -63,7 +63,7 @@ class RemoveUserTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - public function testNoUser() { + public function testNoUser(): void { $group = $this->createMock(IGroup::class); $this->groupManager->method('get') ->with('myGroup') @@ -80,7 +80,7 @@ class RemoveUserTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - public function testAdd() { + public function testAdd(): void { $group = $this->createMock(IGroup::class); $this->groupManager->method('get') ->with('myGroup') diff --git a/tests/Core/Command/Log/FileTest.php b/tests/Core/Command/Log/FileTest.php index 35db7c6d718..08ff01e019d 100644 --- a/tests/Core/Command/Log/FileTest.php +++ b/tests/Core/Command/Log/FileTest.php @@ -36,7 +36,7 @@ class FileTest extends TestCase { $this->command = new File($config); } - public function testEnable() { + public function testEnable(): void { $this->config->method('getSystemValue')->willReturnArgument(1); $this->consoleInput->method('getOption') ->willReturnMap([ @@ -49,7 +49,7 @@ class FileTest extends TestCase { self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } - public function testChangeFile() { + public function testChangeFile(): void { $this->config->method('getSystemValue')->willReturnArgument(1); $this->consoleInput->method('getOption') ->willReturnMap([ @@ -74,7 +74,7 @@ class FileTest extends TestCase { /** * @dataProvider changeRotateSizeProvider */ - public function testChangeRotateSize($optionValue, $configValue) { + public function testChangeRotateSize($optionValue, $configValue): void { $this->config->method('getSystemValue')->willReturnArgument(1); $this->consoleInput->method('getOption') ->willReturnMap([ @@ -87,7 +87,7 @@ class FileTest extends TestCase { self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } - public function testGetConfiguration() { + public function testGetConfiguration(): void { $this->config->method('getSystemValue') ->willReturnMap([ ['log_type', 'file', 'log_type_value'], diff --git a/tests/Core/Command/Log/ManageTest.php b/tests/Core/Command/Log/ManageTest.php index 5cba6dd626f..b354bb17076 100644 --- a/tests/Core/Command/Log/ManageTest.php +++ b/tests/Core/Command/Log/ManageTest.php @@ -36,7 +36,7 @@ class ManageTest extends TestCase { $this->command = new Manage($config); } - public function testChangeBackend() { + public function testChangeBackend(): void { $this->consoleInput->method('getOption') ->willReturnMap([ ['backend', 'syslog'] @@ -48,7 +48,7 @@ class ManageTest extends TestCase { self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } - public function testChangeLevel() { + public function testChangeLevel(): void { $this->consoleInput->method('getOption') ->willReturnMap([ ['level', 'debug'] @@ -60,7 +60,7 @@ class ManageTest extends TestCase { self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } - public function testChangeTimezone() { + public function testChangeTimezone(): void { $this->consoleInput->method('getOption') ->willReturnMap([ ['timezone', 'UTC'] @@ -73,14 +73,14 @@ class ManageTest extends TestCase { } - public function testValidateBackend() { + public function testValidateBackend(): void { $this->expectException(\InvalidArgumentException::class); self::invokePrivate($this->command, 'validateBackend', ['notabackend']); } - public function testValidateTimezone() { + public function testValidateTimezone(): void { $this->expectException(\Exception::class); // this might need to be changed when humanity colonises Mars @@ -102,14 +102,14 @@ class ManageTest extends TestCase { /** * @dataProvider convertLevelStringProvider */ - public function testConvertLevelString($levelString, $expectedInt) { + public function testConvertLevelString($levelString, $expectedInt): void { $this->assertEquals($expectedInt, self::invokePrivate($this->command, 'convertLevelString', [$levelString]) ); } - public function testConvertLevelStringInvalid() { + public function testConvertLevelStringInvalid(): void { $this->expectException(\InvalidArgumentException::class); self::invokePrivate($this->command, 'convertLevelString', ['abc']); @@ -128,20 +128,20 @@ class ManageTest extends TestCase { /** * @dataProvider convertLevelNumberProvider */ - public function testConvertLevelNumber($levelNum, $expectedString) { + public function testConvertLevelNumber($levelNum, $expectedString): void { $this->assertEquals($expectedString, self::invokePrivate($this->command, 'convertLevelNumber', [$levelNum]) ); } - public function testConvertLevelNumberInvalid() { + public function testConvertLevelNumberInvalid(): void { $this->expectException(\InvalidArgumentException::class); self::invokePrivate($this->command, 'convertLevelNumber', [11]); } - public function testGetConfiguration() { + public function testGetConfiguration(): void { $this->config->expects($this->exactly(3)) ->method('getSystemValue') ->withConsecutive( diff --git a/tests/Core/Command/Maintenance/DataFingerprintTest.php b/tests/Core/Command/Maintenance/DataFingerprintTest.php index 03cf37b8f48..3d56d891bef 100644 --- a/tests/Core/Command/Maintenance/DataFingerprintTest.php +++ b/tests/Core/Command/Maintenance/DataFingerprintTest.php @@ -39,7 +39,7 @@ class DataFingerprintTest extends TestCase { $this->command = new DataFingerprint($this->config, $this->timeFactory); } - public function testSetFingerPrint() { + public function testSetFingerPrint(): void { $this->timeFactory->expects($this->once()) ->method('getTime') ->willReturn(42); diff --git a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php index a4169907167..d8c82de19ac 100644 --- a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php +++ b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php @@ -46,7 +46,7 @@ class UpdateDBTest extends TestCase { $this->command = new UpdateDB($this->detector, $this->loader); } - public function testNoop() { + public function testNoop(): void { $this->consoleInput->method('getOption') ->with('repair-filecache') ->willReturn(false); @@ -74,7 +74,7 @@ class UpdateDBTest extends TestCase { self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } - public function testAddMimetype() { + public function testAddMimetype(): void { $this->consoleInput->method('getOption') ->with('repair-filecache') ->willReturn(false); @@ -115,7 +115,7 @@ class UpdateDBTest extends TestCase { self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } - public function testSkipComments() { + public function testSkipComments(): void { $this->detector->expects($this->once()) ->method('getAllMappings') ->willReturn([ @@ -127,7 +127,7 @@ class UpdateDBTest extends TestCase { self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } - public function testRepairFilecache() { + public function testRepairFilecache(): void { $this->consoleInput->method('getOption') ->with('repair-filecache') ->willReturn(true); diff --git a/tests/Core/Command/Maintenance/ModeTest.php b/tests/Core/Command/Maintenance/ModeTest.php index 08ca1762da1..59b8bbfc045 100644 --- a/tests/Core/Command/Maintenance/ModeTest.php +++ b/tests/Core/Command/Maintenance/ModeTest.php @@ -124,7 +124,7 @@ class ModeTest extends TestCase { bool $currentMaintenanceState, $expectedMaintenanceState, string $expectedOutput - ) { + ): void { $this->config->expects($this->any()) ->method('getSystemValueBool') ->willReturn($currentMaintenanceState); diff --git a/tests/Core/Command/Maintenance/UpdateTheme.php b/tests/Core/Command/Maintenance/UpdateTheme.php index 25229b8997a..41b95d358d3 100644 --- a/tests/Core/Command/Maintenance/UpdateTheme.php +++ b/tests/Core/Command/Maintenance/UpdateTheme.php @@ -42,7 +42,7 @@ class UpdateThemeTest extends TestCase { $this->command = new UpdateTheme($this->detector, $this->cacheFactory); } - public function testThemeUpdate() { + public function testThemeUpdate(): void { $this->consoleInput->method('getOption') ->with('maintenance:theme:update') ->willReturn(true); diff --git a/tests/Core/Command/Preview/RepairTest.php b/tests/Core/Command/Preview/RepairTest.php index 4717ee05f09..e54f4dde3ad 100644 --- a/tests/Core/Command/Preview/RepairTest.php +++ b/tests/Core/Command/Preview/RepairTest.php @@ -116,7 +116,7 @@ class RepairTest extends TestCase { /** * @dataProvider emptyTestDataProvider */ - public function testEmptyExecute($directoryNames, $expectedOutput) { + public function testEmptyExecute($directoryNames, $expectedOutput): void { $previewFolder = $this->getMockBuilder(Folder::class) ->getMock(); $directories = array_map(function ($element) { diff --git a/tests/Core/Command/SystemTag/AddTest.php b/tests/Core/Command/SystemTag/AddTest.php index 921b875dc4e..4dd0df7ffe0 100644 --- a/tests/Core/Command/SystemTag/AddTest.php +++ b/tests/Core/Command/SystemTag/AddTest.php @@ -40,7 +40,7 @@ class AddTest extends TestCase { $this->output = $this->createMock(OutputInterface::class); } - public function testExecute() { + public function testExecute(): void { $tagId = '42'; $tagName = 'wichtig'; $tagAccess = 'public'; @@ -82,7 +82,7 @@ class AddTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - public function testAlreadyExists() { + public function testAlreadyExists(): void { $tagId = '42'; $tagName = 'wichtig'; $tagAccess = 'public'; diff --git a/tests/Core/Command/SystemTag/DeleteTest.php b/tests/Core/Command/SystemTag/DeleteTest.php index a2ec3767272..78d073db6d6 100644 --- a/tests/Core/Command/SystemTag/DeleteTest.php +++ b/tests/Core/Command/SystemTag/DeleteTest.php @@ -39,7 +39,7 @@ class DeleteTest extends TestCase { $this->output = $this->createMock(OutputInterface::class); } - public function testExecute() { + public function testExecute(): void { $tagId = 69; $this->input->method('getArgument') @@ -57,7 +57,7 @@ class DeleteTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - public function testNotFound() { + public function testNotFound(): void { $tagId = 69; $this->input->method('getArgument') diff --git a/tests/Core/Command/SystemTag/EditTest.php b/tests/Core/Command/SystemTag/EditTest.php index 90a7df00753..1857da25ab0 100644 --- a/tests/Core/Command/SystemTag/EditTest.php +++ b/tests/Core/Command/SystemTag/EditTest.php @@ -40,7 +40,7 @@ class EditTest extends TestCase { $this->output = $this->createMock(OutputInterface::class); } - public function testExecute() { + public function testExecute(): void { $tagId = '5'; $tagName = 'unwichtige Dateien'; $newTagName = 'moderat wichtige Dateien'; @@ -93,7 +93,7 @@ class EditTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - public function testAlreadyExists() { + public function testAlreadyExists(): void { $tagId = '5'; $tagName = 'unwichtige Dateien'; $tagUserVisible = false; @@ -157,7 +157,7 @@ class EditTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - public function testNotFound() { + public function testNotFound(): void { $tagId = '404'; $this->input->method('getArgument') diff --git a/tests/Core/Command/SystemTag/ListCommandTest.php b/tests/Core/Command/SystemTag/ListCommandTest.php index c7e213a782c..9f4c4072ffc 100644 --- a/tests/Core/Command/SystemTag/ListCommandTest.php +++ b/tests/Core/Command/SystemTag/ListCommandTest.php @@ -39,7 +39,7 @@ class ListCommandTest extends TestCase { $this->output = $this->createMock(OutputInterface::class); } - public function testExecute() { + public function testExecute(): void { $tag1 = $this->createMock(ISystemTag::class); $tag1->method('getId')->willReturn('1'); $tag1->method('getName')->willReturn('public_tag'); diff --git a/tests/Core/Command/TwoFactorAuth/CleanupTest.php b/tests/Core/Command/TwoFactorAuth/CleanupTest.php index 040bc08a858..1d4731ff0c2 100644 --- a/tests/Core/Command/TwoFactorAuth/CleanupTest.php +++ b/tests/Core/Command/TwoFactorAuth/CleanupTest.php @@ -36,7 +36,7 @@ class CleanupTest extends TestCase { $this->cmd = new CommandTester($cmd); } - public function testCleanup() { + public function testCleanup(): void { $this->registry->expects($this->once()) ->method('cleanUp') ->with('u2f'); diff --git a/tests/Core/Command/TwoFactorAuth/DisableTest.php b/tests/Core/Command/TwoFactorAuth/DisableTest.php index b123d09848a..ab6b10f8964 100644 --- a/tests/Core/Command/TwoFactorAuth/DisableTest.php +++ b/tests/Core/Command/TwoFactorAuth/DisableTest.php @@ -37,7 +37,7 @@ class DisableTest extends TestCase { $this->command = new CommandTester($cmd); } - public function testInvalidUID() { + public function testInvalidUID(): void { $this->userManager->expects($this->once()) ->method('get') ->with('nope') @@ -52,7 +52,7 @@ class DisableTest extends TestCase { $this->assertStringContainsString('Invalid UID', $this->command->getDisplay()); } - public function testEnableNotSupported() { + public function testEnableNotSupported(): void { $user = $this->createMock(IUser::class); $this->userManager->expects($this->once()) ->method('get') @@ -72,7 +72,7 @@ class DisableTest extends TestCase { $this->assertStringContainsString('The provider does not support this operation', $this->command->getDisplay()); } - public function testEnabled() { + public function testEnabled(): void { $user = $this->createMock(IUser::class); $this->userManager->expects($this->once()) ->method('get') diff --git a/tests/Core/Command/TwoFactorAuth/EnableTest.php b/tests/Core/Command/TwoFactorAuth/EnableTest.php index f78085e72a1..7c34d6692c5 100644 --- a/tests/Core/Command/TwoFactorAuth/EnableTest.php +++ b/tests/Core/Command/TwoFactorAuth/EnableTest.php @@ -37,7 +37,7 @@ class EnableTest extends TestCase { $this->command = new CommandTester($cmd); } - public function testInvalidUID() { + public function testInvalidUID(): void { $this->userManager->expects($this->once()) ->method('get') ->with('nope') @@ -52,7 +52,7 @@ class EnableTest extends TestCase { $this->assertStringContainsString('Invalid UID', $this->command->getDisplay()); } - public function testEnableNotSupported() { + public function testEnableNotSupported(): void { $user = $this->createMock(IUser::class); $this->userManager->expects($this->once()) ->method('get') @@ -72,7 +72,7 @@ class EnableTest extends TestCase { $this->assertStringContainsString('The provider does not support this operation', $this->command->getDisplay()); } - public function testEnabled() { + public function testEnabled(): void { $user = $this->createMock(IUser::class); $this->userManager->expects($this->once()) ->method('get') diff --git a/tests/Core/Command/TwoFactorAuth/EnforceTest.php b/tests/Core/Command/TwoFactorAuth/EnforceTest.php index e709ca2c55a..03118772377 100644 --- a/tests/Core/Command/TwoFactorAuth/EnforceTest.php +++ b/tests/Core/Command/TwoFactorAuth/EnforceTest.php @@ -32,7 +32,7 @@ class EnforceTest extends TestCase { $this->command = new CommandTester($command); } - public function testEnforce() { + public function testEnforce(): void { $this->mandatoryTwoFactor->expects($this->once()) ->method('setState') ->with($this->equalTo(new EnforcementState(true))); @@ -49,7 +49,7 @@ class EnforceTest extends TestCase { $this->assertStringContainsString('Two-factor authentication is enforced for all users', $display); } - public function testEnforceForOneGroup() { + public function testEnforceForOneGroup(): void { $this->mandatoryTwoFactor->expects($this->once()) ->method('setState') ->with($this->equalTo(new EnforcementState(true, ['twofactorers']))); @@ -67,7 +67,7 @@ class EnforceTest extends TestCase { $this->assertStringContainsString('Two-factor authentication is enforced for members of the group(s) twofactorers', $display); } - public function testEnforceForAllExceptOneGroup() { + public function testEnforceForAllExceptOneGroup(): void { $this->mandatoryTwoFactor->expects($this->once()) ->method('setState') ->with($this->equalTo(new EnforcementState(true, [], ['yoloers']))); @@ -85,7 +85,7 @@ class EnforceTest extends TestCase { $this->assertStringContainsString('Two-factor authentication is enforced for all users, except members of yoloers', $display); } - public function testDisableEnforced() { + public function testDisableEnforced(): void { $this->mandatoryTwoFactor->expects($this->once()) ->method('setState') ->with(new EnforcementState(false)); @@ -102,7 +102,7 @@ class EnforceTest extends TestCase { $this->assertStringContainsString('Two-factor authentication is not enforced', $display); } - public function testCurrentStateEnabled() { + public function testCurrentStateEnabled(): void { $this->mandatoryTwoFactor->expects($this->once()) ->method('getState') ->willReturn(new EnforcementState(true)); @@ -114,7 +114,7 @@ class EnforceTest extends TestCase { $this->assertStringContainsString('Two-factor authentication is enforced for all users', $display); } - public function testCurrentStateDisabled() { + public function testCurrentStateDisabled(): void { $this->mandatoryTwoFactor->expects($this->once()) ->method('getState') ->willReturn(new EnforcementState(false)); diff --git a/tests/Core/Command/TwoFactorAuth/StateTest.php b/tests/Core/Command/TwoFactorAuth/StateTest.php index 1d97d152a21..f4ca3c4e031 100644 --- a/tests/Core/Command/TwoFactorAuth/StateTest.php +++ b/tests/Core/Command/TwoFactorAuth/StateTest.php @@ -37,7 +37,7 @@ class StateTest extends TestCase { $this->cmd = new CommandTester($cmd); } - public function testWrongUID() { + public function testWrongUID(): void { $this->cmd->execute([ 'uid' => 'nope', ]); @@ -46,7 +46,7 @@ class StateTest extends TestCase { $this->assertStringContainsString('Invalid UID', $output); } - public function testStateNoProvidersActive() { + public function testStateNoProvidersActive(): void { $user = $this->createMock(IUser::class); $this->userManager->expects($this->once()) ->method('get') @@ -69,7 +69,7 @@ class StateTest extends TestCase { $this->assertStringContainsString('Two-factor authentication is not enabled for user eldora', $output); } - public function testStateOneProviderActive() { + public function testStateOneProviderActive(): void { $user = $this->createMock(IUser::class); $this->userManager->expects($this->once()) ->method('get') diff --git a/tests/Core/Command/User/AuthTokens/DeleteTest.php b/tests/Core/Command/User/AuthTokens/DeleteTest.php index bd82475b206..8588c1d5d54 100644 --- a/tests/Core/Command/User/AuthTokens/DeleteTest.php +++ b/tests/Core/Command/User/AuthTokens/DeleteTest.php @@ -37,7 +37,7 @@ class DeleteTest extends TestCase { $this->command = new Delete($tokenProvider); } - public function testDeleteTokenById() { + public function testDeleteTokenById(): void { $this->consoleInput->expects($this->exactly(2)) ->method('getArgument') ->withConsecutive(['uid'], ['id']) @@ -56,7 +56,7 @@ class DeleteTest extends TestCase { $this->assertSame(Command::SUCCESS, $result); } - public function testDeleteTokenByIdRequiresTokenId() { + public function testDeleteTokenByIdRequiresTokenId(): void { $this->consoleInput->expects($this->exactly(2)) ->method('getArgument') ->withConsecutive(['uid'], ['id']) @@ -75,7 +75,7 @@ class DeleteTest extends TestCase { $this->assertSame(Command::FAILURE, $result); } - public function testDeleteTokensLastUsedBefore() { + public function testDeleteTokensLastUsedBefore(): void { $this->consoleInput->expects($this->exactly(2)) ->method('getArgument') ->withConsecutive(['uid'], ['id']) @@ -94,7 +94,7 @@ class DeleteTest extends TestCase { $this->assertSame(Command::SUCCESS, $result); } - public function testLastUsedBeforeAcceptsIso8601Expanded() { + public function testLastUsedBeforeAcceptsIso8601Expanded(): void { $this->consoleInput->expects($this->exactly(2)) ->method('getArgument') ->withConsecutive(['uid'], ['id']) @@ -113,7 +113,7 @@ class DeleteTest extends TestCase { $this->assertSame(Command::SUCCESS, $result); } - public function testLastUsedBeforeAcceptsYmd() { + public function testLastUsedBeforeAcceptsYmd(): void { $this->consoleInput->expects($this->exactly(2)) ->method('getArgument') ->withConsecutive(['uid'], ['id']) @@ -132,7 +132,7 @@ class DeleteTest extends TestCase { $this->assertSame(Command::SUCCESS, $result); } - public function testIdAndLastUsedBeforeAreMutuallyExclusive() { + public function testIdAndLastUsedBeforeAreMutuallyExclusive(): void { $this->consoleInput->expects($this->exactly(2)) ->method('getArgument') ->withConsecutive(['uid'], ['id']) diff --git a/tests/Core/Command/User/DeleteTest.php b/tests/Core/Command/User/DeleteTest.php index 74b98b0246a..42244412d9f 100644 --- a/tests/Core/Command/User/DeleteTest.php +++ b/tests/Core/Command/User/DeleteTest.php @@ -52,7 +52,7 @@ class DeleteTest extends TestCase { * @param bool $deleteSuccess * @param string $expectedString */ - public function testValidUser($deleteSuccess, $expectedString) { + public function testValidUser($deleteSuccess, $expectedString): void { $user = $this->getMockBuilder(IUser::class)->getMock(); $user->expects($this->once()) ->method('delete') @@ -75,7 +75,7 @@ class DeleteTest extends TestCase { self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } - public function testInvalidUser() { + public function testInvalidUser(): void { $this->userManager->expects($this->once()) ->method('get') ->with('user') diff --git a/tests/Core/Command/User/DisableTest.php b/tests/Core/Command/User/DisableTest.php index a080eb9379a..1e464ca93a5 100644 --- a/tests/Core/Command/User/DisableTest.php +++ b/tests/Core/Command/User/DisableTest.php @@ -34,7 +34,7 @@ class DisableTest extends TestCase { $this->command = new Disable($this->userManager); } - public function testValidUser() { + public function testValidUser(): void { $user = $this->createMock(IUser::class); $user->expects($this->once()) ->method('setEnabled') @@ -57,7 +57,7 @@ class DisableTest extends TestCase { self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } - public function testInvalidUser() { + public function testInvalidUser(): void { $this->userManager->expects($this->once()) ->method('get') ->with('user') diff --git a/tests/Core/Command/User/EnableTest.php b/tests/Core/Command/User/EnableTest.php index 39af10f2ef3..b590530d93d 100644 --- a/tests/Core/Command/User/EnableTest.php +++ b/tests/Core/Command/User/EnableTest.php @@ -34,7 +34,7 @@ class EnableTest extends TestCase { $this->command = new Enable($this->userManager); } - public function testValidUser() { + public function testValidUser(): void { $user = $this->createMock(IUser::class); $user->expects($this->once()) ->method('setEnabled') @@ -57,7 +57,7 @@ class EnableTest extends TestCase { self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } - public function testInvalidUser() { + public function testInvalidUser(): void { $this->userManager->expects($this->once()) ->method('get') ->with('user') diff --git a/tests/Core/Command/User/LastSeenTest.php b/tests/Core/Command/User/LastSeenTest.php index 1146c0664d4..014c981112e 100644 --- a/tests/Core/Command/User/LastSeenTest.php +++ b/tests/Core/Command/User/LastSeenTest.php @@ -51,7 +51,7 @@ class LastSeenTest extends TestCase { * @param int $lastSeen * @param string $expectedString */ - public function testValidUser($lastSeen, $expectedString) { + public function testValidUser($lastSeen, $expectedString): void { $user = $this->getMockBuilder(IUser::class)->getMock(); $user->expects($this->once()) ->method('getLastLogin') @@ -74,7 +74,7 @@ class LastSeenTest extends TestCase { self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } - public function testInvalidUser() { + public function testInvalidUser(): void { $this->userManager->expects($this->once()) ->method('get') ->with('user') diff --git a/tests/Core/Command/User/SettingTest.php b/tests/Core/Command/User/SettingTest.php index 7be9bd27ecb..6848b0bb350 100644 --- a/tests/Core/Command/User/SettingTest.php +++ b/tests/Core/Command/User/SettingTest.php @@ -185,7 +185,7 @@ class SettingTest extends TestCase { * @param mixed $user * @param string $expectedException */ - public function testCheckInput($arguments, $options, $parameterOptions, $user, $expectedException) { + public function testCheckInput($arguments, $options, $parameterOptions, $user, $expectedException): void { $this->consoleInput->expects($this->any()) ->method('getArgument') ->willReturnMap($arguments); @@ -214,7 +214,7 @@ class SettingTest extends TestCase { } } - public function testCheckInputExceptionCatch() { + public function testCheckInputExceptionCatch(): void { $command = $this->getCommand(['checkInput']); $command->expects($this->once()) ->method('checkInput') @@ -244,7 +244,7 @@ class SettingTest extends TestCase { * @param string $expectedLine * @param int $expectedReturn */ - public function testExecuteDelete($value, $errorIfNotExists, $expectedLine, $expectedReturn) { + public function testExecuteDelete($value, $errorIfNotExists, $expectedLine, $expectedReturn): void { $command = $this->getCommand([ 'writeArrayInOutputFormat', 'checkInput', @@ -308,7 +308,7 @@ class SettingTest extends TestCase { * @param string $expectedLine * @param int $expectedReturn */ - public function testExecuteSet($value, $updateOnly, $expectedLine, $expectedReturn) { + public function testExecuteSet($value, $updateOnly, $expectedLine, $expectedReturn): void { $command = $this->getCommand([ 'writeArrayInOutputFormat', 'checkInput', @@ -375,7 +375,7 @@ class SettingTest extends TestCase { * @param string $expectedLine * @param int $expectedReturn */ - public function testExecuteGet($value, $defaultValue, $expectedLine, $expectedReturn) { + public function testExecuteGet($value, $defaultValue, $expectedLine, $expectedReturn): void { $command = $this->getCommand([ 'writeArrayInOutputFormat', 'checkInput', @@ -425,7 +425,7 @@ class SettingTest extends TestCase { $this->assertEquals($expectedReturn, $this->invokePrivate($command, 'execute', [$this->consoleInput, $this->consoleOutput])); } - public function testExecuteList() { + public function testExecuteList(): void { $command = $this->getCommand([ 'writeArrayInOutputFormat', 'checkInput', diff --git a/tests/Core/Controller/AppPasswordControllerTest.php b/tests/Core/Controller/AppPasswordControllerTest.php index 6b7b023ab2e..f0246561145 100644 --- a/tests/Core/Controller/AppPasswordControllerTest.php +++ b/tests/Core/Controller/AppPasswordControllerTest.php @@ -86,7 +86,7 @@ class AppPasswordControllerTest extends TestCase { ); } - public function testGetAppPasswordWithAppPassword() { + public function testGetAppPasswordWithAppPassword(): void { $this->session->method('exists') ->with('app_password') ->willReturn(true); @@ -96,7 +96,7 @@ class AppPasswordControllerTest extends TestCase { $this->controller->getAppPassword(); } - public function testGetAppPasswordNoLoginCreds() { + public function testGetAppPasswordNoLoginCreds(): void { $this->session->method('exists') ->with('app_password') ->willReturn(false); @@ -108,7 +108,7 @@ class AppPasswordControllerTest extends TestCase { $this->controller->getAppPassword(); } - public function testGetAppPassword() { + public function testGetAppPassword(): void { $credentials = $this->createMock(ICredentials::class); $this->session->method('exists') @@ -149,7 +149,7 @@ class AppPasswordControllerTest extends TestCase { $this->controller->getAppPassword(); } - public function testGetAppPasswordNoPassword() { + public function testGetAppPasswordNoPassword(): void { $credentials = $this->createMock(ICredentials::class); $this->session->method('exists') @@ -190,7 +190,7 @@ class AppPasswordControllerTest extends TestCase { $this->controller->getAppPassword(); } - public function testDeleteAppPasswordNoAppPassword() { + public function testDeleteAppPasswordNoAppPassword(): void { $this->session->method('exists') ->with('app_password') ->willReturn(false); @@ -200,7 +200,7 @@ class AppPasswordControllerTest extends TestCase { $this->controller->deleteAppPassword(); } - public function testDeleteAppPasswordFails() { + public function testDeleteAppPasswordFails(): void { $this->session->method('exists') ->with('app_password') ->willReturn(true); @@ -217,7 +217,7 @@ class AppPasswordControllerTest extends TestCase { $this->controller->deleteAppPassword(); } - public function testDeleteAppPasswordSuccess() { + public function testDeleteAppPasswordSuccess(): void { $this->session->method('exists') ->with('app_password') ->willReturn(true); diff --git a/tests/Core/Controller/AutoCompleteControllerTest.php b/tests/Core/Controller/AutoCompleteControllerTest.php index 2b82342276b..23bd03be7af 100644 --- a/tests/Core/Controller/AutoCompleteControllerTest.php +++ b/tests/Core/Controller/AutoCompleteControllerTest.php @@ -156,7 +156,7 @@ class AutoCompleteControllerTest extends TestCase { /** * @dataProvider searchDataProvider */ - public function testGet(array $searchResults, array $expected, string $searchTerm, ?string $itemType, ?string $itemId, ?string $sorter) { + public function testGet(array $searchResults, array $expected, string $searchTerm, ?string $itemType, ?string $itemId, ?string $sorter): void { $this->collaboratorSearch->expects($this->once()) ->method('search') ->willReturn([$searchResults, false]); diff --git a/tests/Core/Controller/AvatarControllerTest.php b/tests/Core/Controller/AvatarControllerTest.php index 41c16bc4c3f..3a1123c940b 100644 --- a/tests/Core/Controller/AvatarControllerTest.php +++ b/tests/Core/Controller/AvatarControllerTest.php @@ -128,7 +128,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Fetch an avatar if a user has no avatar */ - public function testGetAvatarNoAvatar() { + public function testGetAvatarNoAvatar(): void { $this->avatarManager->method('getAvatar')->willReturn($this->avatarMock); $this->avatarMock->method('getFile')->will($this->throwException(new NotFoundException())); $response = $this->avatarController->getAvatar('userId', 32); @@ -140,7 +140,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Fetch the user's avatar */ - public function testGetAvatar() { + public function testGetAvatar(): void { $this->avatarMock->method('getFile')->willReturn($this->avatarFile); $this->avatarManager->method('getAvatar')->with('userId')->willReturn($this->avatarMock); $this->avatarMock->expects($this->once()) @@ -161,7 +161,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Fetch the user's avatar */ - public function testGetGeneratedAvatar() { + public function testGetGeneratedAvatar(): void { $this->avatarMock->method('getFile')->willReturn($this->avatarFile); $this->avatarManager->method('getAvatar')->with('userId')->willReturn($this->avatarMock); @@ -179,7 +179,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Fetch the avatar of a non-existing user */ - public function testGetAvatarNoUser() { + public function testGetAvatarNoUser(): void { $this->avatarManager ->method('getAvatar') ->with('userDoesNotExist') @@ -276,7 +276,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Remove an avatar */ - public function testDeleteAvatar() { + public function testDeleteAvatar(): void { $this->avatarManager->method('getAvatar')->willReturn($this->avatarMock); $response = $this->avatarController->deleteAvatar(); @@ -286,7 +286,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Test what happens if the removing of the avatar fails */ - public function testDeleteAvatarException() { + public function testDeleteAvatarException(): void { $this->avatarMock->method('remove')->will($this->throwException(new \Exception('foo'))); $this->avatarManager->method('getAvatar')->willReturn($this->avatarMock); @@ -300,7 +300,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Trying to get a tmp avatar when it is not available. 404 */ - public function testTmpAvatarNoTmp() { + public function testTmpAvatarNoTmp(): void { $response = $this->avatarController->getTmpAvatar(); $this->assertEquals(Http::STATUS_NOT_FOUND, $response->getStatus()); } @@ -308,7 +308,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Fetch tmp avatar */ - public function testTmpAvatarValid() { + public function testTmpAvatarValid(): void { $this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.jpg')); $response = $this->avatarController->getTmpAvatar(); @@ -319,7 +319,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * When trying to post a new avatar a path or image should be posted. */ - public function testPostAvatarNoPathOrImage() { + public function testPostAvatarNoPathOrImage(): void { $response = $this->avatarController->postAvatar(null); $this->assertEquals(Http::STATUS_BAD_REQUEST, $response->getStatus()); @@ -328,7 +328,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Test a correct post of an avatar using POST */ - public function testPostAvatarFile() { + public function testPostAvatarFile(): void { //Create temp file $fileName = tempnam('', 'avatarTest'); $copyRes = copy(\OC::$SERVERROOT.'/tests/data/testimage.jpg', $fileName); @@ -353,7 +353,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Test invalid post os an avatar using POST */ - public function testPostAvatarInvalidFile() { + public function testPostAvatarInvalidFile(): void { //Create request return $reqRet = ['error' => [1], 'tmp_name' => ['foo']]; $this->request->method('getUploadedFile')->willReturn($reqRet); @@ -366,7 +366,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Check what happens when we upload a GIF */ - public function testPostAvatarFileGif() { + public function testPostAvatarFileGif(): void { //Create temp file $fileName = tempnam('', 'avatarTest'); $copyRes = copy(\OC::$SERVERROOT.'/tests/data/testimage.gif', $fileName); @@ -390,7 +390,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Test posting avatar from existing file */ - public function testPostAvatarFromFile() { + public function testPostAvatarFromFile(): void { //Mock node API call $file = $this->getMockBuilder('OCP\Files\File') ->disableOriginalConstructor()->getMock(); @@ -414,7 +414,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Test posting avatar from existing folder */ - public function testPostAvatarFromNoFile() { + public function testPostAvatarFromNoFile(): void { $file = $this->getMockBuilder('OCP\Files\Node')->getMock(); $userFolder = $this->getMockBuilder('OCP\Files\Folder')->getMock(); $this->rootFolder->method('getUserFolder')->with('userid')->willReturn($userFolder); @@ -430,7 +430,7 @@ class AvatarControllerTest extends \Test\TestCase { $this->assertEquals(['data' => ['message' => 'Please select a file.']], $response->getData()); } - public function testPostAvatarInvalidType() { + public function testPostAvatarInvalidType(): void { $file = $this->getMockBuilder('OCP\Files\File') ->disableOriginalConstructor()->getMock(); $file->expects($this->never()) @@ -446,7 +446,7 @@ class AvatarControllerTest extends \Test\TestCase { $this->assertEquals($expectedResponse, $this->avatarController->postAvatar('avatar.jpg')); } - public function testPostAvatarNotPermittedException() { + public function testPostAvatarNotPermittedException(): void { $file = $this->getMockBuilder('OCP\Files\File') ->disableOriginalConstructor()->getMock(); $file->expects($this->once()) @@ -466,7 +466,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Test what happens if the upload of the avatar fails */ - public function testPostAvatarException() { + public function testPostAvatarException(): void { $this->cache->expects($this->once()) ->method('set') ->will($this->throwException(new \Exception('foo'))); @@ -493,7 +493,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Test invalid crop argument */ - public function testPostCroppedAvatarInvalidCrop() { + public function testPostCroppedAvatarInvalidCrop(): void { $response = $this->avatarController->postCroppedAvatar([]); $this->assertEquals(Http::STATUS_BAD_REQUEST, $response->getStatus()); @@ -502,7 +502,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Test no tmp avatar to crop */ - public function testPostCroppedAvatarNoTmpAvatar() { + public function testPostCroppedAvatarNoTmpAvatar(): void { $response = $this->avatarController->postCroppedAvatar(['x' => 0, 'y' => 0, 'w' => 10, 'h' => 10]); $this->assertEquals(Http::STATUS_BAD_REQUEST, $response->getStatus()); @@ -511,7 +511,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Test with non square crop */ - public function testPostCroppedAvatarNoSquareCrop() { + public function testPostCroppedAvatarNoSquareCrop(): void { $this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.jpg')); $this->avatarMock->method('set')->will($this->throwException(new \OC\NotSquareException)); @@ -524,7 +524,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Check for proper reply on proper crop argument */ - public function testPostCroppedAvatarValidCrop() { + public function testPostCroppedAvatarValidCrop(): void { $this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.jpg')); $this->avatarManager->method('getAvatar')->willReturn($this->avatarMock); $response = $this->avatarController->postCroppedAvatar(['x' => 0, 'y' => 0, 'w' => 10, 'h' => 10]); @@ -536,7 +536,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Test what happens if the cropping of the avatar fails */ - public function testPostCroppedAvatarException() { + public function testPostCroppedAvatarException(): void { $this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.jpg')); $this->avatarMock->method('set')->will($this->throwException(new \Exception('foo'))); @@ -553,7 +553,7 @@ class AvatarControllerTest extends \Test\TestCase { /** * Check for proper reply on proper crop argument */ - public function testFileTooBig() { + public function testFileTooBig(): void { $fileName = \OC::$SERVERROOT.'/tests/data/testimage.jpg'; //Create request return $reqRet = ['error' => [0], 'tmp_name' => [$fileName], 'size' => [21 * 1024 * 1024]]; diff --git a/tests/Core/Controller/ChangePasswordControllerTest.php b/tests/Core/Controller/ChangePasswordControllerTest.php index 93fb4196d35..a806b091477 100644 --- a/tests/Core/Controller/ChangePasswordControllerTest.php +++ b/tests/Core/Controller/ChangePasswordControllerTest.php @@ -60,7 +60,7 @@ class ChangePasswordControllerTest extends \Test\TestCase { ); } - public function testChangePersonalPasswordWrongPassword() { + public function testChangePersonalPasswordWrongPassword(): void { $this->userSession->expects($this->once()) ->method('getLoginName') ->willReturn($this->loginName); @@ -82,7 +82,7 @@ class ChangePasswordControllerTest extends \Test\TestCase { $this->assertEquals($expects, $actual); } - public function testChangePersonalPasswordCommonPassword() { + public function testChangePersonalPasswordCommonPassword(): void { $this->userSession->expects($this->once()) ->method('getLoginName') ->willReturn($this->loginName); @@ -109,7 +109,7 @@ class ChangePasswordControllerTest extends \Test\TestCase { $this->assertEquals($expects, $actual); } - public function testChangePersonalPasswordNoNewPassword() { + public function testChangePersonalPasswordNoNewPassword(): void { $this->userSession->expects($this->once()) ->method('getLoginName') ->willReturn($this->loginName); @@ -132,7 +132,7 @@ class ChangePasswordControllerTest extends \Test\TestCase { $this->assertEquals($expects, $res->getData()); } - public function testChangePersonalPasswordCantSetPassword() { + public function testChangePersonalPasswordCantSetPassword(): void { $this->userSession->expects($this->once()) ->method('getLoginName') ->willReturn($this->loginName); @@ -159,7 +159,7 @@ class ChangePasswordControllerTest extends \Test\TestCase { $this->assertEquals($expects, $actual); } - public function testChangePersonalPassword() { + public function testChangePersonalPassword(): void { $this->userSession->expects($this->once()) ->method('getLoginName') ->willReturn($this->loginName); diff --git a/tests/Core/Controller/ClientFlowLoginControllerTest.php b/tests/Core/Controller/ClientFlowLoginControllerTest.php index 98f09f0f18c..a38f73c85a6 100644 --- a/tests/Core/Controller/ClientFlowLoginControllerTest.php +++ b/tests/Core/Controller/ClientFlowLoginControllerTest.php @@ -102,7 +102,7 @@ class ClientFlowLoginControllerTest extends TestCase { ); } - public function testShowAuthPickerPageNoClientOrOauthRequest() { + public function testShowAuthPickerPageNoClientOrOauthRequest(): void { $expected = new StandaloneTemplateResponse( 'core', 'error', @@ -121,7 +121,7 @@ class ClientFlowLoginControllerTest extends TestCase { $this->assertEquals($expected, $this->clientFlowLoginController->showAuthPickerPage()); } - public function testShowAuthPickerPageWithOcsHeader() { + public function testShowAuthPickerPageWithOcsHeader(): void { $this->request ->method('getHeader') ->withConsecutive( @@ -183,7 +183,7 @@ class ClientFlowLoginControllerTest extends TestCase { $this->assertEquals($expected, $this->clientFlowLoginController->showAuthPickerPage()); } - public function testShowAuthPickerPageWithOauth() { + public function testShowAuthPickerPageWithOauth(): void { $this->request ->method('getHeader') ->withConsecutive( @@ -253,7 +253,7 @@ class ClientFlowLoginControllerTest extends TestCase { $this->assertEquals($expected, $this->clientFlowLoginController->showAuthPickerPage('MyClientIdentifier')); } - public function testGenerateAppPasswordWithInvalidToken() { + public function testGenerateAppPasswordWithInvalidToken(): void { $this->session ->expects($this->once()) ->method('get') @@ -276,7 +276,7 @@ class ClientFlowLoginControllerTest extends TestCase { $this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken')); } - public function testGenerateAppPasswordWithSessionNotAvailableException() { + public function testGenerateAppPasswordWithSessionNotAvailableException(): void { $this->session ->expects($this->once()) ->method('get') @@ -296,7 +296,7 @@ class ClientFlowLoginControllerTest extends TestCase { $this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken')); } - public function testGenerateAppPasswordWithInvalidTokenException() { + public function testGenerateAppPasswordWithInvalidTokenException(): void { $this->session ->expects($this->once()) ->method('get') @@ -321,7 +321,7 @@ class ClientFlowLoginControllerTest extends TestCase { $this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken')); } - public function testGeneratePasswordWithPassword() { + public function testGeneratePasswordWithPassword(): void { $this->session ->expects($this->once()) ->method('get') @@ -405,7 +405,7 @@ class ClientFlowLoginControllerTest extends TestCase { * ["https://example.com/redirect.php?hello=world", "https://example.com/redirect.php?hello=world&state=MyOauthState&code=MyAccessCode"] * */ - public function testGeneratePasswordWithPasswordForOauthClient($redirectUri, $redirectUrl) { + public function testGeneratePasswordWithPasswordForOauthClient($redirectUri, $redirectUrl): void { $this->session ->method('get') ->withConsecutive( @@ -490,7 +490,7 @@ class ClientFlowLoginControllerTest extends TestCase { $this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken', 'MyClientIdentifier')); } - public function testGeneratePasswordWithoutPassword() { + public function testGeneratePasswordWithoutPassword(): void { $this->session ->expects($this->once()) ->method('get') @@ -621,7 +621,7 @@ class ClientFlowLoginControllerTest extends TestCase { * @param string $protocol * @param string $expected */ - public function testGeneratePasswordWithHttpsProxy(array $headers, $protocol, $expected) { + public function testGeneratePasswordWithHttpsProxy(array $headers, $protocol, $expected): void { $this->session ->expects($this->once()) ->method('get') diff --git a/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php b/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php index eefa2982c74..093b8a3442d 100644 --- a/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php +++ b/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php @@ -70,7 +70,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { ); } - public function testPollInvalid() { + public function testPollInvalid(): void { $this->loginFlowV2Service->method('poll') ->with('token') ->willThrowException(new LoginFlowV2NotFoundException()); @@ -81,7 +81,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { $this->assertSame(Http::STATUS_NOT_FOUND, $result->getStatus()); } - public function testPollValid() { + public function testPollValid(): void { $creds = new LoginFlowV2Credentials('server', 'login', 'pass'); $this->loginFlowV2Service->method('poll') ->with('token') @@ -93,7 +93,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { $this->assertSame(Http::STATUS_OK, $result->getStatus()); } - public function testLandingInvalid() { + public function testLandingInvalid(): void { $this->session->expects($this->never()) ->method($this->anything()); @@ -107,7 +107,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { $this->assertInstanceOf(Http\StandaloneTemplateResponse::class, $result); } - public function testLandingValid() { + public function testLandingValid(): void { $this->session->expects($this->once()) ->method('set') ->with('client.flow.v2.login.token', 'token'); @@ -127,7 +127,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { $this->assertSame('https://server/path', $result->getRedirectURL()); } - public function testShowAuthPickerNoLoginToken() { + public function testShowAuthPickerNoLoginToken(): void { $this->session->method('get') ->willReturn(null); @@ -136,7 +136,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { $this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus()); } - public function testShowAuthPickerInvalidLoginToken() { + public function testShowAuthPickerInvalidLoginToken(): void { $this->session->method('get') ->with('client.flow.v2.login.token') ->willReturn('loginToken'); @@ -150,7 +150,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { $this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus()); } - public function testShowAuthPickerValidLoginToken() { + public function testShowAuthPickerValidLoginToken(): void { $this->session->method('get') ->with('client.flow.v2.login.token') ->willReturn('loginToken'); @@ -176,7 +176,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { $this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus()); } - public function testGrantPageInvalidStateToken() { + public function testGrantPageInvalidStateToken(): void { $this->session->method('get') ->willReturnCallback(function ($name) { return null; @@ -186,7 +186,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { $this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus()); } - public function testGrantPageInvalidLoginToken() { + public function testGrantPageInvalidLoginToken(): void { $this->session->method('get') ->willReturnCallback(function ($name) { if ($name === 'client.flow.v2.state.token') { @@ -206,7 +206,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { $this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus()); } - public function testGrantPageValid() { + public function testGrantPageValid(): void { $this->session->method('get') ->willReturnCallback(function ($name) { if ($name === 'client.flow.v2.state.token') { @@ -236,7 +236,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { } - public function testGenerateAppPasswordInvalidStateToken() { + public function testGenerateAppPasswordInvalidStateToken(): void { $this->session->method('get') ->willReturnCallback(function ($name) { return null; @@ -246,7 +246,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { $this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus()); } - public function testGenerateAppPassworInvalidLoginToken() { + public function testGenerateAppPassworInvalidLoginToken(): void { $this->session->method('get') ->willReturnCallback(function ($name) { if ($name === 'client.flow.v2.state.token') { @@ -266,7 +266,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase { $this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus()); } - public function testGenerateAppPassworValid() { + public function testGenerateAppPassworValid(): void { $this->session->method('get') ->willReturnCallback(function ($name) { if ($name === 'client.flow.v2.state.token') { diff --git a/tests/Core/Controller/ContactsMenuControllerTest.php b/tests/Core/Controller/ContactsMenuControllerTest.php index d688ea6682f..aa20e6726e2 100644 --- a/tests/Core/Controller/ContactsMenuControllerTest.php +++ b/tests/Core/Controller/ContactsMenuControllerTest.php @@ -35,7 +35,7 @@ class ContactsMenuControllerTest extends TestCase { $this->controller = new ContactsMenuController($request, $this->userSession, $this->contactsManager); } - public function testIndex() { + public function testIndex(): void { $user = $this->createMock(IUser::class); $entries = [ $this->createMock(IEntry::class), @@ -54,7 +54,7 @@ class ContactsMenuControllerTest extends TestCase { $this->assertEquals($entries, $response); } - public function testFindOne() { + public function testFindOne(): void { $user = $this->createMock(IUser::class); $entry = $this->createMock(IEntry::class); $this->userSession->expects($this->once()) @@ -70,7 +70,7 @@ class ContactsMenuControllerTest extends TestCase { $this->assertEquals($entry, $response); } - public function testFindOne404() { + public function testFindOne404(): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->once()) ->method('getUser') diff --git a/tests/Core/Controller/CssControllerTest.php b/tests/Core/Controller/CssControllerTest.php index 8064f36cddb..cae6f7989c4 100644 --- a/tests/Core/Controller/CssControllerTest.php +++ b/tests/Core/Controller/CssControllerTest.php @@ -56,7 +56,7 @@ class CssControllerTest extends TestCase { ); } - public function testNoCssFolderForApp() { + public function testNoCssFolderForApp(): void { $this->appData->method('getFolder') ->with('myapp') ->willThrowException(new NotFoundException()); @@ -67,7 +67,7 @@ class CssControllerTest extends TestCase { } - public function testNoCssFile() { + public function testNoCssFile(): void { $folder = $this->createMock(ISimpleFolder::class); $this->appData->method('getFolder') ->with('myapp') @@ -81,7 +81,7 @@ class CssControllerTest extends TestCase { $this->assertInstanceOf(NotFoundResponse::class, $result); } - public function testGetFile() { + public function testGetFile(): void { $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); $file->method('getName')->willReturn('my name'); @@ -105,7 +105,7 @@ class CssControllerTest extends TestCase { $this->assertEquals($expected, $result); } - public function testGetGzipFile() { + public function testGetGzipFile(): void { $folder = $this->createMock(ISimpleFolder::class); $gzipFile = $this->createMock(ISimpleFile::class); $gzipFile->method('getName')->willReturn('my name'); @@ -134,7 +134,7 @@ class CssControllerTest extends TestCase { $this->assertEquals($expected, $result); } - public function testGetGzipFileNotFound() { + public function testGetGzipFileNotFound(): void { $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); $file->method('getName')->willReturn('my name'); diff --git a/tests/Core/Controller/GuestAvatarControllerTest.php b/tests/Core/Controller/GuestAvatarControllerTest.php index b2f60665948..1ad9e49f858 100644 --- a/tests/Core/Controller/GuestAvatarControllerTest.php +++ b/tests/Core/Controller/GuestAvatarControllerTest.php @@ -71,7 +71,7 @@ class GuestAvatarControllerTest extends \Test\TestCase { /** * Tests getAvatar returns the guest avatar. */ - public function testGetAvatar() { + public function testGetAvatar(): void { $this->avatarManager->expects($this->once()) ->method('getGuestAvatar') ->with('Peter') diff --git a/tests/Core/Controller/JsControllerTest.php b/tests/Core/Controller/JsControllerTest.php index 5aa853e4ed0..1500ed6eacf 100644 --- a/tests/Core/Controller/JsControllerTest.php +++ b/tests/Core/Controller/JsControllerTest.php @@ -56,7 +56,7 @@ class JsControllerTest extends TestCase { ); } - public function testNoCssFolderForApp() { + public function testNoCssFolderForApp(): void { $this->appData->method('getFolder') ->with('myapp') ->willThrowException(new NotFoundException()); @@ -67,7 +67,7 @@ class JsControllerTest extends TestCase { } - public function testNoCssFile() { + public function testNoCssFile(): void { $folder = $this->createMock(ISimpleFolder::class); $this->appData->method('getFolder') ->with('myapp') @@ -81,7 +81,7 @@ class JsControllerTest extends TestCase { $this->assertInstanceOf(NotFoundResponse::class, $result); } - public function testGetFile() { + public function testGetFile(): void { $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); $file->method('getName')->willReturn('my name'); @@ -105,7 +105,7 @@ class JsControllerTest extends TestCase { $this->assertEquals($expected, $result); } - public function testGetGzipFile() { + public function testGetGzipFile(): void { $folder = $this->createMock(ISimpleFolder::class); $gzipFile = $this->createMock(ISimpleFile::class); $gzipFile->method('getName')->willReturn('my name'); @@ -134,7 +134,7 @@ class JsControllerTest extends TestCase { $this->assertEquals($expected, $result); } - public function testGetGzipFileNotFound() { + public function testGetGzipFileNotFound(): void { $folder = $this->createMock(ISimpleFolder::class); $file = $this->createMock(ISimpleFile::class); $file->method('getName')->willReturn('my name'); diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php index 50ecbe5e19c..a5ff6fd61a5 100644 --- a/tests/Core/Controller/LoginControllerTest.php +++ b/tests/Core/Controller/LoginControllerTest.php @@ -129,7 +129,7 @@ class LoginControllerTest extends TestCase { ); } - public function testLogoutWithoutToken() { + public function testLogoutWithoutToken(): void { $this->request ->expects($this->once()) ->method('getCookie') @@ -156,7 +156,7 @@ class LoginControllerTest extends TestCase { $this->assertEquals($expected, $this->loginController->logout()); } - public function testLogoutNoClearSiteData() { + public function testLogoutNoClearSiteData(): void { $this->request ->expects($this->once()) ->method('getCookie') @@ -179,7 +179,7 @@ class LoginControllerTest extends TestCase { $this->assertEquals($expected, $this->loginController->logout()); } - public function testLogoutWithToken() { + public function testLogoutWithToken(): void { $this->request ->expects($this->once()) ->method('getCookie') @@ -216,7 +216,7 @@ class LoginControllerTest extends TestCase { $this->assertEquals($expected, $this->loginController->logout()); } - public function testShowLoginFormForLoggedInUsers() { + public function testShowLoginFormForLoggedInUsers(): void { $this->userSession ->expects($this->once()) ->method('isLoggedIn') @@ -230,7 +230,7 @@ class LoginControllerTest extends TestCase { $this->assertEquals($expectedResponse, $this->loginController->showLoginForm('', '')); } - public function testShowLoginFormWithErrorsInSession() { + public function testShowLoginFormWithErrorsInSession(): void { $this->userSession ->expects($this->once()) ->method('isLoggedIn') @@ -285,7 +285,7 @@ class LoginControllerTest extends TestCase { $this->assertEquals($expectedResponse, $this->loginController->showLoginForm('', '')); } - public function testShowLoginFormForFlowAuth() { + public function testShowLoginFormForFlowAuth(): void { $this->userSession ->expects($this->once()) ->method('isLoggedIn') @@ -332,7 +332,7 @@ class LoginControllerTest extends TestCase { * @dataProvider passwordResetDataProvider */ public function testShowLoginFormWithPasswordResetOption($canChangePassword, - $expectedResult) { + $expectedResult): void { $this->userSession ->expects($this->once()) ->method('isLoggedIn') @@ -381,7 +381,7 @@ class LoginControllerTest extends TestCase { $this->assertEquals($expectedResponse, $this->loginController->showLoginForm('LdapUser', '')); } - public function testShowLoginFormForUserNamed0() { + public function testShowLoginFormForUserNamed0(): void { $this->userSession ->expects($this->once()) ->method('isLoggedIn') @@ -468,7 +468,7 @@ class LoginControllerTest extends TestCase { $this->assertEquals($expected, $response); } - public function testLoginWithValidCredentials() { + public function testLoginWithValidCredentials(): void { $user = 'MyUserName'; $password = 'secret'; $loginChain = $this->createMock(LoginChain::class); @@ -523,7 +523,7 @@ class LoginControllerTest extends TestCase { $this->assertEquals($expected, $response); } - public function testLoginWithoutPassedCsrfCheckAndLoggedIn() { + public function testLoginWithoutPassedCsrfCheckAndLoggedIn(): void { /** @var IUser|MockObject $user */ $user = $this->createMock(IUser::class); $user->expects($this->any()) @@ -560,7 +560,7 @@ class LoginControllerTest extends TestCase { $this->assertEquals($expected, $response); } - public function testLoginWithValidCredentialsAndRedirectUrl() { + public function testLoginWithValidCredentialsAndRedirectUrl(): void { $user = 'MyUserName'; $password = 'secret'; $redirectUrl = 'https://next.cloud/apps/mail'; @@ -594,7 +594,7 @@ class LoginControllerTest extends TestCase { $this->assertEquals($expected, $response); } - public function testToNotLeakLoginName() { + public function testToNotLeakLoginName(): void { $loginChain = $this->createMock(LoginChain::class); $this->request ->expects($this->once()) diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php index 7e9d085a291..2a99c9f9d16 100644 --- a/tests/Core/Controller/LostControllerTest.php +++ b/tests/Core/Controller/LostControllerTest.php @@ -138,7 +138,7 @@ class LostControllerTest extends TestCase { ); } - public function testResetFormTokenError() { + public function testResetFormTokenError(): void { $this->userManager->method('get') ->with('ValidTokenUser') ->willReturn($this->existingUser); @@ -160,7 +160,7 @@ class LostControllerTest extends TestCase { $this->assertEquals($expectedResponse, $response); } - public function testResetFormValidToken() { + public function testResetFormValidToken(): void { $this->userManager->method('get') ->with('ValidTokenUser') ->willReturn($this->existingUser); @@ -188,7 +188,7 @@ class LostControllerTest extends TestCase { $this->assertEquals($expectedResponse, $response); } - public function testEmailUnsuccessful() { + public function testEmailUnsuccessful(): void { $existingUser = 'ExistingUser'; $nonExistingUser = 'NonExistingUser'; $this->userManager @@ -230,7 +230,7 @@ class LostControllerTest extends TestCase { $this->assertEquals($expectedResponse, $response); } - public function testEmailSuccessful() { + public function testEmailSuccessful(): void { $this->userManager ->expects($this->any()) ->method('get') @@ -287,7 +287,7 @@ class LostControllerTest extends TestCase { $this->assertEquals($expectedResponse, $response); } - public function testEmailWithMailSuccessful() { + public function testEmailWithMailSuccessful(): void { $this->userManager ->expects($this->any()) ->method('get') @@ -349,7 +349,7 @@ class LostControllerTest extends TestCase { $this->assertEquals($expectedResponse, $response); } - public function testEmailCantSendException() { + public function testEmailCantSendException(): void { $this->userManager ->expects($this->any()) ->method('get') @@ -409,7 +409,7 @@ class LostControllerTest extends TestCase { $this->assertEquals($expectedResponse, $response); } - public function testSetPasswordUnsuccessful() { + public function testSetPasswordUnsuccessful(): void { $this->config->method('getUserValue') ->with('ValidTokenUser', 'core', 'lostpassword', null) ->willReturn('encryptedData'); @@ -435,7 +435,7 @@ class LostControllerTest extends TestCase { $this->assertSame($expectedResponse, $response->getData()); } - public function testSetPasswordSuccessful() { + public function testSetPasswordSuccessful(): void { $this->config->method('getUserValue') ->with('ValidTokenUser', 'core', 'lostpassword', null) ->willReturn('encryptedData'); @@ -463,7 +463,7 @@ class LostControllerTest extends TestCase { $this->assertSame($expectedResponse, $response->getData()); } - public function testSetPasswordExpiredToken() { + public function testSetPasswordExpiredToken(): void { $this->config->method('getUserValue') ->with('ValidTokenUser', 'core', 'lostpassword', null) ->willReturn('encryptedData'); @@ -482,7 +482,7 @@ class LostControllerTest extends TestCase { $this->assertSame($expectedResponse, $response->getData()); } - public function testSetPasswordInvalidDataInDb() { + public function testSetPasswordInvalidDataInDb(): void { $this->config->method('getUserValue') ->with('ValidTokenUser', 'core', 'lostpassword', null) ->willReturn('invalidEncryptedData'); @@ -502,7 +502,7 @@ class LostControllerTest extends TestCase { $this->assertSame($expectedResponse, $response->getData()); } - public function testIsSetPasswordWithoutTokenFailing() { + public function testIsSetPasswordWithoutTokenFailing(): void { $this->config->method('getUserValue') ->with('ValidTokenUser', 'core', 'lostpassword', null) ->willReturn('aValidtoken'); @@ -521,7 +521,7 @@ class LostControllerTest extends TestCase { $this->assertSame($expectedResponse, $response->getData()); } - public function testSetPasswordForDisabledUser() { + public function testSetPasswordForDisabledUser(): void { $user = $this->createMock(IUser::class); $user->expects($this->any()) ->method('isEnabled') @@ -551,7 +551,7 @@ class LostControllerTest extends TestCase { $this->assertSame($expectedResponse, $response->getData()); } - public function testSendEmailNoEmail() { + public function testSendEmailNoEmail(): void { $user = $this->createMock(IUser::class); $user->expects($this->any()) ->method('isEnabled') @@ -574,7 +574,7 @@ class LostControllerTest extends TestCase { $this->assertEquals($expectedResponse, $response); } - public function testSetPasswordEncryptionDontProceedPerUserKey() { + public function testSetPasswordEncryptionDontProceedPerUserKey(): void { /** @var IEncryptionModule|MockObject $encryptionModule */ $encryptionModule = $this->createMock(IEncryptionModule::class); $encryptionModule->expects($this->once())->method('needDetailedAccessList')->willReturn(true); @@ -587,7 +587,7 @@ class LostControllerTest extends TestCase { $this->assertSame($expectedResponse, $response->getData()); } - public function testSetPasswordDontProceedMasterKey() { + public function testSetPasswordDontProceedMasterKey(): void { $encryptionModule = $this->createMock(IEncryptionModule::class); $encryptionModule->expects($this->once())->method('needDetailedAccessList')->willReturn(false); $this->encryptionManager->expects($this->once())->method('getEncryptionModules') @@ -615,7 +615,7 @@ class LostControllerTest extends TestCase { $this->assertSame($expectedResponse, $response->getData()); } - public function testTwoUsersWithSameEmail() { + public function testTwoUsersWithSameEmail(): void { $user1 = $this->createMock(IUser::class); $user1->expects($this->any()) ->method('getEMailAddress') @@ -707,7 +707,7 @@ class LostControllerTest extends TestCase { $this->assertInstanceOf(IUser::class, $result); } - public function testTrimEmailInput() { + public function testTrimEmailInput(): void { $this->userManager ->expects($this->once()) ->method('getByEmail') @@ -724,7 +724,7 @@ class LostControllerTest extends TestCase { $this->assertEquals($expectedResponse, $response); } - public function testUsernameInput() { + public function testUsernameInput(): void { $this->userManager ->expects($this->once()) ->method('get') diff --git a/tests/Core/Controller/NavigationControllerTest.php b/tests/Core/Controller/NavigationControllerTest.php index 0d7c91d3034..4995bd2fed0 100644 --- a/tests/Core/Controller/NavigationControllerTest.php +++ b/tests/Core/Controller/NavigationControllerTest.php @@ -48,7 +48,7 @@ class NavigationControllerTest extends TestCase { ]; } /** @dataProvider dataGetNavigation */ - public function testGetAppNavigation($absolute) { + public function testGetAppNavigation($absolute): void { $this->navigationManager->expects($this->once()) ->method('getAll') ->with('link') @@ -77,7 +77,7 @@ class NavigationControllerTest extends TestCase { } /** @dataProvider dataGetNavigation */ - public function testGetSettingsNavigation($absolute) { + public function testGetSettingsNavigation($absolute): void { $this->navigationManager->expects($this->once()) ->method('getAll') ->with('settings') @@ -108,7 +108,7 @@ class NavigationControllerTest extends TestCase { } } - public function testGetAppNavigationEtagMatch() { + public function testGetAppNavigationEtagMatch(): void { $navigation = [ ['id' => 'files', 'href' => '/index.php/apps/files', 'icon' => 'icon' ] ]; $this->request->expects($this->once()) ->method('getHeader') @@ -123,7 +123,7 @@ class NavigationControllerTest extends TestCase { $this->assertEquals(Http::STATUS_NOT_MODIFIED, $actual->getStatus()); } - public function testGetSettingsNavigationEtagMatch() { + public function testGetSettingsNavigationEtagMatch(): void { $navigation = [ ['id' => 'logout', 'href' => '/index.php/apps/files', 'icon' => 'icon' ] ]; $this->request->expects($this->once()) ->method('getHeader') diff --git a/tests/Core/Controller/OCSControllerTest.php b/tests/Core/Controller/OCSControllerTest.php index 19b87a97359..6fc5f54b8ef 100644 --- a/tests/Core/Controller/OCSControllerTest.php +++ b/tests/Core/Controller/OCSControllerTest.php @@ -68,7 +68,7 @@ class OCSControllerTest extends TestCase { return new DataResponse($data); } - public function testGetCapabilities() { + public function testGetCapabilities(): void { $this->userSession->expects($this->once()) ->method('isLoggedIn') ->willReturn(true); @@ -101,7 +101,7 @@ class OCSControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->getCapabilities()); } - public function testGetCapabilitiesPublic() { + public function testGetCapabilitiesPublic(): void { $this->userSession->expects($this->once()) ->method('isLoggedIn') ->willReturn(false); @@ -135,7 +135,7 @@ class OCSControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->getCapabilities()); } - public function testPersonCheckValid() { + public function testPersonCheckValid(): void { $this->userManager->method('checkPassword') ->with( $this->equalTo('user'), @@ -150,7 +150,7 @@ class OCSControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->personCheck('user', 'pass')); } - public function testPersonInvalid() { + public function testPersonInvalid(): void { $this->userManager->method('checkPassword') ->with( $this->equalTo('user'), @@ -162,7 +162,7 @@ class OCSControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->personCheck('user', 'wrongpass')); } - public function testPersonNoLogin() { + public function testPersonNoLogin(): void { $this->userManager->method('checkPassword') ->with( $this->equalTo('user'), @@ -173,7 +173,7 @@ class OCSControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->personCheck('', '')); } - public function testGetIdentityProofWithNotExistingUser() { + public function testGetIdentityProofWithNotExistingUser(): void { $this->userManager ->expects($this->once()) ->method('get') @@ -184,7 +184,7 @@ class OCSControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->getIdentityProof('NotExistingUser')); } - public function testGetIdentityProof() { + public function testGetIdentityProof(): void { $user = $this->createMock(IUser::class); $key = $this->createMock(Key::class); $this->userManager diff --git a/tests/Core/Controller/PreviewControllerTest.php b/tests/Core/Controller/PreviewControllerTest.php index 7c9a32eae38..4274f15e8ed 100644 --- a/tests/Core/Controller/PreviewControllerTest.php +++ b/tests/Core/Controller/PreviewControllerTest.php @@ -49,28 +49,28 @@ class PreviewControllerTest extends \Test\TestCase { ); } - public function testInvalidFile() { + public function testInvalidFile(): void { $res = $this->controller->getPreview(''); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } - public function testInvalidWidth() { + public function testInvalidWidth(): void { $res = $this->controller->getPreview('file', 0); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } - public function testInvalidHeight() { + public function testInvalidHeight(): void { $res = $this->controller->getPreview('file', 10, 0); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } - public function testFileNotFound() { + public function testFileNotFound(): void { $userFolder = $this->createMock(Folder::class); $this->rootFolder->method('getUserFolder') ->with($this->equalTo($this->userId)) @@ -86,7 +86,7 @@ class PreviewControllerTest extends \Test\TestCase { $this->assertEquals($expected, $res); } - public function testNotAFile() { + public function testNotAFile(): void { $userFolder = $this->createMock(Folder::class); $this->rootFolder->method('getUserFolder') ->with($this->equalTo($this->userId)) @@ -103,7 +103,7 @@ class PreviewControllerTest extends \Test\TestCase { $this->assertEquals($expected, $res); } - public function testNoPreviewAndNoIcon() { + public function testNoPreviewAndNoIcon(): void { $userFolder = $this->createMock(Folder::class); $this->rootFolder->method('getUserFolder') ->with($this->equalTo($this->userId)) @@ -124,7 +124,7 @@ class PreviewControllerTest extends \Test\TestCase { $this->assertEquals($expected, $res); } - public function testForbiddenFile() { + public function testForbiddenFile(): void { $userFolder = $this->createMock(Folder::class); $this->rootFolder->method('getUserFolder') ->with($this->equalTo($this->userId)) @@ -148,7 +148,7 @@ class PreviewControllerTest extends \Test\TestCase { $this->assertEquals($expected, $res); } - public function testNoPreview() { + public function testNoPreview(): void { $userFolder = $this->createMock(Folder::class); $this->rootFolder->method('getUserFolder') ->with($this->equalTo($this->userId)) @@ -180,7 +180,7 @@ class PreviewControllerTest extends \Test\TestCase { $this->assertEquals($expected, $res); } - public function testValidPreview() { + public function testValidPreview(): void { $userFolder = $this->createMock(Folder::class); $this->rootFolder->method('getUserFolder') ->with($this->equalTo($this->userId)) diff --git a/tests/Core/Controller/TwoFactorChallengeControllerTest.php b/tests/Core/Controller/TwoFactorChallengeControllerTest.php index 3e99c2cad14..11e18bd622a 100644 --- a/tests/Core/Controller/TwoFactorChallengeControllerTest.php +++ b/tests/Core/Controller/TwoFactorChallengeControllerTest.php @@ -75,7 +75,7 @@ class TwoFactorChallengeControllerTest extends TestCase { ->willReturn('logoutAttribute'); } - public function testSelectChallenge() { + public function testSelectChallenge(): void { $user = $this->getMockBuilder(IUser::class)->getMock(); $p1 = $this->createMock(IActivatableAtLogin::class); $p1->method('getId')->willReturn('p1'); @@ -109,7 +109,7 @@ class TwoFactorChallengeControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->selectChallenge('/some/url')); } - public function testShowChallenge() { + public function testShowChallenge(): void { $user = $this->createMock(IUser::class); $provider = $this->createMock(IProvider::class); $provider->method('getId')->willReturn('myprovider'); @@ -160,7 +160,7 @@ class TwoFactorChallengeControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->showChallenge('myprovider', '/re/dir/ect/url')); } - public function testShowInvalidChallenge() { + public function testShowInvalidChallenge(): void { $user = $this->createMock(IUser::class); $providerSet = new ProviderSet([], false); @@ -181,7 +181,7 @@ class TwoFactorChallengeControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->showChallenge('myprovider', 'redirect/url')); } - public function testSolveChallenge() { + public function testSolveChallenge(): void { $user = $this->createMock(IUser::class); $provider = $this->createMock(IProvider::class); @@ -206,7 +206,7 @@ class TwoFactorChallengeControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token')); } - public function testSolveValidChallengeAndRedirect() { + public function testSolveValidChallengeAndRedirect(): void { $user = $this->createMock(IUser::class); $provider = $this->createMock(IProvider::class); @@ -231,7 +231,7 @@ class TwoFactorChallengeControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token', 'redirect%20url')); } - public function testSolveChallengeInvalidProvider() { + public function testSolveChallengeInvalidProvider(): void { $user = $this->getMockBuilder(IUser::class)->getMock(); $this->userSession->expects($this->once()) @@ -251,7 +251,7 @@ class TwoFactorChallengeControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token')); } - public function testSolveInvalidChallenge() { + public function testSolveInvalidChallenge(): void { $user = $this->createMock(IUser::class); $provider = $this->createMock(IProvider::class); @@ -285,7 +285,7 @@ class TwoFactorChallengeControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token', '/url')); } - public function testSolveChallengeTwoFactorException() { + public function testSolveChallengeTwoFactorException(): void { $user = $this->createMock(IUser::class); $provider = $this->createMock(IProvider::class); $exception = new TwoFactorException('2FA failed'); @@ -353,7 +353,7 @@ class TwoFactorChallengeControllerTest extends TestCase { $this->assertEquals($expected, $response); } - public function testSetUpInvalidProvider() { + public function testSetUpInvalidProvider(): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->once()) ->method('getUser') diff --git a/tests/Core/Controller/UserControllerTest.php b/tests/Core/Controller/UserControllerTest.php index 09a22913fdc..979c723dd85 100644 --- a/tests/Core/Controller/UserControllerTest.php +++ b/tests/Core/Controller/UserControllerTest.php @@ -31,7 +31,7 @@ class UserControllerTest extends TestCase { ); } - public function testGetDisplayNames() { + public function testGetDisplayNames(): void { $user = $this->createMock(IUser::class); $user->method('getDisplayName') ->willReturn('FooDisplay Name'); diff --git a/tests/Core/Controller/WipeControllerTest.php b/tests/Core/Controller/WipeControllerTest.php index f07fe4c9282..2cd315db5bf 100644 --- a/tests/Core/Controller/WipeControllerTest.php +++ b/tests/Core/Controller/WipeControllerTest.php @@ -50,7 +50,7 @@ class WipeControllerTest extends TestCase { * * @dataProvider dataTest */ - public function testCheckWipe(bool $valid, bool $couldPerform, bool $result) { + public function testCheckWipe(bool $valid, bool $couldPerform, bool $result): void { if (!$valid) { $this->remoteWipe->method('start') ->with('mytoken') @@ -79,7 +79,7 @@ class WipeControllerTest extends TestCase { * * @dataProvider dataTest */ - public function testWipeDone(bool $valid, bool $couldPerform, bool $result) { + public function testWipeDone(bool $valid, bool $couldPerform, bool $result): void { if (!$valid) { $this->remoteWipe->method('finish') ->with('mytoken') diff --git a/tests/Core/Data/LoginFlowV2CredentialsTest.php b/tests/Core/Data/LoginFlowV2CredentialsTest.php index 0bb32f1c967..41575f33a9c 100644 --- a/tests/Core/Data/LoginFlowV2CredentialsTest.php +++ b/tests/Core/Data/LoginFlowV2CredentialsTest.php @@ -20,20 +20,20 @@ class LoginFlowV2CredentialsTest extends TestCase { $this->fixture = new LoginFlowV2Credentials('server', 'login', 'pass'); } - public function testImplementsJsonSerializable() { + public function testImplementsJsonSerializable(): void { $this->assertTrue($this->fixture instanceof JsonSerializable); } /** * Test getter functions. */ - public function testGetter() { + public function testGetter(): void { $this->assertEquals('server', $this->fixture->getServer()); $this->assertEquals('login', $this->fixture->getLoginName()); $this->assertEquals('pass', $this->fixture->getAppPassword()); } - public function testJsonSerialize() { + public function testJsonSerialize(): void { $this->assertEquals( [ 'server' => 'server', diff --git a/tests/Core/Middleware/TwoFactorMiddlewareTest.php b/tests/Core/Middleware/TwoFactorMiddlewareTest.php index a245845a674..6b8bf1c76e0 100644 --- a/tests/Core/Middleware/TwoFactorMiddlewareTest.php +++ b/tests/Core/Middleware/TwoFactorMiddlewareTest.php @@ -82,7 +82,7 @@ class TwoFactorMiddlewareTest extends TestCase { $this->controller = $this->createMock(Controller::class); } - public function testBeforeControllerNotLoggedIn() { + public function testBeforeControllerNotLoggedIn(): void { $this->userSession->expects($this->once()) ->method('isLoggedIn') ->willReturn(false); @@ -93,7 +93,7 @@ class TwoFactorMiddlewareTest extends TestCase { $this->middleware->beforeController($this->controller, 'index'); } - public function testBeforeSetupController() { + public function testBeforeSetupController(): void { $user = $this->createMock(IUser::class); $controller = $this->createMock(ALoginSetupController::class); $this->userSession->expects($this->any()) @@ -108,7 +108,7 @@ class TwoFactorMiddlewareTest extends TestCase { $this->middleware->beforeController($controller, 'create'); } - public function testBeforeControllerNoTwoFactorCheckNeeded() { + public function testBeforeControllerNoTwoFactorCheckNeeded(): void { $user = $this->createMock(IUser::class); $this->userSession->expects($this->once()) @@ -126,7 +126,7 @@ class TwoFactorMiddlewareTest extends TestCase { } - public function testBeforeControllerTwoFactorAuthRequired() { + public function testBeforeControllerTwoFactorAuthRequired(): void { $this->expectException(TwoFactorAuthRequiredException::class); $user = $this->createMock(IUser::class); @@ -150,7 +150,7 @@ class TwoFactorMiddlewareTest extends TestCase { } - public function testBeforeControllerUserAlreadyLoggedIn() { + public function testBeforeControllerUserAlreadyLoggedIn(): void { $this->expectException(UserAlreadyLoggedInException::class); $user = $this->createMock(IUser::class); @@ -179,7 +179,7 @@ class TwoFactorMiddlewareTest extends TestCase { $this->middleware->beforeController($twoFactorChallengeController, 'index'); } - public function testAfterExceptionTwoFactorAuthRequired() { + public function testAfterExceptionTwoFactorAuthRequired(): void { $ex = new TwoFactorAuthRequiredException(); $this->urlGenerator->expects($this->once()) @@ -191,7 +191,7 @@ class TwoFactorMiddlewareTest extends TestCase { $this->assertEquals($expected, $this->middleware->afterException($this->controller, 'index', $ex)); } - public function testAfterException() { + public function testAfterException(): void { $ex = new UserAlreadyLoggedInException(); $this->urlGenerator->expects($this->once()) @@ -203,7 +203,7 @@ class TwoFactorMiddlewareTest extends TestCase { $this->assertEquals($expected, $this->middleware->afterException($this->controller, 'index', $ex)); } - public function testRequires2FASetupDoneAnnotated() { + public function testRequires2FASetupDoneAnnotated(): void { $user = $this->createMock(IUser::class); $this->reflector @@ -250,7 +250,7 @@ class TwoFactorMiddlewareTest extends TestCase { /** * @dataProvider dataRequires2FASetupDone */ - public function testRequires2FASetupDone(array $providers, bool $missingProviders, bool $expectEception) { + public function testRequires2FASetupDone(array $providers, bool $missingProviders, bool $expectEception): void { $user = $this->createMock(IUser::class); $this->reflector diff --git a/tests/Core/Service/LoginFlowV2ServiceUnitTest.php b/tests/Core/Service/LoginFlowV2ServiceUnitTest.php index 2e6407d4c00..2fb61a2ef08 100644 --- a/tests/Core/Service/LoginFlowV2ServiceUnitTest.php +++ b/tests/Core/Service/LoginFlowV2ServiceUnitTest.php @@ -127,7 +127,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase { * Tests for poll */ - public function testPollApptokenCouldNotBeDecrypted() { + public function testPollApptokenCouldNotBeDecrypted(): void { $this->expectException(LoginFlowV2NotFoundException::class); $this->expectExceptionMessage('Apptoken could not be decrypted'); @@ -148,7 +148,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase { $this->subjectUnderTest->poll(''); } - public function testPollInvalidToken() { + public function testPollInvalidToken(): void { $this->expectException(LoginFlowV2NotFoundException::class); $this->expectExceptionMessage('Invalid token'); @@ -159,14 +159,14 @@ class LoginFlowV2ServiceUnitTest extends TestCase { $this->subjectUnderTest->poll(''); } - public function testPollTokenNotYetReady() { + public function testPollTokenNotYetReady(): void { $this->expectException(LoginFlowV2NotFoundException::class); $this->expectExceptionMessage('Token not yet ready'); $this->subjectUnderTest->poll(''); } - public function testPollRemoveDataFromDb() { + public function testPollRemoveDataFromDb(): void { [$encrypted, $privateKey] = $this->getOpenSSLEncryptedPublicAndPrivateKey('test_pass'); $this->crypto->expects($this->once()) @@ -208,7 +208,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase { * Tests for getByLoginToken */ - public function testGetByLoginToken() { + public function testGetByLoginToken(): void { $loginFlowV2 = new LoginFlowV2(); $loginFlowV2->setLoginName('test_login'); $loginFlowV2->setServer('test_server'); @@ -226,7 +226,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase { $this->assertEquals('test', $result->getAppPassword()); } - public function testGetByLoginTokenLoginTokenInvalid() { + public function testGetByLoginTokenLoginTokenInvalid(): void { $this->expectException(LoginFlowV2NotFoundException::class); $this->expectExceptionMessage('Login token invalid'); @@ -241,7 +241,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase { * Tests for startLoginFlow */ - public function testStartLoginFlow() { + public function testStartLoginFlow(): void { $loginFlowV2 = new LoginFlowV2(); $this->mapper->expects($this->once()) @@ -254,7 +254,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase { $this->assertTrue($this->subjectUnderTest->startLoginFlow('test_token')); } - public function testStartLoginFlowDoesNotExistException() { + public function testStartLoginFlowDoesNotExistException(): void { $this->mapper->expects($this->once()) ->method('getByLoginToken') ->willThrowException(new DoesNotExistException('')); @@ -266,7 +266,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase { * If an exception not of type DoesNotExistException is thrown, * it is expected that it is not being handled by startLoginFlow. */ - public function testStartLoginFlowException() { + public function testStartLoginFlowException(): void { $this->expectException(Exception::class); $this->mapper->expects($this->once()) @@ -280,7 +280,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase { * Tests for flowDone */ - public function testFlowDone() { + public function testFlowDone(): void { [,, $publicKey] = $this->getOpenSSLEncryptedPublicAndPrivateKey('test_pass'); $loginFlowV2 = new LoginFlowV2(); @@ -340,7 +340,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase { $this->assertEquals('server', $loginFlowV2->getServer()); } - public function testFlowDoneDoesNotExistException() { + public function testFlowDoneDoesNotExistException(): void { $this->mapper->expects($this->once()) ->method('getByLoginToken') ->willThrowException(new DoesNotExistException('')); @@ -354,7 +354,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase { $this->assertFalse($result); } - public function testFlowDonePasswordlessTokenException() { + public function testFlowDonePasswordlessTokenException(): void { $this->tokenProvider->expects($this->once()) ->method('getToken') ->willThrowException(new InvalidTokenException('')); @@ -372,7 +372,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase { * Tests for createTokens */ - public function testCreateTokens() { + public function testCreateTokens(): void { $this->config->expects($this->exactly(2)) ->method('getSystemValue') ->willReturn($this->returnCallback(function ($key) { |