8 use MediaWikiCoversValidator;
9 use PHPUnit4And6Compat;
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 ],
52 $this->assertEquals( $expected, !(
bool)$checker->checkArray( [
64 [
'7.0.23',
'>= 7.0.0',
true ],
65 [
'7.0.23',
'^7.1.0',
false ],
66 [
'7.0.23',
'7.0.23',
true ],
75 $checker->checkArray( [
78 'php' =>
'totallyinvalid',
104 $checker =
new VersionChecker(
'1.0.0',
'7.0.0', [
'phpLoadedExtension' ] );
105 $checker->setLoadedExtensionsAndSkins( [
106 'FakeDependency' => [
107 'version' =>
'1.0.0',
109 'NoVersionGiven' => [],
111 $this->assertEquals( $expected, $checker->checkArray( [
112 'FakeExtension' => $given,
122 'FakeDependency' =>
'1.0.0',
129 'MediaWiki' =>
'1.0.0',
136 'NoVersionGiven' =>
'*',
144 'NoVersionGiven' =>
'1.0',
149 'incompatible' =>
'FakeExtension',
150 'type' =>
'incompatible-extensions',
151 'msg' =>
'NoVersionGiven does not expose its version, but FakeExtension requires: 1.0.',
163 'missing' =>
'Missing',
164 'type' =>
'missing-extensions',
165 'msg' =>
'FakeExtension requires Missing to be installed.',
172 'FakeDependency' =>
'2.0.0',
177 'incompatible' =>
'FakeExtension',
178 'type' =>
'incompatible-extensions',
180 'msg' =>
'FakeExtension is not compatible with the current installed version of FakeDependency (1.0.0), it requires: 2.0.0.',
192 'missing' =>
'FakeSkin',
193 'type' =>
'missing-skins',
194 'msg' =>
'FakeExtension requires FakeSkin to be installed.',
201 'ext-phpLoadedExtension' =>
'*',
209 'ext-phpMissingExtension' =>
'*',
214 'missing' =>
'phpMissingExtension',
215 'type' =>
'missing-phpExtension',
217 'msg' =>
'FakeExtension requires phpMissingExtension PHP extension to be installed.',
230 $checker->setLoadedExtensionsAndSkins( [
231 'FakeDependency' => [
232 'version' =>
'not really valid',
235 $this->assertEquals( [
237 'type' =>
'invalid-version',
238 'msg' =>
"FakeDependency does not have a valid version string.",
240 ], $checker->checkArray( [
243 'FakeDependency' =>
'1.24.3',
249 $checker->setLoadedExtensionsAndSkins( [
250 'FakeDependency' => [
251 'version' =>
'1.24.3',
255 $this->setExpectedException( UnexpectedValueException::class );
256 $checker->checkArray( [
258 'FakeDependency' =>
'not really valid',
269 'undefinedPlatformDependency' =>
'*',
273 'undefinedPlatformDependency',
279 'phpLoadedExtension' =>
'*',
283 'phpLoadedExtension',
288 'undefinedDependencyType' =>
'*',
291 'undefinedDependencyType',
311 $checker =
new VersionChecker(
'1.0.0',
'7.0.0', [
'phpLoadedExtension' ] );
312 $this->setExpectedException(
313 UnexpectedValueException::class,
314 "Dependency type $type unknown in FakeExtension"
316 $checker->checkArray( $depencency );
320 $checker =
new VersionChecker(
'1.0.0',
'7.0.0', [
'phpLoadedExtension' ] );
321 $this->setExpectedException(
322 UnexpectedValueException::class,
323 'Version constraints for PHP extensions are not supported in FakeExtension'
325 $checker->checkArray( [
328 'ext-phpLoadedExtension' =>
'1.0.0',
testMediaWikiCheck( $coreVersion, $constraint, $expected)
provideMediaWikiCheck
static providePhpInvalidVersion()
static providePhpValidCheck()
testPhpInvalidVersion( $phpVersion)
providePhpInvalidVersion UnexpectedValueException
testType( $given, $expected)
provideType
provideInvalidDependency()
testInvalidDependency( $depencency, $type)
provideInvalidDependency
testInvalidConstraint()
Check, if a non-parsable version constraint does not throw an exception or returns any error message.
static provideMediaWikiCheck()
testPhpInvalidConstraint()
UnexpectedValueException.
testPhpValidCheck( $phpVersion, $constraint, $expected)
providePhpValidCheck
testInvalidPhpExtensionConstraint()
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