$options += [
'lang' => 'en',
'dir' => 'ltr',
+ 'skin' => 'vector',
'modules' => 'startup',
'only' => 'scripts',
];
'lang' => $options['lang'],
'modules' => $options['modules'],
'only' => $options['only'],
- 'skin' => 'vector',
+ 'skin' => $options['skin'],
'target' => 'phpunit',
] );
$ctx = $this->getMockBuilder( 'ResourceLoaderContext' )
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+ <g id="search">
+ <path id="magnifying-glass-apex" d="M18.87 18.375l-3.987-3.99-.286-.17a5.774 5.774 0 0 0 1.082-3.372C15.67 7.616 13.06 5 9.84 5A5.843 5.843 0 0 0 4 10.844a5.84 5.84 0 0 0 5.842 5.842c1.26 0 2.423-.403 3.377-1.08l.16.286 3.99 3.987c.32.31.91.24 1.33-.18.41-.42.49-1.01.17-1.33zM9.837 14.56a3.72 3.72 0 0 1-3.718-3.717c0-2.05 1.67-3.72 3.72-3.72s3.72 1.668 3.72 3.72a3.722 3.722 0 0 1-3.72 3.718z"/>
+ </g>
+</svg>
--- /dev/null
+<?php
+
+/**
+ * @group ResourceLoader
+ */
+class ResourceLoaderOOUIImageModuleTest extends ResourceLoaderTestCase {
+
+ /**
+ * @covers ResourceLoaderOOUIImageModule::loadFromDefinition
+ */
+ public function testNonDefaultSkin() {
+ $module = new ResourceLoaderOOUIImageModule( [
+ 'class' => 'ResourceLoaderOOUIImageModule',
+ 'name' => 'icons',
+ 'rootPath' => 'tests/phpunit/data/resourceloader/oouiimagemodule',
+ ] );
+
+ // Pretend that 'fakemonobook' is a real skin using the Apex theme
+ SkinFactory::getDefaultInstance()->register(
+ 'fakemonobook',
+ 'FakeMonoBook',
+ function () {
+ }
+ );
+ $r = new ReflectionMethod( 'ExtensionRegistry', 'exportExtractedData' );
+ $r->setAccessible( true );
+ $r->invoke( ExtensionRegistry::getInstance(), [
+ 'globals' => [],
+ 'defines' => [],
+ 'callbacks' => [],
+ 'credits' => [],
+ 'autoloaderPaths' => [],
+ 'attributes' => [
+ 'SkinOOUIThemes' => [
+ 'fakemonobook' => 'Apex',
+ ],
+ ],
+ ] );
+
+ $styles = $module->getStyles( $this->getResourceLoaderContext( [ 'skin' => 'fakemonobook' ] ) );
+ $this->assertRegExp(
+ '/magnifying-glass-apex/',
+ $styles['all'],
+ 'Generated styles use the non-default image (embed)'
+ );
+ $this->assertRegExp(
+ '/fakemonobook/',
+ $styles['all'],
+ 'Generated styles use the non-default image (link)'
+ );
+
+ $styles = $module->getStyles( $this->getResourceLoaderContext() );
+ $this->assertRegExp(
+ '/magnifying-glass-mediawiki/',
+ $styles['all'],
+ 'Generated styles use the default image (embed)'
+ );
+ $this->assertRegExp(
+ '/vector/',
+ $styles['all'],
+ 'Generated styles use the default image (link)'
+ );
+ }
+
+}