Manual:Hooks/ParserTestGlobals

From MediaWiki.org
Jump to navigation Jump to search
ParserTestGlobals
Available from version 1.20.0
Allows to define globals for parser tests.
Define function:
public static function onParserTestGlobals( array &$globals ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"ParserTestGlobals": "MyExtensionHooks::onParserTestGlobals"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ParserTestGlobals'][] = 'MyExtensionHooks::onParserTestGlobals';
Called from:File(s): ../tests/parser/ParserTestRunner.php

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:ParserTestGlobals extensions.

Details[edit]

  • &$globals: Array with all the globals which should be set for parser tests. The arrays keys serve as the globals names, its values are the globals values.