Merge "EditPage: Factor out getSaveButtonLabel method"
[lhc/web/wiklou.git] / tests / phpunit / includes / OutputPageTest.php
index 7571e26..97df585 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  *
  * @author Matthew Flaschen
@@ -507,8 +509,12 @@ class OutputPageTest extends MediaWikiTestCase {
        /**
         * @dataProvider providePreloadLinkHeaders
         * @covers OutputPage::addLogoPreloadLinkHeaders
+        * @covers ResourceLoaderSkinModule::getLogo
         */
-       public function testPreloadLinkHeaders( $config, $result ) {
+       public function testPreloadLinkHeaders( $config, $result, $baseDir = null ) {
+               if ( $baseDir ) {
+                       $this->setMwGlobals( 'IP', $baseDir );
+               }
                $out = TestingAccessWrapper::newFromObject( $this->newInstance( $config ) );
                $out->addLogoPreloadLinkHeaders();
 
@@ -519,6 +525,7 @@ class OutputPageTest extends MediaWikiTestCase {
                return [
                        [
                                [
+                                       'ResourceBasePath' => '/w',
                                        'Logo' => '/img/default.png',
                                        'LogoHD' => [
                                                '1.5x' => '/img/one-point-five.png',
@@ -533,6 +540,7 @@ class OutputPageTest extends MediaWikiTestCase {
                        ],
                        [
                                [
+                                       'ResourceBasePath' => '/w',
                                        'Logo' => '/img/default.png',
                                        'LogoHD' => false,
                                ],
@@ -540,6 +548,7 @@ class OutputPageTest extends MediaWikiTestCase {
                        ],
                        [
                                [
+                                       'ResourceBasePath' => '/w',
                                        'Logo' => '/img/default.png',
                                        'LogoHD' => [
                                                '2x' => '/img/two-x.png',
@@ -549,6 +558,16 @@ class OutputPageTest extends MediaWikiTestCase {
                                'not all and (min-resolution: 2dppx),' .
                                '</img/two-x.png>;rel=preload;as=image;media=(min-resolution: 2dppx)'
                        ],
+                       [
+                               [
+                                       'ResourceBasePath' => '/w',
+                                       'Logo' => '/w/test.jpg',
+                                       'LogoHD' => false,
+                                       'UploadPath' => '/w/images',
+                               ],
+                               'Link: </w/test.jpg?edcf2>;rel=preload;as=image',
+                               'baseDir' => dirname( __DIR__ ) . '/data/media',
+                       ],
                ];
        }