summaryrefslogtreecommitdiffstats
path: root/settings/controller
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-07-28 15:12:41 +0200
committerLukas Reschke <lukas@owncloud.com>2015-07-28 16:32:11 +0200
commit7f6c5e456b6216a218f7d59576e47d5b80b0fa65 (patch)
treefaaee94f0dd6eccac38162cbd7b8cf7a5e3398ec /settings/controller
parent2c8fa5488174d82403b92314f128faa05da8d49d (diff)
downloadnextcloud-server-7f6c5e456b6216a218f7d59576e47d5b80b0fa65.tar.gz
nextcloud-server-7f6c5e456b6216a218f7d59576e47d5b80b0fa65.zip
Add unit tests
Diffstat (limited to 'settings/controller')
-rw-r--r--settings/controller/encryptioncontroller.php38
1 files changed, 25 insertions, 13 deletions
diff --git a/settings/controller/encryptioncontroller.php b/settings/controller/encryptioncontroller.php
index 11640a6283b..7aaf184482f 100644
--- a/settings/controller/encryptioncontroller.php
+++ b/settings/controller/encryptioncontroller.php
@@ -82,6 +82,20 @@ class EncryptionController extends Controller {
}
/**
+ * @param IConfig $config
+ * @param View $view
+ * @param Connection $connection
+ * @param ILogger $logger
+ * @return Migration
+ */
+ protected function getMigration(IConfig $config,
+ View $view,
+ Connection $connection,
+ ILogger $logger) {
+ return new Migration($config, $view, $connection, $logger);
+ }
+
+ /**
* start migration
*
* @return array
@@ -92,12 +106,11 @@ class EncryptionController extends Controller {
try {
- $migration = new Migration($this->config, $this->view, $this->connection, $this->logger);
+ $migration = $this->getMigration($this->config, $this->view, $this->connection, $this->logger);
$migration->reorganizeSystemFolderStructure();
$migration->updateDB();
foreach ($this->userManager->getBackends() as $backend) {
-
$limit = 500;
$offset = 0;
do {
@@ -112,21 +125,20 @@ class EncryptionController extends Controller {
$migration->finalCleanUp();
} catch (\Exception $e) {
- return array(
- 'data' => array(
+ return [
+ 'data' => [
'message' => (string)$this->l10n->t('A problem occurred, please check your log files (Error: %s)', [$e->getMessage()]),
- ),
+ ],
'status' => 'error',
- );
+ ];
}
- return array('data' =>
- array('message' =>
- (string) $this->l10n->t('Migration Completed')
- ),
- 'status' => 'success'
- );
-
+ return [
+ 'data' => [
+ 'message' => (string) $this->l10n->t('Migration Completed'),
+ ],
+ 'status' => 'success',
+ ];
}
}