< Manual:Hooks
![]() | This deprecated feature should no longer be used, but is still available for reasons of backwards compatibility. This feature was deprecated in version 1.33.0. This hook was deprecated in Gerrit change 485247.Please see QUnitTestModule for an alternative way to use this feature. |
ResourceLoaderTestModules | |
---|---|
Available from version 1.19.0 (r107919, codereview) Add new javascript test suites. This is called after the addition of MediaWiki core test suites. | |
Define function: | public static function onResourceLoaderTestModules( array &$modules, ResourceLoader $resourceLoader ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"ResourceLoaderTestModules": "MyExtensionHooks::onResourceLoaderTestModules"
}
}
|
Called from: | File(s): resourceloader/ResourceLoader.php Function(s): registerTestModules |
Interface: | ResourceLoaderTestModulesHook.php |
For more information about attaching hooks, see Manual:Hooks
For examples of extensions using this hook, see Category:ResourceLoaderTestModules extensions.
Details
&$modules
: array of javascript testing modules, keyed by framework (e.g.'qunit'
).$resourceLoader
: ResourceLoader object
Usage
This hook is run on wikis that have $wgEnableJavaScriptTest
set to true
.
Don't forget to add the module that is being tested to the dependencies!
$modules['qunit']['ext.example.test'] = [
'scripts' => [
'tests/ext.example.foo.test.js',
'tests/ext.example.bar.test.js',
],
'dependencies' => [
'ext.example.foo',
'ext.example.bar',
],
'localBasePath' => __DIR__,
'remoteExtPath' => 'Example',
];
The array syntax is equal to that of ResourceLoaderRegisterModules$wgResourceModules
. This means idioms such as remoteExtPath
and remoteSkinPath
work here too.
See revision 109127 for an example of adding test support to an extension.
See also
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.