diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2015-07-17 12:49:45 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2015-07-17 15:19:10 +0200 |
commit | 3000f0125fe9470012c362a13ecc33a31cceff18 (patch) | |
tree | 0425400f4844391c8457984443198dd7574cf4ab /apps/encryption/tests | |
parent | 87234103195c64ab1791a7865c9a9f1c0486c418 (diff) | |
download | nextcloud-server-3000f0125fe9470012c362a13ecc33a31cceff18.tar.gz nextcloud-server-3000f0125fe9470012c362a13ecc33a31cceff18.zip |
don't move keys if the key where already moved in a previous migration run
Diffstat (limited to 'apps/encryption/tests')
-rw-r--r-- | apps/encryption/tests/lib/MigrationTest.php | 13 |
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 |