resourceloader: Add unit test for ClientHtml::makeLoad sync=>true
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 3 Oct 2017 17:18:49 +0000 (18:18 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Tue, 3 Oct 2017 17:22:43 +0000 (18:22 +0100)
Used by Special:JavaScriptTest, and we may need to use this
in OutputPage as well (for html5shiv).

Change-Id: If7d7c12056dc3aab78486050f0798d42b158d9a9

tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php

index eaae9dc..f75d67d 100644 (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 );
        }