8 use MediaWikiCoversValidator;
9 use PHPUnit4And6Compat;
14 public function testCheck( $coreVersion, $constraint, $expected ) {
16 $this->assertEquals( $expected, !(
bool)$checker->checkArray( [
18 'MediaWiki' => $constraint,
26 [
'1.25alpha',
'>= 1.26',
false ],
27 [
'1.25.0',
'>= 1.26',
false ],
28 [
'1.26alpha',
'>= 1.26',
true ],
29 [
'1.26alpha',
'>= 1.26.0',
true ],
30 [
'1.26alpha',
'>= 1.26.0-stable',
false ],
31 [
'1.26.0',
'>= 1.26.0-stable',
true ],
32 [
'1.26.1',
'>= 1.26.0-stable',
true ],
33 [
'1.27.1',
'>= 1.26.0-stable',
true ],
34 [
'1.26alpha',
'>= 1.26.1',
false ],
35 [
'1.26alpha',
'>= 1.26alpha',
true ],
36 [
'1.26alpha',
'>= 1.25',
true ],
37 [
'1.26.0-alpha.14',
'>= 1.26.0-alpha.15',
false ],
38 [
'1.26.0-alpha.14',
'>= 1.26.0-alpha.10',
true ],
39 [
'1.26.1',
'>= 1.26.2, <=1.26.0',
false ],
40 [
'1.26.1',
'^1.26.2',
false ],
42 [
'1.26mwf14',
'== 1.25alpha',
true ],
43 [
'totallyinvalid',
'== 1.0',
true ],
50 public function testType( $given, $expected ) {
52 $checker->setLoadedExtensionsAndSkins( [
56 'NoVersionGiven' => [],
58 $this->assertEquals( $expected, $checker->checkArray( [
59 'FakeExtension' => $given,
69 'FakeDependency' =>
'1.0.0',
76 'MediaWiki' =>
'1.0.0',
83 'NoVersionGiven' =>
'*',
91 'NoVersionGiven' =>
'1.0',
96 'incompatible' =>
'FakeExtension',
97 'type' =>
'incompatible-extensions',
98 'msg' =>
'NoVersionGiven does not expose its version, but FakeExtension requires: 1.0.',
110 'missing' =>
'Missing',
111 'type' =>
'missing-extensions',
112 'msg' =>
'FakeExtension requires Missing to be installed.',
119 'FakeDependency' =>
'2.0.0',
124 'incompatible' =>
'FakeExtension',
125 'type' =>
'incompatible-extensions',
127 'msg' =>
'FakeExtension is not compatible with the current installed version of FakeDependency (1.0.0), it requires: 2.0.0.',
139 'missing' =>
'FakeSkin',
140 'type' =>
'missing-skins',
141 'msg' =>
'FakeExtension requires FakeSkin to be installed.',
154 $checker->setLoadedExtensionsAndSkins( [
155 'FakeDependency' => [
156 'version' =>
'not really valid',
159 $this->assertEquals( [
161 'type' =>
'invalid-version',
162 'msg' =>
"FakeDependency does not have a valid version string.",
164 ], $checker->checkArray( [
167 'FakeDependency' =>
'1.24.3',
173 $checker->setLoadedExtensionsAndSkins( [
174 'FakeDependency' => [
175 'version' =>
'1.24.3',
179 $this->setExpectedException( UnexpectedValueException::class );
180 $checker->checkArray( [
182 'FakeDependency' =>
'not really valid',
192 $this->setExpectedException( UnexpectedValueException::class,
193 'Dependency type skin unknown in FakeExtension' );
194 $this->assertEquals( [
196 'type' =>
'invalid-version',
197 'msg' =>
'FakeDependency does not have a valid version string.',
199 ], $checker->checkArray( [
testInvalidDependency()
T197478.
testType( $given, $expected)
provideType
testCheck( $coreVersion, $constraint, $expected)
provideCheck
testInvalidConstraint()
Check, if a non-parsable version constraint does not throw an exception or returns any error message.
Provides functions to check a set of extensions with dependencies against a set of loaded extensions ...
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
processing should stop and the error should be shown to the user * false