12 'scripts' => [
'foo.js',
'bar.js' ],
13 'dependencies' => [
'jquery',
'mediawiki' ],
14 'messages' => [
'hello',
'world' ],
18 $version = json_encode( $module->getVersionHash(
$context ) );
24 json_encode( $module->getVersionHash(
$context ) ),
25 'Instance is insignificant'
30 'dependencies' => [
'mediawiki',
'jquery' ],
34 json_encode( $module->getVersionHash(
$context ) ),
35 'Order of dependencies is insignificant'
40 'messages' => [
'world',
'hello' ],
44 json_encode( $module->getVersionHash(
$context ) ),
45 'Order of messages is insignificant'
50 'scripts' => [
'bar.js',
'foo.js' ],
52 $this->assertNotEquals(
54 json_encode( $module->getVersionHash(
$context ) ),
55 'Order of scripts is significant'
60 $this->assertNotEquals(
62 json_encode( $module->getVersionHash(
$context ) ),
63 'Class is significant'
71 $this->
setMwGlobals(
'wgResourceLoaderValidateJS',
true );
76 'script' =>
"var a = 'this is';\n {\ninvalid"
80 '"JavaScript parse error: Parse error: Unexpected token; ' .
81 'token } expected in file \'input\' on line 3"' .
84 'Replace invalid syntax with error logging'
88 'script' =>
"\n'valid';"
93 'Leave valid scripts as-is'
102 $getRelativePaths =
new ReflectionMethod(
'ResourceLoaderModule',
'getRelativePaths' );
103 $getRelativePaths->setAccessible(
true );
104 $expandRelativePaths =
new ReflectionMethod(
'ResourceLoaderModule',
'expandRelativePaths' );
105 $expandRelativePaths->setAccessible(
true );
108 'IP' =>
'/srv/example/mediawiki/core',
111 '/srv/example/mediawiki/core/resources/foo.js',
112 '/srv/example/mediawiki/core/extensions/Example/modules/bar.js',
113 '/srv/example/mediawiki/skins/Example/baz.css',
114 '/srv/example/mediawiki/skins/Example/images/quux.png',
118 'extensions/Example/modules/bar.js',
119 '../skins/Example/baz.css',
120 '../skins/Example/images/quux.png',
124 $getRelativePaths->invoke(
null, $raw ),
125 'Insert placeholders'
129 $expandRelativePaths->invoke(
null, $canonical ),
130 'Substitute placeholders'