Merge "Use READ_LATEST for the WikiPage in RefreshLinksJob"
[lhc/web/wiklou.git] / tests / phpunit / includes / registration / CoreVersionCheckerTest.php
1 <?php
2
3 /**
4 * @covers CoreVersionChecker
5 */
6 class CoreVersionCheckerTest extends PHPUnit_Framework_TestCase {
7 /**
8 * @dataProvider provideCheck
9 */
10 public function testCheck( $coreVersion, $constraint, $expected ) {
11 $checker = new CoreVersionChecker( $coreVersion );
12 $this->assertEquals( $expected, $checker->check( $constraint ) );
13 }
14
15 public static function provideCheck() {
16 return [
17 // [ $wgVersion, constraint, expected ]
18 [ '1.25alpha', '>= 1.26', false ],
19 [ '1.25.0', '>= 1.26', false ],
20 [ '1.26alpha', '>= 1.26', true ],
21 [ '1.26alpha', '>= 1.26.0', true ],
22 [ '1.26alpha', '>= 1.26.0-stable', false ],
23 [ '1.26.0', '>= 1.26.0-stable', true ],
24 [ '1.26.1', '>= 1.26.0-stable', true ],
25 [ '1.27.1', '>= 1.26.0-stable', true ],
26 [ '1.26alpha', '>= 1.26.1', false ],
27 [ '1.26alpha', '>= 1.26alpha', true ],
28 [ '1.26alpha', '>= 1.25', true ],
29 [ '1.26.0-alpha.14', '>= 1.26.0-alpha.15', false ],
30 [ '1.26.0-alpha.14', '>= 1.26.0-alpha.10', true ],
31 [ '1.26.1', '>= 1.26.2, <=1.26.0', false ],
32 [ '1.26.1', '^1.26.2', false ],
33 // Accept anything for un-parsable version strings
34 [ '1.26mwf14', '== 1.25alpha', true ],
35 [ 'totallyinvalid', '== 1.0', true ],
36 ];
37 }
38 }