5 * @group ResourceLoader
7 class ResourceLoaderSkinModuleTest
extends PHPUnit_Framework_TestCase
{
9 public static function provideGetStyles() {
14 'all' => [ '.mw-wiki-logo { background-image: url(/logo.png); }' ],
19 'screen' => '.example {}',
22 'screen' => [ '.example {}' ],
23 'all' => [ '.mw-wiki-logo { background-image: url(/logo.png); }' ],
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' ] )
39 $module->expects( $this->once() )->method( 'readStyleFiles' )
40 ->willReturn( $parent );
41 $module->setConfig( new HashConfig( [
42 'ResourceBasePath' => '/w',
43 'Logo' => '/logo.png',
47 $ctx = $this->getMockBuilder( ResourceLoaderContext
::class )
48 ->disableOriginalConstructor()->getMock();
51 $module->getStyles( $ctx ),
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 ) );