3 use Wikimedia\TestingAccessWrapper;
10 use MediaWikiCoversValidator;
17 'logo' =>
'/logo.png',
19 'all' => [
'.mw-wiki-logo { background-image: url(/logo.png); }' ],
24 'screen' =>
'.example {}',
26 'logo' =>
'/logo.png',
28 'screen' => [
'.example {}' ],
29 'all' => [
'.mw-wiki-logo { background-image: url(/logo.png); }' ],
36 '1.5x' =>
'/logo@1.5x.png',
37 '2x' =>
'/logo@2x.png',
41 .mw-
wiki-logo { background-image: url(/logo.png); }
44 '(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (min-resolution: 1.5dppx), (min-resolution: 144dpi)' => [ <<<CSS
45 .mw-
wiki-logo { background-image: url(/logo@1.5x.png);background-size: 135px
auto; }
48 '(-webkit-min-device-pixel-ratio: 2), (min--moz-device-pixel-ratio: 2), (min-resolution: 2dppx), (min-resolution: 192dpi)' => [ <<<CSS
49 .mw-
wiki-logo { background-image: url(/logo@2x.png);background-size: 135px
auto; }
62 .mw-
wiki-logo { background-image: url(/logo.png); }
65 .mw-
wiki-logo { background-image: -webkit-linear-gradient(transparent, transparent), url(/logo.svg); background-image: linear-gradient(transparent, transparent), url(/logo.svg);background-size: 135px
auto; }
80 ->disableOriginalConstructor()
81 ->setMethods( [
'readStyleFiles',
'getConfig',
'getLogoData' ] )
83 $module->expects( $this->once() )->method(
'readStyleFiles' )
85 $module->expects( $this->once() )->method(
'getConfig' )
87 $module->expects( $this->once() )->method(
'getLogoData' )
88 ->willReturn( $logo );
91 ->disableOriginalConstructor()->getMock();
95 $module->getStyles( $ctx )
104 ->disableOriginalConstructor()->setMethods(
null )->getMock();
106 ->disableOriginalConstructor()->getMock();
108 $this->assertFalse( $module->isKnownEmpty( $ctx ) );
124 $module->getLogoData(
new HashConfig( $config ) )
132 'ResourceBasePath' =>
'/w',
133 'Logo' =>
'/img/default.png',
136 'expected' =>
'/img/default.png',
138 'default and 2x' => [
140 'ResourceBasePath' =>
'/w',
141 'Logo' =>
'/img/default.png',
143 '2x' =>
'/img/two-x.png',
147 '1x' =>
'/img/default.png',
148 '2x' =>
'/img/two-x.png',
151 'default and all HiDPIs' => [
153 'ResourceBasePath' =>
'/w',
154 'Logo' =>
'/img/default.png',
156 '1.5x' =>
'/img/one-point-five.png',
157 '2x' =>
'/img/two-x.png',
161 '1x' =>
'/img/default.png',
162 '1.5x' =>
'/img/one-point-five.png',
163 '2x' =>
'/img/two-x.png',
166 'default and SVG' => [
168 'ResourceBasePath' =>
'/w',
169 'Logo' =>
'/img/default.png',
171 'svg' =>
'/img/vector.svg',
175 '1x' =>
'/img/default.png',
176 'svg' =>
'/img/vector.svg',
181 'ResourceBasePath' =>
'/w',
182 'Logo' =>
'/img/default.png',
184 '1.5x' =>
'/img/one-point-five.png',
185 '2x' =>
'/img/two-x.png',
186 'svg' =>
'/img/vector.svg',
190 '1x' =>
'/img/default.png',
191 'svg' =>
'/img/vector.svg',
196 'ResourceBasePath' =>
'/w',
197 'Logo' =>
'/w/test.jpg',
199 'UploadPath' =>
'/w/images',
201 'expected' =>
'/w/test.jpg?edcf2',
202 'baseDir' => dirname( dirname( __DIR__ ) ) .
'/data/media',
216 ->disableOriginalConstructor()->getMock();
219 $this->assertEquals( [
$result ], $module->getHeaders( $ctx ) );
226 'wgResourceBasePath' =>
'/w',
227 'wgLogo' =>
'/img/default.png',
229 '1.5x' =>
'/img/one-point-five.png',
230 '2x' =>
'/img/two-x.png',
233 'Link: </img/default.png>;rel=preload;as=image;media=' .
234 'not all and (min-resolution: 1.5dppx),' .
235 '</img/one-point-five.png>;rel=preload;as=image;media=' .
236 '(min-resolution: 1.5dppx) and (max-resolution: 1.999999dppx),' .
237 '</img/two-x.png>;rel=preload;as=image;media=(min-resolution: 2dppx)'
241 'wgResourceBasePath' =>
'/w',
242 'wgLogo' =>
'/img/default.png',
245 'Link: </img/default.png>;rel=preload;as=image'
249 'wgResourceBasePath' =>
'/w',
250 'wgLogo' =>
'/img/default.png',
252 '2x' =>
'/img/two-x.png',
255 'Link: </img/default.png>;rel=preload;as=image;media=' .
256 'not all and (min-resolution: 2dppx),' .
257 '</img/two-x.png>;rel=preload;as=image;media=(min-resolution: 2dppx)'
261 'wgResourceBasePath' =>
'/w',
262 'wgLogo' =>
'/img/default.png',
264 'svg' =>
'/img/vector.svg',
267 'Link: </img/vector.svg>;rel=preload;as=image'
272 'wgResourceBasePath' =>
'/w',
273 'wgLogo' =>
'/w/test.jpg',
275 'wgUploadPath' =>
'/w/images',
276 'IP' => dirname( dirname( __DIR__ ) ) .
'/data/media',
278 'Link: </w/test.jpg?edcf2>;rel=preload;as=image',