summaryrefslogtreecommitdiffstats
path: root/tests/lib/updater.php
blob: 155dccf78a79f2ca4c81d6ce70726b1241ca1449 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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 \Test\TestCase {

	public function versionCompatibilityTestData() {
		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 versionCompatibilityTestData
	 */
	function testIsUpgradePossible($oldVersion, $newVersion, $result) {
		$updater = new Updater();
		$this->assertSame($result, $updater->isUpgradePossible($oldVersion, $newVersion));
	}

}