aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
diff options
context:
space:
mode:
authorTimo Tijhof <krinkle@fastmail.com>2021-10-09 01:23:32 +0100
committerTimo Tijhof <krinkle@fastmail.com>2021-11-08 19:23:26 +0000
commit63658abe08afd6200ba6c3121cd0098d9d9ffe1c (patch)
tree72c63951007a255ec9874c58283244d20445a6e1 /tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
parentbed3a59dadf467829d2b7723364f16f5cafd9f1a (diff)
downloadmediawikicore-63658abe08afd6200ba6c3121cd0098d9d9ffe1c.tar.gz
mediawikicore-63658abe08afd6200ba6c3121cd0098d9d9ffe1c.zip
resourceloader: Remove internal debug check in makeLoaderImplementScript()
This private method checked for debug mode, and generated the wrapping code in either spacious form or condensed form. The important thing to note is that $scripts being wrapped here are always in original form, and thus the returned string still needs to be minified before we transfer it to the client. The only caller is makeModuleResponse(), which passes the result to filter() for minification as-needed. Hence we don't need the extra complication here of manually minifying it for production, we can let the minifier take care of that instead. Bug: T32956 Change-Id: I80559c0c257bf5c08c015373d845a6c992dc9e0b
Diffstat (limited to 'tests/phpunit/includes/resourceloader/ResourceLoaderTest.php')
-rw-r--r--tests/phpunit/includes/resourceloader/ResourceLoaderTest.php35
1 files changed, 1 insertions, 34 deletions
diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
index 4ff6b1988055..b2d24b265341 100644
--- a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
+++ b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
@@ -541,38 +541,6 @@ mw.example( 5 );
} );
END
] ],
- [ [
- 'title' => 'Implement multi-file script, non-debug mode',
-
- 'name' => 'test.multifile',
- 'debug' => 'false',
- 'scripts' => [
- 'files' => [
- 'one.js' => [
- 'type' => 'script',
- 'content' => 'mw.example( 1 );',
- ],
- 'two.json' => [
- 'type' => 'data',
- 'content' => [ 'n' => 2 ],
- ],
- 'three.js' => [
- 'type' => 'script',
- 'content' => 'mw.example( 3 );//'
- ],
- ],
- 'main' => 'three.js',
- ],
-
- 'expected' => implode( '', [
- 'mw.loader.implement("test.multifile",',
- '{"main":"three.js","files":{',
- '"one.js":function(require,module){mw.example( 1 );' . "\n" . '},',
- '"two.json":{"n":2},',
- '"three.js":function(require,module){mw.example( 3 );//' . "\n" . '}',
- '}});',
- ] ),
- ] ],
];
}
@@ -588,11 +556,10 @@ END
'templates' => [],
'messages' => new XmlJsCode( '{}' ),
'packageFiles' => [],
- 'debug' => 'true',
];
$rl = TestingAccessWrapper::newFromClass( ResourceLoader::class );
$context = new ResourceLoaderContext( new EmptyResourceLoader(), new FauxRequest( [
- 'debug' => $case['debug'],
+ 'debug' => 'true',
] ) );
$this->assertEquals(
$case['expected'],