Merge "resourceloader: Consistent stylesheet order for debug and non-debug"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 18 Feb 2017 01:03:34 +0000 (01:03 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 18 Feb 2017 01:03:34 +0000 (01:03 +0000)
includes/resourceloader/ResourceLoaderClientHtml.php
tests/phpunit/includes/resourceloader/ResourceLoaderClientHtmlTest.php

index ef2827c..29f8cfe 100644 (file)
@@ -365,7 +365,11 @@ class ResourceLoaderClientHtml {
                $rl = $mainContext->getResourceLoader();
                $chunks = [];
 
+               // Sort module names so requests are more uniform
+               sort( $modules );
+
                if ( $mainContext->getDebug() && count( $modules ) > 1 ) {
+
                        $chunks = [];
                        // Recursively call us for every item
                        foreach ( $modules as $name ) {
@@ -374,8 +378,6 @@ class ResourceLoaderClientHtml {
                        return new WrappedStringList( "\n", $chunks );
                }
 
-               // Sort module names so requests are more uniform
-               sort( $modules );
                // Create keyed-by-source and then keyed-by-group list of module objects from modules list
                $sortedModules = [];
                foreach ( $modules as $name ) {
index 528c322..2db3c16 100644 (file)
@@ -246,8 +246,14 @@ class ResourceLoaderClientHtmlTest extends PHPUnit_Framework_TestCase {
                                'context' => [ 'debug' => true ],
                                'modules' => [ 'test.styles.pure', 'test.styles.mixed' ],
                                'only' => ResourceLoaderModule::TYPE_STYLES,
-                               'output' => '<link rel="stylesheet" href="/w/load.php?debug=true&amp;lang=nl&amp;modules=test.styles.pure&amp;only=styles&amp;skin=fallback"/>' . "\n"
-                                       . '<link rel="stylesheet" href="/w/load.php?debug=true&amp;lang=nl&amp;modules=test.styles.mixed&amp;only=styles&amp;skin=fallback"/>',
+                               'output' => '<link rel="stylesheet" href="/w/load.php?debug=true&amp;lang=nl&amp;modules=test.styles.mixed&amp;only=styles&amp;skin=fallback"/>' . "\n"
+                                       . '<link rel="stylesheet" href="/w/load.php?debug=true&amp;lang=nl&amp;modules=test.styles.pure&amp;only=styles&amp;skin=fallback"/>',
+                       ],
+                       [
+                               'context' => [ 'debug' => false ],
+                               'modules' => [ 'test.styles.pure', 'test.styles.mixed' ],
+                               'only' => ResourceLoaderModule::TYPE_STYLES,
+                               'output' => '<link rel="stylesheet" href="/w/load.php?debug=false&amp;lang=nl&amp;modules=test.styles.mixed%2Cpure&amp;only=styles&amp;skin=fallback"/>',
                        ],
                        [
                                'context' => [],