From ae658ff245dc2441b8b5461b27770d3f647643fc Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sat, 13 Jul 2019 19:32:17 +0100 Subject: [PATCH] resourceloader: Add test coverage for WikiModule::getType Change-Id: If004cc4ff3835091c01a4df84006be3f6fa173b2 --- .../ResourceLoaderWikiModuleTest.php | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) 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 */ -- 2.20.1