aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-09-02 17:28:05 +0200
committerVincent Petry <pvince81@owncloud.com>2014-09-02 17:28:05 +0200
commit9d5f18c02f102024ea273476e760a3029b9c88b1 (patch)
treed201fd9131c3902a00031bc2e00d0197fc4aa2a8 /tests
parente05b95636b975dd119b19c14b48f291341464a19 (diff)
downloadnextcloud-server-9d5f18c02f102024ea273476e760a3029b9c88b1.tar.gz
nextcloud-server-9d5f18c02f102024ea273476e760a3029b9c88b1.zip
Added test for needUpgrade for core
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/util.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/lib/util.php b/tests/lib/util.php
index 98257e4c602..a2efcca2603 100644
--- a/tests/lib/util.php
+++ b/tests/lib/util.php
@@ -344,6 +344,25 @@ class Test_Util extends PHPUnit_Framework_TestCase {
);
}
+ /**
+ * Test needUpgrade() when the core version is increased
+ */
+ public function testNeedUpgradeCore() {
+ $oldConfigVersion = OC_Config::getValue('version', '0.0.0');
+ $oldSessionVersion = \OC::$server->getSession()->get('OC_Version');
+
+ $this->assertFalse(\OCP\Util::needUpgrade());
+
+ OC_Config::setValue('version', '7.0.0.0');
+ \OC::$server->getSession()->set('OC_Version', array(7, 0, 0, 1));
+
+ $this->assertTrue(\OCP\Util::needUpgrade());
+
+ OC_Config::setValue('version', $oldConfigVersion);
+ $oldSessionVersion = \OC::$server->getSession()->set('OC_Version', $oldSessionVersion);
+
+ $this->assertFalse(\OCP\Util::needUpgrade());
+ }
}
/**