jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/360693 )
Change subject: resourceloader: Add unit tests for ResourceLoader::isFileModule
......................................................................
resourceloader: Add unit tests for ResourceLoader::isFileModule
Change-Id: Ic21ae9e9cc418868ad7b93fe65bd09495f38d1b2
---
M tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
1 file changed, 52 insertions(+), 0 deletions(-)
Approvals:
Bartosz Dziewoński: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
index 0833047..79d0784 100644
--- a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
+++ b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
@@ -113,6 +113,58 @@
);
}
+ public function provideTestIsFileModule() {
+ $fileModuleObj = $this->getMockBuilder(
ResourceLoaderFileModule::class )
+ ->disableOriginalConstructor()
+ ->getMock();
+ return [
+ 'object' => [ false,
+ new ResourceLoaderTestModule()
+ ],
+ 'FileModule object' => [ false,
+ $fileModuleObj
+ ],
+ 'simple empty' => [ true,
+ []
+ ],
+ 'simple scripts' => [ true,
+ [ 'scripts' => 'example.js' ]
+ ],
+ 'simple scripts, raw and targets' => [ true, [
+ 'scripts' => [ 'a.js', 'b.js' ],
+ 'raw' => true,
+ 'targets' => [ 'desktop', 'mobile' ],
+ ] ],
+ 'FileModule' => [ true,
+ [ 'class' => ResourceLoaderFileModule::class,
'scripts' => 'example.js' ]
+ ],
+ 'TestModule' => [ false,
+ [ 'class' => ResourceLoaderTestModule::class,
'scripts' => 'example.js' ]
+ ],
+ 'SkinModule (FileModule subclass)' => [ true,
+ [ 'class' => ResourceLoaderSkinModule::class,
'scripts' => 'example.js' ]
+ ],
+ 'JqueryMsgModule (FileModule subclass)' => [ true, [
+ 'class' => ResourceLoaderJqueryMsgModule::class,
+ 'scripts' => 'example.js',
+ ] ],
+ 'WikiModule' => [ false, [
+ 'class' => ResourceLoaderWikiModule::class,
+ 'scripts' => [ 'MediaWiki:Example.js' ],
+ ] ],
+ ];
+ }
+
+ /**
+ * @dataProvider provideTestIsFileModule
+ * @covers ResourceLoader::isFileModule
+ */
+ public function testIsFileModule( $expected, $module ) {
+ $rl = TestingAccessWrapper::newFromObject( new
EmptyResourceLoader() );
+ $rl->register( 'test', $module );
+ $this->assertSame( $expected, $rl->isFileModule( 'test' ) );
+ }
+
/**
* @covers ResourceLoader::isModuleRegistered
*/
--
To view, visit https://gerrit.wikimedia.org/r/360693
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic21ae9e9cc418868ad7b93fe65bd09495f38d1b2
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits