<?php
+use Wikimedia\TestingAccessWrapper;
+
/**
*
* @author Matthew Flaschen
/**
* @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();
return [
[
[
+ 'ResourceBasePath' => '/w',
'Logo' => '/img/default.png',
'LogoHD' => [
'1.5x' => '/img/one-point-five.png',
],
[
[
+ 'ResourceBasePath' => '/w',
'Logo' => '/img/default.png',
'LogoHD' => false,
],
],
[
[
+ 'ResourceBasePath' => '/w',
'Logo' => '/img/default.png',
'LogoHD' => [
'2x' => '/img/two-x.png',
'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',
+ ],
];
}