diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /tests/Core/Command | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip |
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.
This also removes and empty lines from method/function bodies at the
beginning and end.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/Core/Command')
-rw-r--r-- | tests/Core/Command/Config/System/SetConfigTest.php | 1 | ||||
-rw-r--r-- | tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php | 9 | ||||
-rw-r--r-- | tests/Core/Command/Encryption/DecryptAllTest.php | 7 | ||||
-rw-r--r-- | tests/Core/Command/Encryption/EncryptAllTest.php | 3 | ||||
-rw-r--r-- | tests/Core/Command/Group/AddTest.php | 2 | ||||
-rw-r--r-- | tests/Core/Command/Group/AddUserTest.php | 2 | ||||
-rw-r--r-- | tests/Core/Command/Group/ListCommandTest.php | 2 | ||||
-rw-r--r-- | tests/Core/Command/Group/RemoveUserTest.php | 2 | ||||
-rw-r--r-- | tests/Core/Command/Log/FileTest.php | 1 | ||||
-rw-r--r-- | tests/Core/Command/Log/ManageTest.php | 1 | ||||
-rw-r--r-- | tests/Core/Command/TwoFactorAuth/CleanupTest.php | 1 | ||||
-rw-r--r-- | tests/Core/Command/TwoFactorAuth/EnableTest.php | 1 | ||||
-rw-r--r-- | tests/Core/Command/TwoFactorAuth/EnforceTest.php | 1 | ||||
-rw-r--r-- | tests/Core/Command/TwoFactorAuth/StateTest.php | 1 | ||||
-rw-r--r-- | tests/Core/Command/User/SettingTest.php | 2 |
15 files changed, 3 insertions, 33 deletions
diff --git a/tests/Core/Command/Config/System/SetConfigTest.php b/tests/Core/Command/Config/System/SetConfigTest.php index e359e846aa7..0a446c5fd1e 100644 --- a/tests/Core/Command/Config/System/SetConfigTest.php +++ b/tests/Core/Command/Config/System/SetConfigTest.php @@ -175,5 +175,4 @@ class SetConfigTest extends TestCase { $this->invokePrivate($this->command, 'castValue', [$value, $type]); } - } diff --git a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php index 4f3fc432dfe..1d33dc570b6 100644 --- a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php +++ b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php @@ -85,14 +85,12 @@ class ChangeKeyStorageRootTest extends TestCase { $this->util, $this->questionHelper ); - } /** * @dataProvider dataTestExecute */ public function testExecute($newRoot, $answer, $successMoveKey) { - $changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot') ->setConstructorArgs( [ @@ -164,7 +162,6 @@ class ChangeKeyStorageRootTest extends TestCase { $changeKeyStorageRoot->expects($this->at(2))->method('moveUserKeys')->with('oldRoot', 'newRoot', $this->outputInterface); $this->invokePrivate($changeKeyStorageRoot, 'moveAllKeys', ['oldRoot', 'newRoot', $this->outputInterface]); - } public function testPrepareNewRoot() { @@ -210,7 +207,6 @@ class ChangeKeyStorageRootTest extends TestCase { * @param bool $executeRename */ public function testMoveSystemKeys($dirExists, $targetExists, $executeRename) { - $changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot') ->setConstructorArgs( [ @@ -235,7 +231,6 @@ class ChangeKeyStorageRootTest extends TestCase { } $this->invokePrivate($changeKeyStorageRoot, 'moveSystemKeys', ['oldRoot', 'newRoot']); - } public function dataTestMoveSystemKeys() { @@ -249,7 +244,6 @@ class ChangeKeyStorageRootTest extends TestCase { public function testMoveUserKeys() { - $changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot') ->setConstructorArgs( [ @@ -280,7 +274,6 @@ class ChangeKeyStorageRootTest extends TestCase { * @param bool $shouldRename */ public function testMoveUserEncryptionFolder($userExists, $isDir, $targetExists, $shouldRename) { - $changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot') ->setConstructorArgs( [ @@ -310,7 +303,6 @@ class ChangeKeyStorageRootTest extends TestCase { } $this->invokePrivate($changeKeyStorageRoot, 'moveUserEncryptionFolder', ['user1', 'oldRoot', 'newRoot']); - } public function dataTestMoveUserEncryptionFolder() { @@ -379,5 +371,4 @@ class ChangeKeyStorageRootTest extends TestCase { $this->invokePrivate($this->changeKeyStorageRoot, 'targetExists', ['path']); } - } diff --git a/tests/Core/Command/Encryption/DecryptAllTest.php b/tests/Core/Command/Encryption/DecryptAllTest.php index a6918404d71..33140fa2644 100644 --- a/tests/Core/Command/Encryption/DecryptAllTest.php +++ b/tests/Core/Command/Encryption/DecryptAllTest.php @@ -83,7 +83,6 @@ class DecryptAllTest extends TestCase { $this->appManager->expects($this->any()) ->method('isEnabledForUser') ->with('files_trashbin')->willReturn(true); - } public function testMaintenanceAndTrashbin() { @@ -127,7 +126,6 @@ class DecryptAllTest extends TestCase { * @dataProvider dataTestExecute */ public function testExecute($encryptionEnabled, $continue) { - $instance = new DecryptAll( $this->encryptionManager, $this->appManager, @@ -217,9 +215,10 @@ class DecryptAllTest extends TestCase { $this->decryptAll->expects($this->once()) ->method('decryptAll') ->with($this->consoleInput, $this->consoleOutput, 'user1') - ->willReturnCallback(function () { throw new \Exception(); }); + ->willReturnCallback(function () { + throw new \Exception(); + }); $this->invokePrivate($instance, 'execute', [$this->consoleInput, $this->consoleOutput]); } - } diff --git a/tests/Core/Command/Encryption/EncryptAllTest.php b/tests/Core/Command/Encryption/EncryptAllTest.php index 4a0d40ea5b3..add57c0d9e5 100644 --- a/tests/Core/Command/Encryption/EncryptAllTest.php +++ b/tests/Core/Command/Encryption/EncryptAllTest.php @@ -80,7 +80,6 @@ class EncryptAllTest extends TestCase { ->method('isInteractive') ->willReturn(true); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); - } public function testEncryptAll() { @@ -102,7 +101,6 @@ class EncryptAllTest extends TestCase { * @dataProvider dataTestExecute */ public function testExecute($answer, $askResult) { - $command = new EncryptAll($this->encryptionManager, $this->appManager, $this->config, $this->questionHelper); $this->encryptionManager->expects($this->once())->method('isEnabled')->willReturn(true); @@ -137,5 +135,4 @@ class EncryptAllTest extends TestCase { $this->encryptionModule->expects($this->never())->method('encryptAll'); $this->invokePrivate($command, 'execute', [$this->consoleInput, $this->consoleOutput]); } - } diff --git a/tests/Core/Command/Group/AddTest.php b/tests/Core/Command/Group/AddTest.php index 87cf3c6b8d1..35449a9e3f4 100644 --- a/tests/Core/Command/Group/AddTest.php +++ b/tests/Core/Command/Group/AddTest.php @@ -94,6 +94,4 @@ class AddTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - - } diff --git a/tests/Core/Command/Group/AddUserTest.php b/tests/Core/Command/Group/AddUserTest.php index ad7267ca841..3f7f811b7e8 100644 --- a/tests/Core/Command/Group/AddUserTest.php +++ b/tests/Core/Command/Group/AddUserTest.php @@ -115,6 +115,4 @@ class AddUserTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - - } diff --git a/tests/Core/Command/Group/ListCommandTest.php b/tests/Core/Command/Group/ListCommandTest.php index 19ed9942145..4c539728949 100644 --- a/tests/Core/Command/Group/ListCommandTest.php +++ b/tests/Core/Command/Group/ListCommandTest.php @@ -123,6 +123,4 @@ class ListCommandTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - - } diff --git a/tests/Core/Command/Group/RemoveUserTest.php b/tests/Core/Command/Group/RemoveUserTest.php index f9a25face3b..906247d0896 100644 --- a/tests/Core/Command/Group/RemoveUserTest.php +++ b/tests/Core/Command/Group/RemoveUserTest.php @@ -115,6 +115,4 @@ class RemoveUserTest extends TestCase { $this->invokePrivate($this->command, 'execute', [$this->input, $this->output]); } - - } diff --git a/tests/Core/Command/Log/FileTest.php b/tests/Core/Command/Log/FileTest.php index 58507227780..4ecbf8914b6 100644 --- a/tests/Core/Command/Log/FileTest.php +++ b/tests/Core/Command/Log/FileTest.php @@ -119,5 +119,4 @@ class FileTest extends TestCase { self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } - } diff --git a/tests/Core/Command/Log/ManageTest.php b/tests/Core/Command/Log/ManageTest.php index 4425a9e0054..2724bba64dd 100644 --- a/tests/Core/Command/Log/ManageTest.php +++ b/tests/Core/Command/Log/ManageTest.php @@ -181,5 +181,4 @@ class ManageTest extends TestCase { self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } - } diff --git a/tests/Core/Command/TwoFactorAuth/CleanupTest.php b/tests/Core/Command/TwoFactorAuth/CleanupTest.php index 24aaa9abce2..98425aee223 100644 --- a/tests/Core/Command/TwoFactorAuth/CleanupTest.php +++ b/tests/Core/Command/TwoFactorAuth/CleanupTest.php @@ -62,5 +62,4 @@ class CleanupTest extends TestCase { $output = $this->cmd->getDisplay(); $this->assertContains("All user-provider associations for provider u2f have been removed", $output); } - } diff --git a/tests/Core/Command/TwoFactorAuth/EnableTest.php b/tests/Core/Command/TwoFactorAuth/EnableTest.php index faf00ed1ded..f3b66912f43 100644 --- a/tests/Core/Command/TwoFactorAuth/EnableTest.php +++ b/tests/Core/Command/TwoFactorAuth/EnableTest.php @@ -109,5 +109,4 @@ class EnableTest extends TestCase { $this->assertEquals(0, $rc); $this->assertContains("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 aa2cbc10620..48c09f7e639 100644 --- a/tests/Core/Command/TwoFactorAuth/EnforceTest.php +++ b/tests/Core/Command/TwoFactorAuth/EnforceTest.php @@ -143,5 +143,4 @@ class EnforceTest extends TestCase { $display = $this->command->getDisplay(); $this->assertContains("Two-factor authentication is not enforced", $display); } - } diff --git a/tests/Core/Command/TwoFactorAuth/StateTest.php b/tests/Core/Command/TwoFactorAuth/StateTest.php index 8d1b28862d3..ce52bcf2751 100644 --- a/tests/Core/Command/TwoFactorAuth/StateTest.php +++ b/tests/Core/Command/TwoFactorAuth/StateTest.php @@ -109,5 +109,4 @@ class StateTest extends TestCase { $output = $this->cmd->getDisplay(); $this->assertContains("Two-factor authentication is enabled for user mohamed", $output); } - } diff --git a/tests/Core/Command/User/SettingTest.php b/tests/Core/Command/User/SettingTest.php index 4aa3b5e4801..02a4dbfec09 100644 --- a/tests/Core/Command/User/SettingTest.php +++ b/tests/Core/Command/User/SettingTest.php @@ -75,7 +75,6 @@ class SettingTest extends TestCase { ->getMock(); return $mock; } - } public function dataCheckInput() { @@ -292,7 +291,6 @@ class SettingTest extends TestCase { $this->config->expects($this->once()) ->method('deleteUserValue') ->with('username', 'appname', 'configkey'); - } else { $this->consoleOutput->expects($this->once()) ->method('writeln') |