MediaWiki REL1_33
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}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
testNonDefaultSkin()
ResourceLoaderOOUIImageModule::loadFromDefinition.
getResourceLoaderContext( $options=[], ResourceLoader $rl=null)