summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-09-19 12:20:22 +0200
committerVincent Petry <pvince81@owncloud.com>2014-09-19 12:20:22 +0200
commitf0186d99d23a0e185b38be16e84388ab31e12553 (patch)
tree50f360fbc3c92674b21a32fda9162b1c0ad362b3 /tests
parent33f7af9207f941a2068023764188d7b7f29fb0f0 (diff)
parenta71af58535338f72061d5dbe31289ad132d0fa3a (diff)
downloadnextcloud-server-f0186d99d23a0e185b38be16e84388ab31e12553.tar.gz
nextcloud-server-f0186d99d23a0e185b38be16e84388ab31e12553.zip
Merge pull request #11163 from owncloud/check-for-updates-between-major-versions
Prevent updates between multiple major versions
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/updater.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/lib/updater.php b/tests/lib/updater.php
new file mode 100644
index 00000000000..4488744fa1d
--- /dev/null
+++ b/tests/lib/updater.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Copyright (c) 2014 Lukas Reschke <lukas@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC;
+
+class UpdaterTest extends \PHPUnit_Framework_TestCase {
+
+ public function testVersionCompatbility() {
+ return array(
+ array('1.0.0.0', '2.2.0', true),
+ array('1.1.1.1', '2.0.0', true),
+ array('5.0.3', '4.0.3', false),
+ array('12.0.3', '13.4.5', true),
+ array('1', '2', true),
+ array('2', '2', true),
+ array('6.0.5', '6.0.6', true),
+ array('5.0.6', '7.0.4', false)
+ );
+ }
+
+ /**
+ * @dataProvider testVersionCompatbility
+ */
+ function testIsUpgradePossible($oldVersion, $newVersion, $result) {
+ $updater = new Updater();
+ $this->assertSame($result, $updater->isUpgradePossible($oldVersion, $newVersion));
+ }
+
+} \ No newline at end of file