FANDOM


Script error

ResourceLoaderTestModules
Available from version 1.19.0 (r107919)
Removed in version  
Add new javascript testing modules. This is called after the addition of MediaWiki core test suites.

Define function:
public static function onResourceLoaderTestModules( array &$testModules, ResourceLoader &$resourceLoader ) { ... }

Attach hook:
$wgHooks['ResourceLoaderTestModules'][] = 'MyExtensionHooks::onResourceLoaderTestModules';
Called from: ResourceLoader.php

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



Details Edit

  • $testModules: array of javascript testing modules. 'qunit' is fed using tests/qunit/QUnitTestResources.php.
  • $resourceLoader object



Usage Edit

This hook is run from ResourceLoader::registerTestModules on wikis that have $wgEnableJavaScriptTest set to true.



Don't forget to add the module that is being tested to the dependencies!
 
$testModules['qunit']['myext.tests'] = array(
 
'scripts' => array( 'tests/myext.foo.test.js', 'tests/myext.bar.test.js' ),
 
'dependencies' => array( 'myext.foo', 'myext.bar' ),
 
      'localBasePath' => dirname( __FILE__ ),
 
      'remoteExtPath' => 'MyExtension',
 
);



The array syntax is equal to that of Manual:Hooks/ResourceLoaderRegisterModules and $wgResourceModules. So things like remoteExtPath work here too.



See revision 109127 for an example of adding test support to an extension.



See also Edit

 

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.