summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2017-02-09 13:29:08 +0100
committerGitHub <noreply@github.com>2017-02-09 13:29:08 +0100
commit4a5a3681d921adad8c4cb5bb29180514446ea2b9 (patch)
tree76c3b4069d8e866fd680273180b145a94b40b269 /tests/lib
parented4633a5523b14271e1bef9f484bfc0ab4dccde4 (diff)
parent18d7701d09b90ff58e69aa63454fe830c31ef2e7 (diff)
downloadnextcloud-server-4a5a3681d921adad8c4cb5bb29180514446ea2b9.tar.gz
nextcloud-server-4a5a3681d921adad8c4cb5bb29180514446ea2b9.zip
Merge pull request #3184 from nextcloud/issue-3165
Prevent migration from ownCloud 11 to Nextcloud 12
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/UpdaterTest.php107
1 files changed, 23 insertions, 84 deletions
diff --git a/tests/lib/UpdaterTest.php b/tests/lib/UpdaterTest.php
index 80c7c28cd68..afa0635768d 100644
--- a/tests/lib/UpdaterTest.php
+++ b/tests/lib/UpdaterTest.php
@@ -57,92 +57,31 @@ class UpdaterTest extends TestCase {
}
/**
- * @param string $baseUrl
- * @return string
- */
- private function buildUpdateUrl($baseUrl) {
- return $baseUrl . '?version='.implode('x', \OCP\Util::getVersion()).'xinstalledatxlastupdatedatx'.\OC_Util::getChannel().'xx';
- }
-
- /**
* @return array
*/
public function versionCompatibilityTestData() {
return [
- ['1', '2', '1', true],
- ['2', '2', '2', true],
- ['6.0.5.0', '6.0.6.0', '5.0', true],
- ['5.0.6.0', '7.0.4.0', '6.0', false],
- // allow upgrading within the same major release
- ['8.0.0.0', '8.0.0.0', '8.0', true],
- ['8.0.0.0', '8.0.0.4', '8.0', true],
- ['8.0.0.0', '8.0.1.0', '8.0', true],
- ['8.0.0.0', '8.0.2.0', '8.0', true],
- // does not allow downgrading within the same major release
- ['8.0.1.0', '8.0.0.0', '8.0', false],
- ['8.0.2.0', '8.0.1.0', '8.0', false],
- ['8.0.0.4', '8.0.0.0', '8.0', false],
- // allows upgrading within the patch version
- ['8.0.0.0', '8.0.0.1', '8.0', true],
- ['8.0.0.0', '8.0.0.2', '8.0', true],
- // does not allow downgrading within the same major release
- ['8.0.0.1', '8.0.0.0', '8.0', false],
- ['8.0.0.2', '8.0.0.0', '8.0', false],
- // allow upgrading to the next major release
- ['8.0.0.0', '8.1.0.0', '8.0', true],
- ['8.0.0.0', '8.1.1.0', '8.0', true],
- ['8.0.0.0', '8.1.1.5', '8.0', true],
- ['8.0.0.2', '8.1.1.5', '8.0', true],
- ['8.1.0.0', '8.2.0.0', '8.1', true],
- ['8.1.0.2', '8.2.0.4', '8.1', true],
- ['8.1.0.5', '8.2.0.1', '8.1', true],
- ['8.1.0.0', '8.2.1.0', '8.1', true],
- ['8.1.0.2', '8.2.1.5', '8.1', true],
- ['8.1.0.5', '8.2.1.1', '8.1', true],
- // does not allow downgrading to the previous major release
- ['8.1.0.0', '8.0.0.0', '7.0', false],
- ['8.1.1.0', '8.0.0.0', '7.0', false],
- // does not allow skipping major releases
- ['8.0.0.0', '8.2.0.0', '8.1', false],
- ['8.0.0.0', '8.2.1.0', '8.1', false],
- ['8.0.0.0', '9.0.1.0', '8.2', false],
- ['8.0.0.0', '10.0.0.0', '9.3', false],
- // allows updating to the next major release
- ['8.2.0.0', '9.0.0.0', '8.2', true],
- ['8.2.0.0', '9.0.0.0', '8.2', true],
- ['8.2.0.0', '9.0.1.0', '8.2', true],
- ['8.2.0.0', '9.0.1.1', '8.2', true],
- ['8.2.0.2', '9.0.1.1', '8.2', true],
- ['8.2.2.0', '9.0.1.0', '8.2', true],
- ['8.2.2.2', '9.0.1.1', '8.2', true],
- ['9.0.0.0', '9.1.0.0', '9.0', true],
- ['9.0.0.0', '9.1.0.2', '9.0', true],
- ['9.0.0.2', '9.1.0.1', '9.0', true],
- ['9.1.0.0', '9.2.0.0', '9.1', true],
- ['9.2.0.0', '9.3.0.0', '9.2', true],
- ['9.3.0.0', '10.0.0.0', '9.3', true],
- // does not allow updating to the next major release (first number)
- ['9.0.0.0', '8.2.0.0', '8.1', false],
- // other cases
- ['8.0.0.0', '8.1.5.0', '8.0', true],
- ['8.2.0.0', '9.0.0.0', '8.2', true],
- ['8.2.0.0', '9.1.0.0', '9.0', false],
- ['9.0.0.0', '8.1.0.0', '8.0', false],
- ['9.0.0.0', '8.0.0.0', '7.0', false],
- ['9.1.0.0', '8.0.0.0', '7.0', false],
- ['8.2.0.0', '8.1.0.0', '8.0', false],
-
- // With debug enabled
- ['8.0.0.0', '8.2.0.0', '8.1', false, true],
- ['8.1.0.0', '8.2.0.0', '8.1', true, true],
- ['8.2.0.1', '8.2.0.1', '8.1', true, true],
- ['8.3.0.0', '8.2.0.0', '8.1', true, true],
+ // Upgrade with invalid version
+ ['9.1.1.13', '11.0.2.25', ['nextcloud' => ['11.0' => true]], false],
+ ['10.0.1.13', '11.0.2.25', ['nextcloud' => ['11.0' => true]], false],
+ // Upgrad with valid version
+ ['11.0.1.13', '11.0.2.25', ['nextcloud' => ['11.0' => true]], true],
+ // Downgrade with valid version
+ ['11.0.2.25', '11.0.1.13', ['nextcloud' => ['11.0' => true]], false],
+ ['11.0.2.25', '11.0.1.13', ['nextcloud' => ['11.0' => true]], true, true],
+ // Downgrade with invalid version
+ ['11.0.2.25', '10.0.1.13', ['nextcloud' => ['10.0' => true]], false],
+ ['11.0.2.25', '10.0.1.13', ['nextcloud' => ['10.0' => true]], false, true],
- // Downgrade of maintenance
- ['9.0.53.0', '9.0.4.0', '8.1', false, false, 'nextcloud'],
- // with vendor switch
- ['9.0.53.0', '9.0.4.0', '8.1', true, false, ''],
- ['9.0.53.0', '9.0.4.0', '8.1', true, false, 'owncloud'],
+ // Migration with unknown vendor
+ ['9.1.1.13', '11.0.2.25', ['nextcloud' => ['9.1' => true]], false, false, 'owncloud'],
+ ['9.1.1.13', '11.0.2.25', ['nextcloud' => ['9.1' => true]], false, true, 'owncloud'],
+ // Migration with unsupported vendor version
+ ['9.1.1.13', '11.0.2.25', ['owncloud' => ['10.0' => true]], false, false, 'owncloud'],
+ ['9.1.1.13', '11.0.2.25', ['owncloud' => ['10.0' => true]], false, true, 'owncloud'],
+ // Migration with valid vendor version
+ ['9.1.1.13', '11.0.2.25', ['owncloud' => ['9.1' => true]], true, false, 'owncloud'],
+ ['9.1.1.13', '11.0.2.25', ['owncloud' => ['9.1' => true]], true, true, 'owncloud'],
];
}
@@ -151,12 +90,12 @@ class UpdaterTest extends TestCase {
*
* @param string $oldVersion
* @param string $newVersion
- * @param string $allowedVersion
+ * @param array $allowedVersions
* @param bool $result
* @param bool $debug
* @param string $vendor
*/
- public function testIsUpgradePossible($oldVersion, $newVersion, $allowedVersion, $result, $debug = false, $vendor = 'nextcloud') {
+ public function testIsUpgradePossible($oldVersion, $newVersion, $allowedVersions, $result, $debug = false, $vendor = 'nextcloud') {
$this->config->expects($this->any())
->method('getSystemValue')
->with('debug', false)
@@ -166,7 +105,7 @@ class UpdaterTest extends TestCase {
->with('core', 'vendor', '')
->willReturn($vendor);
- $this->assertSame($result, $this->updater->isUpgradePossible($oldVersion, $newVersion, $allowedVersion));
+ $this->assertSame($result, $this->updater->isUpgradePossible($oldVersion, $newVersion, $allowedVersions));
}
public function testSetSkip3rdPartyAppsDisable() {