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

Change subject: Again: Context modules can't be arrays
......................................................................


Again: Context modules can't be arrays

Fix mobile.talk definition in Context modules and add test, to prevent
this as good as possible.

Change-Id: Id039d737039d5e5401d97e61d765736e3fe993b2
---
M includes/MobileFrontend.hooks.php
M includes/skins/SkinMinervaBeta.php
A tests/phpunit/skins/SkinMinervaAlphaTest.php
3 files changed, 40 insertions(+), 1 deletion(-)

Approvals:
  Jdlrobson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index 62d518b..7176f9d 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -783,6 +783,7 @@
                                        'MobileContextTest.php',
                                        'MobileFormatterTest.php',
                                        'skins/SkinMinervaTest.php',
+                                       'skins/SkinMinervaAlphaTest.php',
                                        'specials/MobileSpecialPageTest.php',
                                        'specials/SpecialMobileDiffTest.php',
                                )
diff --git a/includes/skins/SkinMinervaBeta.php 
b/includes/skins/SkinMinervaBeta.php
index 3001581..8964190 100644
--- a/includes/skins/SkinMinervaBeta.php
+++ b/includes/skins/SkinMinervaBeta.php
@@ -35,7 +35,7 @@
                $modules = parent::getContextSpecificModules();
                $title = $this->getTitle();
                if ( $this->isAllowedPageAction( 'talk' ) && 
!$title->isTalkPage() && $title->canTalk() ) {
-                       $modules['talk'] = array( 'mobile.talk' );
+                       $modules[] = 'mobile.talk';
                }
 
                return $modules;
diff --git a/tests/phpunit/skins/SkinMinervaAlphaTest.php 
b/tests/phpunit/skins/SkinMinervaAlphaTest.php
new file mode 100644
index 0000000..7184b64
--- /dev/null
+++ b/tests/phpunit/skins/SkinMinervaAlphaTest.php
@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * @group MobileFrontend
+ */
+class SkinMinervaAlphaTest extends MediaWikiTestCase {
+       /**
+        * Check, if context modules aren't arrays. They will be added as an 
array with modules to
+        * to load, which doesn't allow arrays as values.
+        */
+       public function testGetContextSpecificModules() {
+               // try to cover all possible modules (maybe extent, if other 
modules added)
+               $values = array(
+                       'wgMFEnableBeta' => true
+               );
+               $this->setMwGlobals( $values );
+
+               // UTSysop will be a logged in user
+               $user = User::newFromName( 'UTSysop' );
+               $user->load();
+
+               // create a new RequestContext for this test case and set User 
and title
+               $context = new RequestContext;
+               $context->setUser( $user );
+               // UTPage is an existing page in the main namespace
+               $context->setTitle( Title::newFromText( 'UTPage' ) );
+               MobileContext::singleton()->setMobileMode( 'alpha' );
+
+               $skin = new SkinMinervaAlpha;
+               $skin->setContext( $context );
+
+               $modules = $skin->getContextSpecificModules();
+
+               foreach ( $modules as $module ) {
+                       $this->assertFalse( is_array( $module ), 'Context 
specific modules can\'t be a arrays.' );
+               }
+       }
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id039d737039d5e5401d97e61d765736e3fe993b2
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to