Merge "Selenium: replace UserLoginPage with BlankPage where possible"
[lhc/web/wiklou.git] / tests / phpunit / includes / resourceloader / ResourceLoaderOOUIImageModuleTest.php
1 <?php
2
3 /**
4 * @group ResourceLoader
5 */
6 class ResourceLoaderOOUIImageModuleTest extends ResourceLoaderTestCase {
7
8 /**
9 * @covers ResourceLoaderOOUIImageModule::loadFromDefinition
10 */
11 public function testNonDefaultSkin() {
12 $module = new ResourceLoaderOOUIImageModule( [
13 'class' => ResourceLoaderOOUIImageModule::class,
14 'name' => 'icons',
15 'rootPath' => 'tests/phpunit/data/resourceloader/oouiimagemodule',
16 ] );
17
18 // Pretend that 'fakemonobook' is a real skin using the Apex theme
19 $skinFactory = new SkinFactory();
20 $skinFactory->register(
21 'fakemonobook',
22 'FakeMonoBook',
23 function () {
24 }
25 );
26 $this->setService( 'SkinFactory', $skinFactory );
27
28 $reset = ExtensionRegistry::getInstance()->setAttributeForTest(
29 'SkinOOUIThemes', [ 'fakemonobook' => 'Apex' ]
30 );
31
32 $styles = $module->getStyles( $this->getResourceLoaderContext( [ 'skin' => 'fakemonobook' ] ) );
33 $this->assertRegExp(
34 '/stu-apex/',
35 $styles['all'],
36 'Generated styles use the non-default image (embed)'
37 );
38 $this->assertRegExp(
39 '/fakemonobook/',
40 $styles['all'],
41 'Generated styles use the non-default image (link)'
42 );
43
44 $styles = $module->getStyles( $this->getResourceLoaderContext() );
45 $this->assertRegExp(
46 '/stu-wikimediaui/',
47 $styles['all'],
48 'Generated styles use the default image (embed)'
49 );
50 $this->assertRegExp(
51 '/fallback/',
52 $styles['all'],
53 'Generated styles use the default skin (link)'
54 );
55 }
56
57 }