]> source.dussan.org Git - nextcloud-server.git/commitdiff
Added test for needUpgrade for core
authorVincent Petry <pvince81@owncloud.com>
Tue, 2 Sep 2014 15:28:05 +0000 (17:28 +0200)
committerVincent Petry <pvince81@owncloud.com>
Thu, 4 Sep 2014 16:02:54 +0000 (18:02 +0200)
tests/lib/util.php

index 98257e4c6020f08a1a0d1c367d580ffbd278a494..a2efcca260353987d68bd8c008ee4018c8c29cd5 100644 (file)
@@ -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());
+       }
 }
 
 /**