resourceloader: Add unit test for ClientHtml::makeLoad sync=>true

Used by Special:JavaScriptTest, and we may need to use this
in OutputPage as well (for html5shiv).

Change-Id: If7d7c12056dc3aab78486050f0798d42b158d9a9
This commit is contained in:
Timo Tijhof 2017-10-03 18:18:49 +01:00
parent d4a17a10a5
commit 33868f0e46

View file

@ -275,6 +275,12 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase {
'only' => ResourceLoaderModule::TYPE_SCRIPTS,
'output' => '<script async="" src="/w/load.php?debug=false&amp;lang=nl&amp;modules=test.scripts.raw&amp;only=scripts&amp;skin=fallback"></script>',
],
[
'context' => [ 'sync' => true ],
'modules' => [ 'test.scripts.raw' ],
'only' => ResourceLoaderModule::TYPE_SCRIPTS,
'output' => '<script src="/w/load.php?debug=false&amp;lang=nl&amp;modules=test.scripts.raw&amp;only=scripts&amp;skin=fallback&amp;sync=1"></script>',
],
[
'context' => [],
'modules' => [ 'test.scripts.user' ],
@ -360,7 +366,7 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase {
public function testMakeLoad( array $extraQuery, array $modules, $type, $expected ) {
$context = self::makeContext( $extraQuery );
$context->getResourceLoader()->register( self::makeSampleModules() );
$actual = ResourceLoaderClientHtml::makeLoad( $context, $modules, $type );
$actual = ResourceLoaderClientHtml::makeLoad( $context, $modules, $type, $extraQuery );
$expected = self::expandVariables( $expected );
$this->assertEquals( $expected, (string)$actual );
}