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',
107 [
'phpLoadedExtension' ],
109 'presentAbility' =>
true,
110 'presentAbilityWithMessage' =>
true,
111 'missingAbility' =>
false,
112 'missingAbilityWithMessage' =>
false,
115 'presentAbilityWithMessage' =>
'Present.',
116 'missingAbilityWithMessage' =>
'Missing.',
119 $checker->setLoadedExtensionsAndSkins( [
120 'FakeDependency' => [
121 'version' =>
'1.0.0',
123 'NoVersionGiven' => [],
126 'FakeExtension' => $given,
136 'FakeDependency' =>
'1.0.0',
143 'MediaWiki' =>
'1.0.0',
150 'NoVersionGiven' =>
'*',
158 'NoVersionGiven' =>
'1.0',
163 'incompatible' =>
'FakeExtension',
164 'type' =>
'incompatible-extensions',
165 'msg' =>
'NoVersionGiven does not expose its version, but FakeExtension requires: 1.0.',
177 'missing' =>
'Missing',
178 'type' =>
'missing-extensions',
179 'msg' =>
'FakeExtension requires Missing to be installed.',
186 'FakeDependency' =>
'2.0.0',
191 'incompatible' =>
'FakeExtension',
192 'type' =>
'incompatible-extensions',
194 'msg' =>
'FakeExtension is not compatible with the current installed version of FakeDependency (1.0.0), it requires: 2.0.0.',
206 'missing' =>
'FakeSkin',
207 'type' =>
'missing-skins',
208 'msg' =>
'FakeExtension requires FakeSkin to be installed.',
215 'ext-phpLoadedExtension' =>
'*',
223 'ext-phpMissingExtension' =>
'*',
228 'missing' =>
'phpMissingExtension',
229 'type' =>
'missing-phpExtension',
231 'msg' =>
'FakeExtension requires phpMissingExtension PHP extension to be installed.',
238 'ability-presentAbility' =>
true,
246 'ability-presentAbilityWithMessage' =>
true,
254 'ability-presentAbility' =>
false,
262 'ability-presentAbilityWithMessage' =>
false,
270 'ability-missingAbility' =>
true,
275 'missing' =>
'missingAbility',
276 'type' =>
'missing-ability',
277 'msg' =>
'FakeExtension requires "missingAbility" ability',
284 'ability-missingAbilityWithMessage' =>
true,
289 'missing' =>
'missingAbilityWithMessage',
290 'type' =>
'missing-ability',
292 'msg' =>
'FakeExtension requires "missingAbilityWithMessage" ability: Missing.',
299 'ability-missingAbility' =>
false,
307 'ability-missingAbilityWithMessage' =>
false,
321 $checker->setLoadedExtensionsAndSkins( [
322 'FakeDependency' => [
323 'version' =>
'not really valid',
328 'type' =>
'invalid-version',
329 'msg' =>
"FakeDependency does not have a valid version string.",
331 ], $checker->checkArray( [
334 'FakeDependency' =>
'1.24.3',
340 $checker->setLoadedExtensionsAndSkins( [
341 'FakeDependency' => [
342 'version' =>
'1.24.3',
347 $checker->checkArray( [
349 'FakeDependency' =>
'not really valid',
360 'undefinedPlatformDependency' =>
'*',
364 'undefinedPlatformDependency',
370 'phpLoadedExtension' =>
'*',
374 'phpLoadedExtension',
380 'ability-invalidAbility' =>
true,
384 'ability-invalidAbility',
390 'presentAbility' =>
true,
399 'undefinedDependencyType' =>
'*',
402 'undefinedDependencyType',
425 [
'phpLoadedExtension' ],
427 'presentAbility' =>
true,
428 'missingAbility' =>
false,
432 UnexpectedValueException::class,
433 "Dependency type $type unknown in FakeExtension"
435 $checker->checkArray( $depencency );
439 $checker =
new VersionChecker(
'1.0.0',
'7.0.0', [
'phpLoadedExtension' ] );
441 UnexpectedValueException::class,
442 'Version constraints for PHP extensions are not supported in FakeExtension'
444 $checker->checkArray( [
447 'ext-phpLoadedExtension' =>
'1.0.0',
457 $checker =
new VersionChecker(
'1.0.0',
'7.0.0', [], [
'presentAbility' =>
true ] );
459 UnexpectedValueException::class,
460 'Only booleans are allowed to to indicate the presence of abilities in FakeExtension'
462 $checker->checkArray( [
465 'ability-presentAbility' =>
$value,
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
testMediaWikiCheck( $coreVersion, $constraint, $expected)
provideMediaWikiCheck
provideInvalidAbilityType()
static providePhpInvalidVersion()
static providePhpValidCheck()
testPhpInvalidVersion( $phpVersion)
providePhpInvalidVersion UnexpectedValueException
testType( $given, $expected)
provideType
provideInvalidDependency()
testInvalidDependency( $depencency, $type)
provideInvalidDependency
testInvalidAbilityType( $value)
provideInvalidAbilityType
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 ...
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
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