summaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests/lib/MigrationTest.php
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2015-07-17 12:49:45 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2015-07-17 15:30:43 +0200
commit00a044f8857ce86a43cbffa599fcf877c71a739e (patch)
tree19eb12d1ad2f6bc419e54733f489cd129a95d4be /apps/encryption/tests/lib/MigrationTest.php
parent1b8eb668de489d23912983c7250d4abe44ad7fb5 (diff)
downloadnextcloud-server-00a044f8857ce86a43cbffa599fcf877c71a739e.tar.gz
nextcloud-server-00a044f8857ce86a43cbffa599fcf877c71a739e.zip
don't move keys if the key where already moved in a previous migration run
Diffstat (limited to 'apps/encryption/tests/lib/MigrationTest.php')
-rw-r--r--apps/encryption/tests/lib/MigrationTest.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/encryption/tests/lib/MigrationTest.php b/apps/encryption/tests/lib/MigrationTest.php
index de1e2bd268b..786bce33a2c 100644
--- a/apps/encryption/tests/lib/MigrationTest.php
+++ b/apps/encryption/tests/lib/MigrationTest.php
@@ -24,6 +24,7 @@
namespace OCA\Encryption\Tests;
use OCA\Encryption\Migration;
+use OCP\ILogger;
class MigrationTest extends \Test\TestCase {
@@ -37,6 +38,9 @@ class MigrationTest extends \Test\TestCase {
private $recovery_key_id = 'recovery_key_id';
private $moduleId;
+ /** @var PHPUnit_Framework_MockObject_MockObject | ILogger */
+ private $logger;
+
public static function setUpBeforeClass() {
parent::setUpBeforeClass();
\OC_User::createUser(self::TEST_ENCRYPTION_MIGRATION_USER1, 'foo');
@@ -53,6 +57,7 @@ class MigrationTest extends \Test\TestCase {
public function setUp() {
+ $this->logger = $this->getMockBuilder('\OCP\ILogger')->disableOriginalConstructor()->getMock();
$this->view = new \OC\Files\View();
$this->moduleId = \OCA\Encryption\Crypto\Encryption::ID;
}
@@ -142,7 +147,7 @@ class MigrationTest extends \Test\TestCase {
$this->createDummySystemWideKeys();
- $m = new Migration(\OC::$server->getConfig(), new \OC\Files\View(), \OC::$server->getDatabaseConnection());
+ $m = new Migration(\OC::$server->getConfig(), new \OC\Files\View(), \OC::$server->getDatabaseConnection(), $this->logger);
$m->reorganizeFolderStructure();
$this->assertTrue(
@@ -267,7 +272,7 @@ class MigrationTest extends \Test\TestCase {
public function testUpdateDB() {
$this->prepareDB();
- $m = new Migration(\OC::$server->getConfig(), new \OC\Files\View(), \OC::$server->getDatabaseConnection());
+ $m = new Migration(\OC::$server->getConfig(), new \OC\Files\View(), \OC::$server->getDatabaseConnection(), $this->logger);
$m->updateDB();
$this->verifyDB('`*PREFIX*appconfig`', 'files_encryption', 0);
@@ -286,7 +291,7 @@ class MigrationTest extends \Test\TestCase {
$config->setAppValue('encryption', 'publicShareKeyId', 'wrong_share_id');
$config->setUserValue(self::TEST_ENCRYPTION_MIGRATION_USER1, 'encryption', 'recoverKeyEnabled', '9');
- $m = new Migration(\OC::$server->getConfig(), new \OC\Files\View(), \OC::$server->getDatabaseConnection());
+ $m = new Migration(\OC::$server->getConfig(), new \OC\Files\View(), \OC::$server->getDatabaseConnection(), $this->logger);
$m->updateDB();
$this->verifyDB('`*PREFIX*appconfig`', 'files_encryption', 0);
@@ -349,7 +354,7 @@ class MigrationTest extends \Test\TestCase {
*/
public function testUpdateFileCache() {
$this->prepareFileCache();
- $m = new Migration(\OC::$server->getConfig(), new \OC\Files\View(), \OC::$server->getDatabaseConnection());
+ $m = new Migration(\OC::$server->getConfig(), new \OC\Files\View(), \OC::$server->getDatabaseConnection(), $this->logger);
self::invokePrivate($m, 'updateFileCache');
// check results