MediaWiki REL1_31
ResourceLoaderOOUIImageModuleTest.php
Go to the documentation of this file.
1<?php
2
7
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::getDefaultInstance()->register(
20 'fakemonobook',
21 'FakeMonoBook',
22 function () {
23 }
24 );
25 $r = new ReflectionMethod( ExtensionRegistry::class, 'exportExtractedData' );
26 $r->setAccessible( true );
27 $r->invoke( ExtensionRegistry::getInstance(), [
28 'globals' => [],
29 'defines' => [],
30 'callbacks' => [],
31 'credits' => [],
32 'autoloaderPaths' => [],
33 'attributes' => [
34 'SkinOOUIThemes' => [
35 'fakemonobook' => 'Apex',
36 ],
37 ],
38 ] );
39
40 $styles = $module->getStyles( $this->getResourceLoaderContext( [ 'skin' => 'fakemonobook' ] ) );
41 $this->assertRegExp(
42 '/stu-apex/',
43 $styles['all'],
44 'Generated styles use the non-default image (embed)'
45 );
46 $this->assertRegExp(
47 '/fakemonobook/',
48 $styles['all'],
49 'Generated styles use the non-default image (link)'
50 );
51
52 $styles = $module->getStyles( $this->getResourceLoaderContext() );
53 $this->assertRegExp(
54 '/stu-wikimediaui/',
55 $styles['all'],
56 'Generated styles use the default image (embed)'
57 );
58 $this->assertRegExp(
59 '/vector/',
60 $styles['all'],
61 'Generated styles use the default image (link)'
62 );
63 }
64
65}
testNonDefaultSkin()
ResourceLoaderOOUIImageModule::loadFromDefinition.
getResourceLoaderContext( $options=[], ResourceLoader $rl=null)