diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2018-03-01 15:23:17 +0100 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2018-03-02 10:09:52 +0100 |
commit | 8042e6b8fb0f0b4d3dd2c291729144f767575c56 (patch) | |
tree | 7fbf72c70dbf1c2173032a940167d6da00caef16 /tests | |
parent | 0f3ba9444e8b683ba89e100b6a43cab70b3788b9 (diff) | |
download | nextcloud-server-8042e6b8fb0f0b4d3dd2c291729144f767575c56.tar.gz nextcloud-server-8042e6b8fb0f0b4d3dd2c291729144f767575c56.zip |
this was a migration step to ownCloud 8.0 to restructure the encryption folder which is no longer needed
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Settings/ApplicationTest.php | 2 | ||||
-rw-r--r-- | tests/Settings/Controller/EncryptionControllerTest.php | 164 |
2 files changed, 0 insertions, 166 deletions
diff --git a/tests/Settings/ApplicationTest.php b/tests/Settings/ApplicationTest.php index 32ec4c2273c..8346f668d9d 100644 --- a/tests/Settings/ApplicationTest.php +++ b/tests/Settings/ApplicationTest.php @@ -30,7 +30,6 @@ use OC\Settings\Controller\AppSettingsController; use OC\Settings\Controller\AuthSettingsController; use OC\Settings\Controller\CertificateController; use OC\Settings\Controller\CheckSetupController; -use OC\Settings\Controller\EncryptionController; use OC\Settings\Controller\GroupsController; use OC\Settings\Controller\LogSettingsController; use OC\Settings\Controller\MailSettingsController; @@ -74,7 +73,6 @@ class ApplicationTest extends TestCase { [AuthSettingsController::class, Controller::class], // Needs session: [CertificateController::class, Controller::class], [CheckSetupController::class, Controller::class], - [EncryptionController::class, Controller::class], [GroupsController::class, Controller::class], [LogSettingsController::class, Controller::class], [MailSettingsController::class, Controller::class], diff --git a/tests/Settings/Controller/EncryptionControllerTest.php b/tests/Settings/Controller/EncryptionControllerTest.php deleted file mode 100644 index b15a71fc016..00000000000 --- a/tests/Settings/Controller/EncryptionControllerTest.php +++ /dev/null @@ -1,164 +0,0 @@ -<?php -/** - * @author Lukas Reschke <lukas@owncloud.com> - * - * @copyright Copyright (c) 2015, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace Tests\Settings\Controller; - -use OC\DB\Connection; -use OC\Files\View; -use OC\Settings\Controller\EncryptionController; -use OCP\App\IAppManager; -use OCA\Encryption\Migration; -use OCP\IConfig; -use OCP\IL10N; -use OCP\ILogger; -use OCP\IRequest; -use OCP\IUserManager; -use OCP\UserInterface; -use Test\TestCase; - -/** - * Class EncryptionControllerTest - * - * @package Tests\Settings\Controller - */ -class EncryptionControllerTest extends TestCase { - /** @var IRequest */ - private $request; - /** @var IL10N */ - private $l10n; - /** @var IConfig */ - private $config; - /** @var Connection */ - private $connection; - /** @var IUserManager */ - private $userManager; - /** @var View */ - private $view; - /** @var ILogger */ - private $logger; - /** @var IAppManager */ - private $appManager; - /** @var EncryptionController */ - private $encryptionController; - - public function setUp() { - parent::setUp(); - $this->request = $this->getMockBuilder(IRequest::class) - ->disableOriginalConstructor()->getMock(); - $this->l10n = $this->getMockBuilder(IL10N::class) - ->disableOriginalConstructor()->getMock(); - $this->l10n->expects($this->any()) - ->method('t') - ->will($this->returnCallback(function($message, array $replace) { - return vsprintf($message, $replace); - })); - $this->config = $this->getMockBuilder(IConfig::class) - ->disableOriginalConstructor()->getMock(); - $this->connection = $this->getMockBuilder(Connection::class) - ->disableOriginalConstructor()->getMock(); - $this->userManager = $this->getMockBuilder(IUserManager::class) - ->disableOriginalConstructor()->getMock(); - $this->view = $this->getMockBuilder(View::class) - ->disableOriginalConstructor()->getMock(); - $this->logger = $this->getMockBuilder(ILogger::class) - ->disableOriginalConstructor()->getMock(); - $this->appManager = $this->getMockBuilder('\\OCP\\App\\IAppManager') - ->disableOriginalConstructor()->getMock(); - - $this->encryptionController = $this->getMockBuilder(EncryptionController::class) - ->setConstructorArgs([ - 'settings', - $this->request, - $this->l10n, - $this->config, - $this->connection, - $this->userManager, - $this->view, - $this->logger, - $this->appManager, - ]) - ->setMethods(['getMigration']) - ->getMock(); - } - - public function testStartMigrationSuccessful() { - // we need to be able to autoload the class we're mocking - \OC_App::registerAutoloading('encryption', \OC_App::getAppPath('encryption')); - - $migration = $this->getMockBuilder(Migration::class) - ->disableOriginalConstructor()->getMock(); - $this->encryptionController - ->expects($this->once()) - ->method('getMigration') - ->with($this->config, $this->view, $this->connection, $this->logger) - ->will($this->returnValue($migration)); - $migration - ->expects($this->once()) - ->method('reorganizeSystemFolderStructure'); - $migration - ->expects($this->once()) - ->method('updateDB'); - $backend = $this->getMockBuilder(UserInterface::class) - ->getMock(); - $this->userManager - ->expects($this->once()) - ->method('getBackends') - ->will($this->returnValue([$backend])); - $backend - ->expects($this->once()) - ->method('getUsers') - ->will($this->returnValue(['User 1', 'User 2'])); - $migration - ->expects($this->exactly(2)) - ->method('reorganizeFolderStructureForUser') - ->withConsecutive( - ['User 1'], - ['User 2'] - ); - $migration - ->expects($this->once()) - ->method('finalCleanUp'); - - $expected = [ - 'data' => [ - 'message' => 'Migration Completed', - ], - 'status' => 'success', - ]; - $this->assertSame($expected, $this->encryptionController->startMigration()); - } - - public function testStartMigrationException() { - $this->encryptionController - ->expects($this->once()) - ->method('getMigration') - ->with($this->config, $this->view, $this->connection, $this->logger) - ->will($this->throwException(new \Exception('My error message'))); - - $expected = [ - 'data' => [ - 'message' => 'A problem occurred, please check your log files (Error: My error message)', - ], - 'status' => 'error', - ]; - $this->assertSame($expected, $this->encryptionController->startMigration()); - } -} |