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 /apps/encryption/tests/Crypto | |
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 'apps/encryption/tests/Crypto')
-rw-r--r-- | apps/encryption/tests/Crypto/CryptTest.php | 11 | ||||
-rw-r--r-- | apps/encryption/tests/Crypto/DecryptAllTest.php | 2 | ||||
-rw-r--r-- | apps/encryption/tests/Crypto/EncryptAllTest.php | 7 | ||||
-rw-r--r-- | apps/encryption/tests/Crypto/EncryptionTest.php | 6 |
4 files changed, 1 insertions, 25 deletions
diff --git a/apps/encryption/tests/Crypto/CryptTest.php b/apps/encryption/tests/Crypto/CryptTest.php index dd892616d0f..6f7b0cc2765 100644 --- a/apps/encryption/tests/Crypto/CryptTest.php +++ b/apps/encryption/tests/Crypto/CryptTest.php @@ -76,7 +76,6 @@ class CryptTest extends TestCase { * test getOpenSSLConfig without any additional parameters */ public function testGetOpenSSLConfigBasic() { - $this->config->expects($this->once()) ->method('getSystemValue') ->with($this->equalTo('openssl'), $this->equalTo([])) @@ -92,7 +91,6 @@ class CryptTest extends TestCase { * test getOpenSSLConfig with additional parameters defined in config.php */ public function testGetOpenSSLConfig() { - $this->config->expects($this->once()) ->method('getSystemValue') ->with($this->equalTo('openssl'), $this->equalTo([])) @@ -113,7 +111,6 @@ class CryptTest extends TestCase { * @dataProvider dataTestGenerateHeader */ public function testGenerateHeader($keyFormat, $expected) { - $this->config->expects($this->once()) ->method('getSystemValue') ->with($this->equalTo('cipher'), $this->equalTo('AES-256-CTR')) @@ -176,7 +173,6 @@ class CryptTest extends TestCase { $this->assertSame($expected, $this->crypt->getCipher() ); - } /** @@ -199,7 +195,6 @@ class CryptTest extends TestCase { * test concatIV() */ public function testConcatIV() { - $result = self::invokePrivate( $this->crypt, 'concatIV', @@ -305,7 +300,6 @@ class CryptTest extends TestCase { * test parseHeader() */ public function testParseHeader() { - $header= 'HBEGIN:foo:bar:cipher:AES-256-CFB:HEND'; $result = self::invokePrivate($this->crypt, 'parseHeader', [$header]); @@ -323,7 +317,6 @@ class CryptTest extends TestCase { * @return string */ public function testEncrypt() { - $decrypted = 'content'; $password = 'password'; $iv = self::invokePrivate($this->crypt, 'generateIv'); @@ -340,7 +333,6 @@ class CryptTest extends TestCase { 'iv' => $iv, 'encrypted' => $result, 'decrypted' => $decrypted]; - } /** @@ -349,14 +341,12 @@ class CryptTest extends TestCase { * @depends testEncrypt */ public function testDecrypt($data) { - $result = self::invokePrivate( $this->crypt, 'decrypt', [$data['encrypted'], $data['iv'], $data['password']]); $this->assertSame($data['decrypted'], $result); - } /** @@ -461,5 +451,4 @@ class CryptTest extends TestCase { $this->invokePrivate($this->crypt, 'isValidPrivateKey', ['foo']) ); } - } diff --git a/apps/encryption/tests/Crypto/DecryptAllTest.php b/apps/encryption/tests/Crypto/DecryptAllTest.php index be980149145..b4d846bfd5a 100644 --- a/apps/encryption/tests/Crypto/DecryptAllTest.php +++ b/apps/encryption/tests/Crypto/DecryptAllTest.php @@ -110,7 +110,6 @@ class DecryptAllTest extends TestCase { $this->keyManager->expects($this->never())->method('getPrivateKey'); $this->crypt->expects($this->once())->method('decryptPrivateKey') ->with($masterKey, $password, $masterKeyId)->willReturn($unencryptedKey); - } else { $this->keyManager->expects($this->never())->method('getSystemPrivateKey'); $this->keyManager->expects($this->once())->method('getPrivateKey') @@ -131,5 +130,4 @@ class DecryptAllTest extends TestCase { ['masterKeyId', 'masterKeyId', 'masterKeyId'] ]; } - } diff --git a/apps/encryption/tests/Crypto/EncryptAllTest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php index f5fd3d2287f..3041c27dee7 100644 --- a/apps/encryption/tests/Crypto/EncryptAllTest.php +++ b/apps/encryption/tests/Crypto/EncryptAllTest.php @@ -168,7 +168,6 @@ class EncryptAllTest extends TestCase { $encryptAll->expects($this->at(2))->method('encryptAllUsersFiles')->with(); $encryptAll->encryptAll($this->inputInterface, $this->outputInterface); - } public function testEncryptAllWithMasterKey() { @@ -198,7 +197,6 @@ class EncryptAllTest extends TestCase { $encryptAll->expects($this->never())->method('outputPasswords'); $encryptAll->encryptAll($this->inputInterface, $this->outputInterface); - } public function testCreateKeyPairs() { @@ -280,7 +278,6 @@ class EncryptAllTest extends TestCase { $encryptAll->expects($this->at(1))->method('encryptUsersFiles')->with('user2'); $this->invokePrivate($encryptAll, 'encryptAllUsersFiles'); - } public function testEncryptUsersFiles() { @@ -339,7 +336,6 @@ class EncryptAllTest extends TestCase { $progressBar = new ProgressBar($this->outputInterface); $this->invokePrivate($encryptAll, 'encryptUsersFiles', ['user1', $progressBar, '']); - } public function testGenerateOneTimePassword() { @@ -364,7 +360,7 @@ class EncryptAllTest extends TestCase { ->willReturn($fileInfo); - if($isEncrypted) { + if ($isEncrypted) { $this->view->expects($this->never())->method('copy'); $this->view->expects($this->never())->method('rename'); } else { @@ -383,5 +379,4 @@ class EncryptAllTest extends TestCase { [false], ]; } - } diff --git a/apps/encryption/tests/Crypto/EncryptionTest.php b/apps/encryption/tests/Crypto/EncryptionTest.php index 1e4cfad5e30..dee1118a992 100644 --- a/apps/encryption/tests/Crypto/EncryptionTest.php +++ b/apps/encryption/tests/Crypto/EncryptionTest.php @@ -118,7 +118,6 @@ class EncryptionTest extends TestCase { $this->loggerMock, $this->l10nMock ); - } /** @@ -200,7 +199,6 @@ class EncryptionTest extends TestCase { * @dataProvider dataTestBegin */ public function testBegin($mode, $header, $legacyCipher, $defaultCipher, $fileKey, $expected) { - $this->sessionMock->expects($this->once()) ->method('decryptAllModeActivated') ->willReturn(false); @@ -255,7 +253,6 @@ class EncryptionTest extends TestCase { * test begin() if decryptAll mode was activated */ public function testBeginDecryptAll() { - $path = '/user/files/foo.txt'; $recoveryKeyId = 'recoveryKeyId'; $recoveryShareKey = 'recoveryShareKey'; @@ -299,7 +296,6 @@ class EncryptionTest extends TestCase { * and continue */ public function testBeginInitMasterKey() { - $this->sessionMock->expects($this->once())->method('isReady')->willReturn(false); $this->utilMock->expects($this->once())->method('isMasterKeyEnabled') ->willReturn(true); @@ -343,7 +339,6 @@ class EncryptionTest extends TestCase { } public function testUpdateNoUsers() { - $this->invokePrivate($this->instance, 'rememberVersion', [['path' => 2]]); $this->keyManagerMock->expects($this->never())->method('getFileKey'); @@ -452,5 +447,4 @@ class EncryptionTest extends TestCase { $this->instance->prepareDecryptAll($input, $output, 'user'); } - } |