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

Change subject: Improve mobileview tests isolation
......................................................................


Improve mobileview tests isolation

Bug: 58420
Change-Id: Ic75fde0e143aef715babed0b975b3a8d9bbb4611
---
M includes/api/ApiMobileView.php
M tests/ApiMobileViewTest.php
2 files changed, 16 insertions(+), 1 deletion(-)

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



diff --git a/includes/api/ApiMobileView.php b/includes/api/ApiMobileView.php
index d83aaeb..c55cadd 100644
--- a/includes/api/ApiMobileView.php
+++ b/includes/api/ApiMobileView.php
@@ -272,6 +272,17 @@
                return WikiPage::factory( $title );
        }
 
+       /**
+        * Creates a ParserOptions instance
+        *
+        * @param WikiPage $wp
+        *
+        * @return ParserOptions
+        */
+       protected function makeParserOptions( WikiPage $wp ) {
+               return $wp->makeParserOptions( $this );
+       }
+
        private function getData( Title $title, $noImages ) {
                global $wgMemc, $wgUseTidy, $wgMFMinCachedPageSize;
 
@@ -298,7 +309,7 @@
                                $latest, $this->noTransform, 
$this->file->getSha1(), $this->variant );
                        $cacheExpiry = 3600;
                } else {
-                       $parserOptions = $wp->makeParserOptions( $this );
+                       $parserOptions = $this->makeParserOptions( $wp );
                        $parserCacheKey = ParserCache::singleton()->getKey( 
$wp, $parserOptions );
                        $key = wfMemcKey( 'mf', 'mobileview', 
self::CACHE_VERSION, $noImages, $latest, $this->noTransform, $parserCacheKey );
                }
diff --git a/tests/ApiMobileViewTest.php b/tests/ApiMobileViewTest.php
index 20188db..2aa244d 100644
--- a/tests/ApiMobileViewTest.php
+++ b/tests/ApiMobileViewTest.php
@@ -26,6 +26,10 @@
                return new MockWikiPage( $title );
        }
 
+       protected function makeParserOptions( WikiPage $wp ) {
+               return new ParserOptions( $this->getUser() );
+       }
+
        public function getAllowedParams() {
                return array_merge( parent::getAllowedParams(), array( 'text' 
=> null ) );
        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic75fde0e143aef715babed0b975b3a8d9bbb4611
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[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