Manual:Hooks/ParserTestGlobals

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": "MediaWiki\\Extension\\MyExtension\\Hooks::onParserTestGlobals"
	}
}
Called from: File(s): ../tests/parser/ParserTestRunner.php
Interface: ParserTestGlobalsHook.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.