diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
commit | a2190ac74dd4d7080b12bab90e552d7aa81209ef (patch) | |
tree | 8b31f38de9882d18df54cf8d9e0de74167a094eb /tests/phpunit/includes/registration/CoreVersionCheckerTest.php | |
parent | 15e69f7b20b6596b9148030acce5b59993b95a45 (diff) | |
parent | 257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff) |
Merge branch 'mw-1.26'
Diffstat (limited to 'tests/phpunit/includes/registration/CoreVersionCheckerTest.php')
-rw-r--r-- | tests/phpunit/includes/registration/CoreVersionCheckerTest.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/phpunit/includes/registration/CoreVersionCheckerTest.php b/tests/phpunit/includes/registration/CoreVersionCheckerTest.php new file mode 100644 index 00000000..bc154b37 --- /dev/null +++ b/tests/phpunit/includes/registration/CoreVersionCheckerTest.php @@ -0,0 +1,38 @@ +<?php + +/** + * @covers CoreVersionChecker + */ +class CoreVersionCheckerTest extends PHPUnit_Framework_TestCase { + /** + * @dataProvider provideCheck + */ + public function testCheck( $coreVersion, $constraint, $expected ) { + $checker = new CoreVersionChecker( $coreVersion ); + $this->assertEquals( $expected, $checker->check( $constraint ) ); + } + + public static function provideCheck() { + return array( + // array( $wgVersion, constraint, expected ) + array( '1.25alpha', '>= 1.26', false ), + array( '1.25.0', '>= 1.26', false ), + array( '1.26alpha', '>= 1.26', true ), + array( '1.26alpha', '>= 1.26.0', true ), + array( '1.26alpha', '>= 1.26.0-stable', false ), + array( '1.26.0', '>= 1.26.0-stable', true ), + array( '1.26.1', '>= 1.26.0-stable', true ), + array( '1.27.1', '>= 1.26.0-stable', true ), + array( '1.26alpha', '>= 1.26.1', false ), + array( '1.26alpha', '>= 1.26alpha', true ), + array( '1.26alpha', '>= 1.25', true ), + array( '1.26.0-alpha.14', '>= 1.26.0-alpha.15', false ), + array( '1.26.0-alpha.14', '>= 1.26.0-alpha.10', true ), + array( '1.26.1', '>= 1.26.2, <=1.26.0', false ), + array( '1.26.1', '^1.26.2', false ), + // Accept anything for un-parsable version strings + array( '1.26mwf14', '== 1.25alpha', true ), + array( 'totallyinvalid', '== 1.0', true ), + ); + } +} |