diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2024-08-23 15:10:27 +0200 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2024-08-25 19:34:58 +0200 |
commit | af6de04e9e141466dc229e444ff3f146f4a34765 (patch) | |
tree | 7b93f521865cdecdadb33637dea33bea242e7969 /tests/Core | |
parent | 1cc6b3577fdbeadece7e4e6478e7f7755555b41a (diff) | |
download | nextcloud-server-af6de04e9e141466dc229e444ff3f146f4a34765.tar.gz nextcloud-server-af6de04e9e141466dc229e444ff3f146f4a34765.zip |
style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'tests/Core')
18 files changed, 78 insertions, 78 deletions
diff --git a/tests/Core/Command/Config/App/GetConfigTest.php b/tests/Core/Command/Config/App/GetConfigTest.php index 79b79ea5576..150fceca92f 100644 --- a/tests/Core/Command/Config/App/GetConfigTest.php +++ b/tests/Core/Command/Config/App/GetConfigTest.php @@ -106,9 +106,9 @@ class GetConfigTest extends TestCase { if (!$configExists) { $this->config->expects($this->once()) - ->method('getDetails') - ->with('app-name', $configName) - ->willThrowException(new AppConfigUnknownKeyException()); + ->method('getDetails') + ->with('app-name', $configName) + ->willThrowException(new AppConfigUnknownKeyException()); } $this->consoleInput->expects($this->exactly(2)) diff --git a/tests/Core/Command/Config/App/SetConfigTest.php b/tests/Core/Command/Config/App/SetConfigTest.php index 5c7e856f6fa..6563dd13fc2 100644 --- a/tests/Core/Command/Config/App/SetConfigTest.php +++ b/tests/Core/Command/Config/App/SetConfigTest.php @@ -74,18 +74,18 @@ class SetConfigTest extends TestCase { */ public function testSet($configName, $newValue, $configExists, $updateOnly, $updated, $expectedMessage) { $this->config->expects($this->any()) - ->method('hasKey') - ->with('app-name', $configName) - ->willReturn($configExists); + ->method('hasKey') + ->with('app-name', $configName) + ->willReturn($configExists); if (!$configExists) { $this->config->expects($this->any()) - ->method('getValueType') - ->willThrowException(new AppConfigUnknownKeyException()); + ->method('getValueType') + ->willThrowException(new AppConfigUnknownKeyException()); } else { $this->config->expects($this->any()) - ->method('getValueType') - ->willReturn(IAppConfig::VALUE_MIXED); + ->method('getValueType') + ->willReturn(IAppConfig::VALUE_MIXED); } if ($updated) { diff --git a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php index 4334994e8d3..85271565192 100644 --- a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php +++ b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php @@ -32,7 +32,7 @@ class ChangeKeyStorageRootTest extends TestCase { /** @var IConfig | \PHPUnit\Framework\MockObject\MockObject */ protected $config; - /** @var Util | \PHPUnit\Framework\MockObject\MockObject */ + /** @var Util | \PHPUnit\Framework\MockObject\MockObject */ protected $util; /** @var QuestionHelper | \PHPUnit\Framework\MockObject\MockObject */ @@ -213,7 +213,7 @@ class ChangeKeyStorageRootTest extends TestCase { if ($executeRename) { $this->view->expects($this->once())->method('rename') - ->with('oldRoot/files_encryption', 'newRoot/files_encryption'); + ->with('oldRoot/files_encryption', 'newRoot/files_encryption'); } else { $this->view->expects($this->never())->method('rename'); } diff --git a/tests/Core/Command/Encryption/DecryptAllTest.php b/tests/Core/Command/Encryption/DecryptAllTest.php index 3ae14a3e12d..46cd2cfc4bc 100644 --- a/tests/Core/Command/Encryption/DecryptAllTest.php +++ b/tests/Core/Command/Encryption/DecryptAllTest.php @@ -20,13 +20,13 @@ class DecryptAllTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IConfig */ protected $config; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IManager */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IManager */ protected $encryptionManager; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\App\IAppManager */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\App\IAppManager */ protected $appManager; - /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */ protected $consoleInput; /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Output\OutputInterface */ diff --git a/tests/Core/Command/Encryption/EncryptAllTest.php b/tests/Core/Command/Encryption/EncryptAllTest.php index 83eeb5abdaa..994aa43a938 100644 --- a/tests/Core/Command/Encryption/EncryptAllTest.php +++ b/tests/Core/Command/Encryption/EncryptAllTest.php @@ -21,13 +21,13 @@ class EncryptAllTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IConfig */ protected $config; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IManager */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IManager */ protected $encryptionManager; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\App\IAppManager */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\App\IAppManager */ protected $appManager; - /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */ + /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */ protected $consoleInput; /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Output\OutputInterface */ @@ -39,7 +39,7 @@ class EncryptAllTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IEncryptionModule */ protected $encryptionModule; - /** @var EncryptAll */ + /** @var EncryptAll */ protected $command; protected function setUp(): void { diff --git a/tests/Core/Command/Maintenance/ModeTest.php b/tests/Core/Command/Maintenance/ModeTest.php index 458699649b2..08ca1762da1 100644 --- a/tests/Core/Command/Maintenance/ModeTest.php +++ b/tests/Core/Command/Maintenance/ModeTest.php @@ -115,7 +115,7 @@ class ModeTest extends TestCase { * @param string $option The command option. * @param bool $currentMaintenanceState The current maintenance state. * @param null|bool $expectedMaintenanceState - * The expected maintenance state. Null for no change. + * The expected maintenance state. Null for no change. * @param string $expectedOutput The expected command output. * @throws \Exception */ diff --git a/tests/Core/Command/Preview/RepairTest.php b/tests/Core/Command/Preview/RepairTest.php index b257c59d9d2..4717ee05f09 100644 --- a/tests/Core/Command/Preview/RepairTest.php +++ b/tests/Core/Command/Preview/RepairTest.php @@ -147,7 +147,7 @@ class RepairTest extends TestCase { ->willReturn($directories); $this->rootFolder->expects($this->once()) ->method('get') - ->with("appdata_/preview") + ->with('appdata_/preview') ->willReturn($previewFolder); $this->repair->run($this->input, $this->output); diff --git a/tests/Core/Command/SystemTag/EditTest.php b/tests/Core/Command/SystemTag/EditTest.php index 4273d666ff5..90a7df00753 100644 --- a/tests/Core/Command/SystemTag/EditTest.php +++ b/tests/Core/Command/SystemTag/EditTest.php @@ -169,8 +169,8 @@ class EditTest extends TestCase { }); $this->systemTagManager->method('getTagsByIds') - ->with($tagId) - ->willReturn([]); + ->with($tagId) + ->willReturn([]); $this->output->expects($this->once()) ->method('writeln') diff --git a/tests/Core/Command/TwoFactorAuth/CleanupTest.php b/tests/Core/Command/TwoFactorAuth/CleanupTest.php index 8f082d76856..040bc08a858 100644 --- a/tests/Core/Command/TwoFactorAuth/CleanupTest.php +++ b/tests/Core/Command/TwoFactorAuth/CleanupTest.php @@ -47,6 +47,6 @@ class CleanupTest extends TestCase { $this->assertEquals(0, $rc); $output = $this->cmd->getDisplay(); - $this->assertStringContainsString("All user-provider associations for provider u2f have been removed", $output); + $this->assertStringContainsString('All user-provider associations for provider u2f have been removed', $output); } } diff --git a/tests/Core/Command/TwoFactorAuth/DisableTest.php b/tests/Core/Command/TwoFactorAuth/DisableTest.php index 4c1db3b1dc2..b123d09848a 100644 --- a/tests/Core/Command/TwoFactorAuth/DisableTest.php +++ b/tests/Core/Command/TwoFactorAuth/DisableTest.php @@ -49,7 +49,7 @@ class DisableTest extends TestCase { ]); $this->assertEquals(1, $rc); - $this->assertStringContainsString("Invalid UID", $this->command->getDisplay()); + $this->assertStringContainsString('Invalid UID', $this->command->getDisplay()); } public function testEnableNotSupported() { @@ -69,7 +69,7 @@ class DisableTest extends TestCase { ]); $this->assertEquals(2, $rc); - $this->assertStringContainsString("The provider does not support this operation", $this->command->getDisplay()); + $this->assertStringContainsString('The provider does not support this operation', $this->command->getDisplay()); } public function testEnabled() { @@ -89,6 +89,6 @@ class DisableTest extends TestCase { ]); $this->assertEquals(0, $rc); - $this->assertStringContainsString("Two-factor provider totp disabled for user ricky", $this->command->getDisplay()); + $this->assertStringContainsString('Two-factor provider totp disabled for user ricky', $this->command->getDisplay()); } } diff --git a/tests/Core/Command/TwoFactorAuth/EnableTest.php b/tests/Core/Command/TwoFactorAuth/EnableTest.php index 79755b9984d..f78085e72a1 100644 --- a/tests/Core/Command/TwoFactorAuth/EnableTest.php +++ b/tests/Core/Command/TwoFactorAuth/EnableTest.php @@ -49,7 +49,7 @@ class EnableTest extends TestCase { ]); $this->assertEquals(1, $rc); - $this->assertStringContainsString("Invalid UID", $this->command->getDisplay()); + $this->assertStringContainsString('Invalid UID', $this->command->getDisplay()); } public function testEnableNotSupported() { @@ -69,7 +69,7 @@ class EnableTest extends TestCase { ]); $this->assertEquals(2, $rc); - $this->assertStringContainsString("The provider does not support this operation", $this->command->getDisplay()); + $this->assertStringContainsString('The provider does not support this operation', $this->command->getDisplay()); } public function testEnabled() { @@ -89,6 +89,6 @@ class EnableTest extends TestCase { ]); $this->assertEquals(0, $rc); - $this->assertStringContainsString("Two-factor provider totp enabled for user belle", $this->command->getDisplay()); + $this->assertStringContainsString('Two-factor provider totp enabled for user belle', $this->command->getDisplay()); } } diff --git a/tests/Core/Command/TwoFactorAuth/EnforceTest.php b/tests/Core/Command/TwoFactorAuth/EnforceTest.php index 073ea7dede8..e709ca2c55a 100644 --- a/tests/Core/Command/TwoFactorAuth/EnforceTest.php +++ b/tests/Core/Command/TwoFactorAuth/EnforceTest.php @@ -46,7 +46,7 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertStringContainsString("Two-factor authentication is enforced for all users", $display); + $this->assertStringContainsString('Two-factor authentication is enforced for all users', $display); } public function testEnforceForOneGroup() { @@ -64,7 +64,7 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertStringContainsString("Two-factor authentication is enforced for members of the group(s) twofactorers", $display); + $this->assertStringContainsString('Two-factor authentication is enforced for members of the group(s) twofactorers', $display); } public function testEnforceForAllExceptOneGroup() { @@ -82,7 +82,7 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertStringContainsString("Two-factor authentication is enforced for all users, except members of yoloers", $display); + $this->assertStringContainsString('Two-factor authentication is enforced for all users, except members of yoloers', $display); } public function testDisableEnforced() { @@ -99,7 +99,7 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertStringContainsString("Two-factor authentication is not enforced", $display); + $this->assertStringContainsString('Two-factor authentication is not enforced', $display); } public function testCurrentStateEnabled() { @@ -111,7 +111,7 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertStringContainsString("Two-factor authentication is enforced for all users", $display); + $this->assertStringContainsString('Two-factor authentication is enforced for all users', $display); } public function testCurrentStateDisabled() { @@ -123,6 +123,6 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertStringContainsString("Two-factor authentication is not enforced", $display); + $this->assertStringContainsString('Two-factor authentication is not enforced', $display); } } diff --git a/tests/Core/Command/TwoFactorAuth/StateTest.php b/tests/Core/Command/TwoFactorAuth/StateTest.php index 23cb21f75d6..1d97d152a21 100644 --- a/tests/Core/Command/TwoFactorAuth/StateTest.php +++ b/tests/Core/Command/TwoFactorAuth/StateTest.php @@ -43,7 +43,7 @@ class StateTest extends TestCase { ]); $output = $this->cmd->getDisplay(); - $this->assertStringContainsString("Invalid UID", $output); + $this->assertStringContainsString('Invalid UID', $output); } public function testStateNoProvidersActive() { @@ -66,7 +66,7 @@ class StateTest extends TestCase { ]); $output = $this->cmd->getDisplay(); - $this->assertStringContainsString("Two-factor authentication is not enabled for user eldora", $output); + $this->assertStringContainsString('Two-factor authentication is not enabled for user eldora', $output); } public function testStateOneProviderActive() { @@ -89,6 +89,6 @@ class StateTest extends TestCase { ]); $output = $this->cmd->getDisplay(); - $this->assertStringContainsString("Two-factor authentication is enabled for user mohamed", $output); + $this->assertStringContainsString('Two-factor authentication is enabled for user mohamed', $output); } } diff --git a/tests/Core/Controller/AutoCompleteControllerTest.php b/tests/Core/Controller/AutoCompleteControllerTest.php index e2797181097..2b82342276b 100644 --- a/tests/Core/Controller/AutoCompleteControllerTest.php +++ b/tests/Core/Controller/AutoCompleteControllerTest.php @@ -15,13 +15,13 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class AutoCompleteControllerTest extends TestCase { - /** @var ISearch|MockObject */ + /** @var ISearch|MockObject */ protected $collaboratorSearch; - /** @var IManager|MockObject */ + /** @var IManager|MockObject */ protected $autoCompleteManager; - /** @var IEventDispatcher|MockObject */ + /** @var IEventDispatcher|MockObject */ protected $dispatcher; - /** @var AutoCompleteController */ + /** @var AutoCompleteController */ protected $controller; protected function setUp(): void { diff --git a/tests/Core/Controller/AvatarControllerTest.php b/tests/Core/Controller/AvatarControllerTest.php index b000482e29a..41c16bc4c3f 100644 --- a/tests/Core/Controller/AvatarControllerTest.php +++ b/tests/Core/Controller/AvatarControllerTest.php @@ -287,12 +287,12 @@ class AvatarControllerTest extends \Test\TestCase { * Test what happens if the removing of the avatar fails */ public function testDeleteAvatarException() { - $this->avatarMock->method('remove')->will($this->throwException(new \Exception("foo"))); + $this->avatarMock->method('remove')->will($this->throwException(new \Exception('foo'))); $this->avatarManager->method('getAvatar')->willReturn($this->avatarMock); $this->logger->expects($this->once()) ->method('error') - ->with('foo', ['exception' => new \Exception("foo"), 'app' => 'core']); + ->with('foo', ['exception' => new \Exception('foo'), 'app' => 'core']); $expectedResponse = new Http\JSONResponse(['data' => ['message' => 'An error occurred. Please contact your admin.']], Http::STATUS_BAD_REQUEST); $this->assertEquals($expectedResponse, $this->avatarController->deleteAvatar()); } @@ -330,7 +330,7 @@ class AvatarControllerTest extends \Test\TestCase { */ public function testPostAvatarFile() { //Create temp file - $fileName = tempnam('', "avatarTest"); + $fileName = tempnam('', 'avatarTest'); $copyRes = copy(\OC::$SERVERROOT.'/tests/data/testimage.jpg', $fileName); $this->assertTrue($copyRes); @@ -368,7 +368,7 @@ class AvatarControllerTest extends \Test\TestCase { */ public function testPostAvatarFileGif() { //Create temp file - $fileName = tempnam('', "avatarTest"); + $fileName = tempnam('', 'avatarTest'); $copyRes = copy(\OC::$SERVERROOT.'/tests/data/testimage.gif', $fileName); $this->assertTrue($copyRes); @@ -469,7 +469,7 @@ class AvatarControllerTest extends \Test\TestCase { public function testPostAvatarException() { $this->cache->expects($this->once()) ->method('set') - ->will($this->throwException(new \Exception("foo"))); + ->will($this->throwException(new \Exception('foo'))); $file = $this->getMockBuilder('OCP\Files\File') ->disableOriginalConstructor()->getMock(); $file->expects($this->once()) @@ -484,7 +484,7 @@ class AvatarControllerTest extends \Test\TestCase { $this->logger->expects($this->once()) ->method('error') - ->with('foo', ['exception' => new \Exception("foo"), 'app' => 'core']); + ->with('foo', ['exception' => new \Exception('foo'), 'app' => 'core']); $expectedResponse = new Http\JSONResponse(['data' => ['message' => 'An error occurred. Please contact your admin.']], Http::STATUS_OK); $this->assertEquals($expectedResponse, $this->avatarController->postAvatar('avatar.jpg')); } @@ -544,7 +544,7 @@ class AvatarControllerTest extends \Test\TestCase { $this->logger->expects($this->once()) ->method('error') - ->with('foo', ['exception' => new \Exception("foo"), 'app' => 'core']); + ->with('foo', ['exception' => new \Exception('foo'), 'app' => 'core']); $expectedResponse = new Http\JSONResponse(['data' => ['message' => 'An error occurred. Please contact your admin.']], Http::STATUS_BAD_REQUEST); $this->assertEquals($expectedResponse, $this->avatarController->postCroppedAvatar(['x' => 0, 'y' => 0, 'w' => 10, 'h' => 11])); } diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php index 1e1771f7a15..7e9d085a291 100644 --- a/tests/Core/Controller/LostControllerTest.php +++ b/tests/Core/Controller/LostControllerTest.php @@ -232,10 +232,10 @@ class LostControllerTest extends TestCase { public function testEmailSuccessful() { $this->userManager - ->expects($this->any()) - ->method('get') - ->with('ExistingUser') - ->willReturn($this->existingUser); + ->expects($this->any()) + ->method('get') + ->with('ExistingUser') + ->willReturn($this->existingUser); $this->verificationToken->expects($this->once()) ->method('create') ->willReturn('ThisIsMaybeANotSoSecretToken!'); @@ -289,15 +289,15 @@ class LostControllerTest extends TestCase { public function testEmailWithMailSuccessful() { $this->userManager - ->expects($this->any()) - ->method('get') - ->with('test@example.com') - ->willReturn(null); + ->expects($this->any()) + ->method('get') + ->with('test@example.com') + ->willReturn(null); $this->userManager - ->expects($this->any()) - ->method('getByEmail') - ->with('test@example.com') - ->willReturn([$this->existingUser]); + ->expects($this->any()) + ->method('getByEmail') + ->with('test@example.com') + ->willReturn([$this->existingUser]); $this->verificationToken->expects($this->once()) ->method('create') ->willReturn('ThisIsMaybeANotSoSecretToken!'); @@ -351,10 +351,10 @@ class LostControllerTest extends TestCase { public function testEmailCantSendException() { $this->userManager - ->expects($this->any()) - ->method('get') - ->with('ExistingUser') - ->willReturn($this->existingUser); + ->expects($this->any()) + ->method('get') + ->with('ExistingUser') + ->willReturn($this->existingUser); $this->verificationToken->expects($this->once()) ->method('create') ->willReturn('ThisIsMaybeANotSoSecretToken!'); @@ -709,10 +709,10 @@ class LostControllerTest extends TestCase { public function testTrimEmailInput() { $this->userManager - ->expects($this->once()) - ->method('getByEmail') - ->with('test@example.com') - ->willReturn([$this->existingUser]); + ->expects($this->once()) + ->method('getByEmail') + ->with('test@example.com') + ->willReturn([$this->existingUser]); $this->mailer ->expects($this->once()) @@ -726,10 +726,10 @@ class LostControllerTest extends TestCase { public function testUsernameInput() { $this->userManager - ->expects($this->once()) - ->method('get') - ->with('ExistingUser') - ->willReturn($this->existingUser); + ->expects($this->once()) + ->method('get') + ->with('ExistingUser') + ->willReturn($this->existingUser); $this->mailer ->expects($this->once()) diff --git a/tests/Core/Controller/TwoFactorChallengeControllerTest.php b/tests/Core/Controller/TwoFactorChallengeControllerTest.php index f003975b359..3e99c2cad14 100644 --- a/tests/Core/Controller/TwoFactorChallengeControllerTest.php +++ b/tests/Core/Controller/TwoFactorChallengeControllerTest.php @@ -288,7 +288,7 @@ class TwoFactorChallengeControllerTest extends TestCase { public function testSolveChallengeTwoFactorException() { $user = $this->createMock(IUser::class); $provider = $this->createMock(IProvider::class); - $exception = new TwoFactorException("2FA failed"); + $exception = new TwoFactorException('2FA failed'); $this->userSession->expects($this->once()) ->method('getUser') diff --git a/tests/Core/Controller/WellKnownControllerTest.php b/tests/Core/Controller/WellKnownControllerTest.php index 99c693c78b7..35606dc6384 100644 --- a/tests/Core/Controller/WellKnownControllerTest.php +++ b/tests/Core/Controller/WellKnownControllerTest.php @@ -40,7 +40,7 @@ class WellKnownControllerTest extends TestCase { } public function testHandleNotProcessed(): void { - $httpResponse = $this->controller->handle("nodeinfo"); + $httpResponse = $this->controller->handle('nodeinfo'); self::assertInstanceOf(JSONResponse::class, $httpResponse); self::assertArrayHasKey('X-NEXTCLOUD-WELL-KNOWN', $httpResponse->getHeaders()); @@ -55,14 +55,14 @@ class WellKnownControllerTest extends TestCase { $this->manager->expects(self::once()) ->method('process') ->with( - "nodeinfo", + 'nodeinfo', $this->request )->willReturn($response); $jsonResponse->expects(self::once()) ->method('addHeader') ->willReturnSelf(); - $httpResponse = $this->controller->handle("nodeinfo"); + $httpResponse = $this->controller->handle('nodeinfo'); self::assertInstanceOf(JSONResponse::class, $httpResponse); } |