summaryrefslogtreecommitdiffstats
path: root/tests/Core/Command/Encryption
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
commitcaff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch)
tree186d494c2aea5dea7255d3584ef5d595fc6e6194 /tests/Core/Command/Encryption
parentedf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff)
downloadnextcloud-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/Encryption')
-rw-r--r--tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php9
-rw-r--r--tests/Core/Command/Encryption/DecryptAllTest.php7
-rw-r--r--tests/Core/Command/Encryption/EncryptAllTest.php3
3 files changed, 3 insertions, 16 deletions
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]);
}
-
}