From: Timo Tijhof Date: Sat, 13 Jul 2019 18:32:17 +0000 (+0100) Subject: resourceloader: Add test coverage for WikiModule::getType X-Git-Tag: 1.34.0-rc.0~992^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=ae658ff245dc2441b8b5461b27770d3f647643fc resourceloader: Add test coverage for WikiModule::getType Change-Id: If004cc4ff3835091c01a4df84006be3f6fa173b2 --- diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php index 6ac037795c..59649153e9 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php @@ -92,6 +92,33 @@ class ResourceLoaderWikiModuleTest extends ResourceLoaderTestCase { yield 'some group' => [ [ 'group' => 'foobar' ], 'foobar' ]; } + /** + * @dataProvider provideGetType + */ + public function testGetType( $params, $expected ) { + $module = new ResourceLoaderWikiModule( $params ); + $this->assertSame( $expected, $module->getType() ); + } + + public static function provideGetType() { + yield 'empty' => [ + [], + ResourceLoaderWikiModule::LOAD_GENERAL, + ]; + yield 'scripts' => [ + [ 'scripts' => [ 'Example.js' ] ], + ResourceLoaderWikiModule::LOAD_GENERAL, + ]; + yield 'styles' => [ + [ 'styles' => [ 'Example.css' ] ], + ResourceLoaderWikiModule::LOAD_STYLES, + ]; + yield 'styles and scripts' => [ + [ 'styles' => [ 'Example.css' ], 'scripts' => [ 'Example.js' ] ], + ResourceLoaderWikiModule::LOAD_GENERAL, + ]; + } + /** * @dataProvider provideIsKnownEmpty */