diff options
author | Björn Schießle <schiessle@owncloud.com> | 2013-06-13 12:53:29 +0200 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2013-06-13 12:53:29 +0200 |
commit | bc2862fcb947ac65c80b5d49ea8f2c2271eb8021 (patch) | |
tree | 30938e61873554edd056de942189ac3851e9d488 /apps/files_encryption/tests | |
parent | fd5042cc460ec35112cc69928e441b5395142190 (diff) | |
parent | 54f3174665262a5d1b1e1135667342b17b5d05b0 (diff) | |
download | nextcloud-server-bc2862fcb947ac65c80b5d49ea8f2c2271eb8021.tar.gz nextcloud-server-bc2862fcb947ac65c80b5d49ea8f2c2271eb8021.zip |
Merge branch 'master' into files_encryption_upgrade_fix
Diffstat (limited to 'apps/files_encryption/tests')
-rwxr-xr-x | apps/files_encryption/tests/util.php | 29 |
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; + } + } + } |