Remove messages.inc, rebuildLanguage.php, writeMessagesArray.inc
[mediawiki.git] / tests / phpunit / includes / resourceloader / ResourceLoaderModuleTest.php
blobb25e9b061abb80e353cd0176036caa41c9d53f72
1 <?php
3 class ResourceLoaderModuleTest extends ResourceLoaderTestCase {
5 /**
6 * @covers ResourceLoaderModule::getDefinitionSummary
7 * @covers ResourceLoaderFileModule::getDefinitionSummary
8 */
9 public function testDefinitionSummary() {
10 $context = self::getResourceLoaderContext();
12 $baseParams = array(
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 ) );
22 // Exactly the same
23 $module = new ResourceLoaderFileModule( $baseParams );
25 $this->assertEquals(
26 $jsonSummary,
27 json_encode( $module->getDefinitionSummary( $context ) ),
28 'Instance is insignificant'
31 // Re-order dependencies
32 $module = new ResourceLoaderFileModule( array(
33 'dependencies' => array( 'mediawiki', 'jquery' ),
34 ) + $baseParams );
36 $this->assertEquals(
37 $jsonSummary,
38 json_encode( $module->getDefinitionSummary( $context ) ),
39 'Order of dependencies is insignificant'
42 // Re-order messages
43 $module = new ResourceLoaderFileModule( array(
44 'messages' => array( 'world', 'hello' ),
45 ) + $baseParams );
47 $this->assertEquals(
48 $jsonSummary,
49 json_encode( $module->getDefinitionSummary( $context ) ),
50 'Order of messages is insignificant'
53 // Re-order scripts
54 $module = new ResourceLoaderFileModule( array(
55 'scripts' => array( 'bar.js', 'foo.js' ),
56 ) + $baseParams );
58 $this->assertNotEquals(
59 $jsonSummary,
60 json_encode( $module->getDefinitionSummary( $context ) ),
61 'Order of scripts is significant'
64 // Subclass
65 $module = new ResourceLoaderFileModuleTestModule( $baseParams );
67 $this->assertNotEquals(
68 $jsonSummary,
69 json_encode( $module->getDefinitionSummary( $context ) ),
70 'Class is significant'