Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-06-13 14:53:29 +0400
committerBjörn Schießle <schiessle@owncloud.com>2013-06-13 14:53:29 +0400
commitbc2862fcb947ac65c80b5d49ea8f2c2271eb8021 (patch)
tree30938e61873554edd056de942189ac3851e9d488 /apps/files_encryption/tests
parentfd5042cc460ec35112cc69928e441b5395142190 (diff)
parent54f3174665262a5d1b1e1135667342b17b5d05b0 (diff)
Merge branch 'master' into files_encryption_upgrade_fix
Diffstat (limited to 'apps/files_encryption/tests')
-rwxr-xr-xapps/files_encryption/tests/util.php29
1 files changed, 26 insertions, 3 deletions
diff --git a/apps/files_encryption/tests/util.php b/apps/files_encryption/tests/util.php
index b945fb4c0f3..cb10befc8e4 100755
--- a/apps/files_encryption/tests/util.php
+++ b/apps/files_encryption/tests/util.php
@@ -182,8 +182,7 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase {
$params['uid'] = \Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER;
$params['password'] = \Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER;
- $util = new Encryption\Util($this->view, \Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER);
- $util->setMigrationStatus(0);
+ $this->setMigrationStatus(0, \Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER);
$this->assertTrue(OCA\Encryption\Hooks::login($params));
@@ -285,7 +284,7 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase {
$params['password'] = \Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER;
$util = new Encryption\Util($this->view, \Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER);
- $util->setMigrationStatus(0);
+ $this->setMigrationStatus(0, \Test_Encryption_Util::TEST_ENCRYPTION_UTIL_LEGACY_USER);
$this->assertTrue(OCA\Encryption\Hooks::login($params));
@@ -330,4 +329,28 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase {
$params['password'] = $password;
OCA\Encryption\Hooks::login($params);
}
+
+ /**
+ * helper function to set migration status to the right value
+ * to be able to test the migration path
+ *
+ * @param $status needed migration status for test
+ * @param $user for which user the status should be set
+ * @return boolean
+ */
+ private function setMigrationStatus($status, $user) {
+ $sql = 'UPDATE `*PREFIX*encryption` SET `migration_status` = ? WHERE `uid` = ?';
+ $args = array(
+ $status,
+ $user
+ );
+
+ $query = \OCP\DB::prepare($sql);
+ if ($query->execute($args)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
}