3 class ResourceLoaderModuleTest
extends ResourceLoaderTestCase
{
6 * @covers ResourceLoaderModule::getDefinitionSummary
7 * @covers ResourceLoaderFileModule::getDefinitionSummary
9 public function testDefinitionSummary() {
10 $context = $this->getResourceLoaderContext();
13 'scripts' => array( 'foo.js', 'bar.js' ),
14 'dependencies' => array( 'jquery', 'mediawiki' ),
15 'messages' => array( 'hello', 'world' ),
18 $module = new ResourceLoaderFileModule( $baseParams );
20 $jsonSummary = json_encode( $module->getDefinitionSummary( $context ) );
23 $module = new ResourceLoaderFileModule( $baseParams );
27 json_encode( $module->getDefinitionSummary( $context ) ),
28 'Instance is insignificant'
31 // Re-order dependencies
32 $module = new ResourceLoaderFileModule( array(
33 'dependencies' => array( 'mediawiki', 'jquery' ),
38 json_encode( $module->getDefinitionSummary( $context ) ),
39 'Order of dependencies is insignificant'
43 $module = new ResourceLoaderFileModule( array(
44 'messages' => array( 'world', 'hello' ),
49 json_encode( $module->getDefinitionSummary( $context ) ),
50 'Order of messages is insignificant'
54 $module = new ResourceLoaderFileModule( array(
55 'scripts' => array( 'bar.js', 'foo.js' ),
58 $this->assertNotEquals(
60 json_encode( $module->getDefinitionSummary( $context ) ),
61 'Order of scripts is significant'
65 $module = new ResourceLoaderFileModuleTestModule( $baseParams );
67 $this->assertNotEquals(
69 json_encode( $module->getDefinitionSummary( $context ) ),
70 'Class is significant'