aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php
diff options
context:
space:
mode:
authorTimo Tijhof <krinklemail@gmail.com>2019-07-13 19:32:17 +0100
committerCatrope <roan@wikimedia.org>2019-07-15 22:39:43 +0000
commitae658ff245dc2441b8b5461b27770d3f647643fc (patch)
tree4ddcbb0a1a106349c6b6be1d258a95eacda20fd3 /tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php
parent397a3ee0bdf98abdba253e4a66949f83daa97172 (diff)
downloadmediawikicore-ae658ff245dc2441b8b5461b27770d3f647643fc.tar.gz
mediawikicore-ae658ff245dc2441b8b5461b27770d3f647643fc.zip
resourceloader: Add test coverage for WikiModule::getType
Change-Id: If004cc4ff3835091c01a4df84006be3f6fa173b2
Diffstat (limited to 'tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php')
-rw-r--r--tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php
index 6ac037795cb4..59649153e912 100644
--- a/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php
+++ b/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php
@@ -93,6 +93,33 @@ class ResourceLoaderWikiModuleTest extends ResourceLoaderTestCase {
}
/**
+ * @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
*/
public function testIsKnownEmpty( $titleInfo, $group, $dependencies, $expected ) {