3 class ResourceLoaderModuleTest
extends ResourceLoaderTestCase
{
5 protected function setUp() {
8 // The return value of the closure shouldn't matter since this test should
10 SkinFactory
::getDefaultInstance()->register( 'vector', 'Vector', function(){});
14 * @covers ResourceLoaderFileModule::getAllSkinStyleFiles
16 public function testGetAllSkinStyleFiles() {
17 $context = self
::getResourceLoaderContext();
26 'bar.css' => array( 'media' => 'print' ),
27 'screen.less' => array( 'media' => 'screen' ),
28 'screen-query.css' => array( 'media' => 'screen and (min-width: 400px)' ),
30 'skinStyles' => array(
31 'default' => 'quux-fallback.less',
43 $module = new ResourceLoaderFileModule( $baseParams );
55 array_map( 'basename', $module->getAllStyleFiles() )
60 * @covers ResourceLoaderModule::getDefinitionSummary
61 * @covers ResourceLoaderFileModule::getDefinitionSummary
63 public function testDefinitionSummary() {
64 $context = self
::getResourceLoaderContext();
67 'scripts' => array( 'foo.js', 'bar.js' ),
68 'dependencies' => array( 'jquery', 'mediawiki' ),
69 'messages' => array( 'hello', 'world' ),
72 $module = new ResourceLoaderFileModule( $baseParams );
74 $jsonSummary = json_encode( $module->getDefinitionSummary( $context ) );
77 $module = new ResourceLoaderFileModule( $baseParams );
81 json_encode( $module->getDefinitionSummary( $context ) ),
82 'Instance is insignificant'
85 // Re-order dependencies
86 $module = new ResourceLoaderFileModule( array(
87 'dependencies' => array( 'mediawiki', 'jquery' ),
92 json_encode( $module->getDefinitionSummary( $context ) ),
93 'Order of dependencies is insignificant'
97 $module = new ResourceLoaderFileModule( array(
98 'messages' => array( 'world', 'hello' ),
103 json_encode( $module->getDefinitionSummary( $context ) ),
104 'Order of messages is insignificant'
108 $module = new ResourceLoaderFileModule( array(
109 'scripts' => array( 'bar.js', 'foo.js' ),
112 $this->assertNotEquals(
114 json_encode( $module->getDefinitionSummary( $context ) ),
115 'Order of scripts is significant'
119 $module = new ResourceLoaderFileModuleTestModule( $baseParams );
121 $this->assertNotEquals(
123 json_encode( $module->getDefinitionSummary( $context ) ),
124 'Class is significant'