jenkins-bot has submitted this change and it was merged.

Change subject: Don't register unloadable test modules
......................................................................


Don't register unloadable test modules

Registering modules with the test runner that require target=mobile
when target is something other than mobile creates un-loadable
test modules

Note, given that all the registered test modules for MobileFrontend
are currently target=>mobile anyway this does not cause any problems to
existing test coverage.

Change-Id: I24658c4024fa495f2b2ca8dddd47cc46961a2bac
---
M includes/MobileFrontend.hooks.php
1 file changed, 12 insertions(+), 2 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index b2cede9..a5eee60 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -257,8 +257,18 @@
        public static function onResourceLoaderTestModules( array &$testModules,
                ResourceLoader &$resourceLoader
        ) {
-               // FIXME: Global core variable
-               global $wgResourceModules;
+               // FIXME: Global core variables
+               global $wgResourceModules, $wgRequest;
+
+               $context = MobileContext::singleton();
+               if (
+                       $wgRequest->getVal( 'target' ) !== 'mobile'
+                       && $wgRequest->getVal( 'useformat' ) !== 'mobile'
+                       && $wgRequest->getVal( 'skin' ) !== 'minerva'
+                       && !$context->shouldDisplayMobileView()
+               ) {
+                       return true;
+               }
 
                $testModuleBoilerplate = array(
                        'localBasePath' => dirname( __DIR__ ),

-- 
To view, visit https://gerrit.wikimedia.org/r/229060
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I24658c4024fa495f2b2ca8dddd47cc46961a2bac
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to