Make OutputPageTest more independent from global state
authorThiemo Mättig <thiemo.maettig@wikimedia.de>
Fri, 11 Jul 2014 14:35:14 +0000 (16:35 +0200)
committerThiemo Mättig <thiemo.maettig@wikimedia.de>
Sat, 12 Jul 2014 14:42:51 +0000 (16:42 +0200)
This does not fix all problems (the "combined" test still fails
horribly on my machine for a reason I don't understand). However,
this patch fixes at least two of the problems:

Make the test independent from the wgResourceLoaderDebug setting.

Make the test independent from the wgLanguageCode setting.

Change-Id: I3aa52fed530d852b34b6058e29620749e11092a0

tests/phpunit/includes/OutputPageTest.php

index 542b3d6..5fee505 100644 (file)
@@ -175,13 +175,13 @@ mw.loader.implement("test.quux",function($,jQuery){mw.test.baz({token:123});},{"
                );
        }
 
-
        /**
         * @dataProvider provideMakeResourceLoaderLink
         * @covers OutputPage::makeResourceLoaderLink
         */
        public function testMakeResourceLoaderLink( $args, $expectedHtml) {
                $this->setMwGlobals( array(
+                       'wgResourceLoaderDebug' => false,
                        'wgResourceLoaderUseESI' => true,
                        'wgLoadScript' => 'http://127.0.0.1:8080/w/load.php',
                        // Affects whether CDATA is inserted
@@ -195,6 +195,7 @@ mw.loader.implement("test.quux",function($,jQuery){mw.test.baz({token:123});},{"
                $method = $class->getMethod( 'makeResourceLoaderLink' );
                $method->setAccessible( true );
                $ctx = new RequestContext();
+               $ctx->setLanguage( 'en' );
                $out = new OutputPage( $ctx );
                $rl = $out->getResourceLoader();
                $rl->register( array(