rdbms: Rename "memCache" to "memStash" in LBFactory
[mediawiki.git] / tests / phpunit / includes / resourceloader / ResourceLoaderSkinModuleTest.php
blobc56769827ac15379931d873a1f4e7a97395bf9cd
1 <?php
3 /**
4 * @group Database
5 * @group ResourceLoader
6 */
7 class ResourceLoaderSkinModuleTest extends PHPUnit_Framework_TestCase {
9 public static function provideGetStyles() {
10 return [
12 'parent' => [],
13 'expected' => [
14 'all' => [ '.mw-wiki-logo { background-image: url(/logo.png); }' ],
18 'parent' => [
19 'screen' => '.example {}',
21 'expected' => [
22 'screen' => [ '.example {}' ],
23 'all' => [ '.mw-wiki-logo { background-image: url(/logo.png); }' ],
29 /**
30 * @dataProvider provideGetStyles
31 * @covers ResourceLoaderSkinModule::normalizeStyles
32 * @covers ResourceLoaderSkinModule::getStyles
34 public function testGetStyles( $parent, $expected ) {
35 $module = $this->getMockBuilder( ResourceLoaderSkinModule::class )
36 ->disableOriginalConstructor()
37 ->setMethods( [ 'readStyleFiles' ] )
38 ->getMock();
39 $module->expects( $this->once() )->method( 'readStyleFiles' )
40 ->willReturn( $parent );
41 $module->setConfig( new HashConfig( [
42 'ResourceBasePath' => '/w',
43 'Logo' => '/logo.png',
44 'LogoHD' => false,
45 ] ) );
47 $ctx = $this->getMockBuilder( ResourceLoaderContext::class )
48 ->disableOriginalConstructor()->getMock();
50 $this->assertEquals(
51 $module->getStyles( $ctx ),
52 $expected
56 /**
57 * @covers ResourceLoaderSkinModule::isKnownEmpty
59 public function testIsKnownEmpty() {
60 $module = $this->getMockBuilder( ResourceLoaderSkinModule::class )
61 ->disableOriginalConstructor()->setMethods( null )->getMock();
62 $ctx = $this->getMockBuilder( ResourceLoaderContext::class )
63 ->disableOriginalConstructor()->getMock();
65 $this->assertFalse( $module->isKnownEmpty( $ctx ) );