jenkins-bot has submitted this change and it was merged.
Change subject: Improve tests isolation
......................................................................
Improve tests isolation
Change-Id: I85f35b3e17b3b52eb3630cd3148ee150e1f72ee5
---
M tests/phpunit/api/ApiMobileViewTest.php
M tests/phpunit/api/ApiParseExtenderTest.php
2 files changed, 9 insertions(+), 30 deletions(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/phpunit/api/ApiMobileViewTest.php
b/tests/phpunit/api/ApiMobileViewTest.php
index 8cc9480..ace6a7b 100644
--- a/tests/phpunit/api/ApiMobileViewTest.php
+++ b/tests/phpunit/api/ApiMobileViewTest.php
@@ -58,18 +58,6 @@
* @group MobileFrontend
*/
class ApiMobileViewTest extends MediaWikiTestCase {
- private $savedGlobals;
-
- public function setUp() {
- $this->savedGlobals = $GLOBALS;
- parent::setUp();
- }
-
- public function tearDown() {
- parent::tearDown();
- $GLOBALS = $this->savedGlobals;
- }
-
/**
* @dataProvider provideSections
*/
@@ -114,8 +102,7 @@
* @dataProvider provideView
*/
public function testView( array $input, array $expected ) {
- global $wgAPIModules;
- $wgAPIModules['mobileview'] = 'MockApiMobileView';
+ $this->setMwGlobals( 'wgAPIModules', array( 'mobileview' =>
'MockApiMobileView' ) );
$request = new FauxRequest( $input );
$context = new RequestContext();
diff --git a/tests/phpunit/api/ApiParseExtenderTest.php
b/tests/phpunit/api/ApiParseExtenderTest.php
index 76d1f7c..f12005f 100644
--- a/tests/phpunit/api/ApiParseExtenderTest.php
+++ b/tests/phpunit/api/ApiParseExtenderTest.php
@@ -4,29 +4,21 @@
* @group MobileFrontend
*/
class ApiParseExtenderTest extends MediaWikiTestCase {
- private $savedGlobals;
-
- public function setUp() {
- $this->savedGlobals = $GLOBALS;
- parent::setUp();
- }
-
- public function tearDown() {
- $GLOBALS = $this->savedGlobals;
- $this->savedGlobals = null;
- parent::tearDown();
- }
-
/**
* @dataProvider getData
*/
public function testApi( array $params, $expected ) {
- global $wgUseTidy, $wgMFRemovableClasses;
+ global $wgUseTidy;
- $wgMFRemovableClasses['HTML'][] = '.nomobile';
+ $this->setMwGlobals( 'wgMFRemovableClasses',
+ array(
+ 'base' => array(),
+ 'HTML' => array( '.nomobile' )
+ )
+ );
if ( $wgUseTidy ) {
// Should work both with Tidy and without it
- $wgUseTidy = false;
+ $this->setMwGlobals( 'wgUseTidy', false );
$this->doTest( $params, $expected );
$wgUseTidy = true;
}
--
To view, visit https://gerrit.wikimedia.org/r/142639
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I85f35b3e17b3b52eb3630cd3148ee150e1f72ee5
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits