From: Derick Alangi Date: Mon, 13 May 2019 13:02:19 +0000 (+0100) Subject: tests: Remove deprecated rarely used method stashMwGlobals() X-Git-Tag: 1.34.0-rc.0~1704 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_del%27%2C%20idvote=vote.voteid%29%20%7D%7D?a=commitdiff_plain;h=74127225b8f15d86d7326b725d39129f4b237b11;p=lhc%2Fweb%2Fwiklou.git tests: Remove deprecated rarely used method stashMwGlobals() This method was hard deprecated in 1.32 and seems it's no longer used? Can we remove it now? Usage ===== https://codesearch.wmflabs.org/search/?q=%5CbstashMwGlobals%5Cb&i=nope&files=&repos= Change-Id: I8d105a82093ea4cb3a38ed04e471e0213b29e8ec --- diff --git a/RELEASE-NOTES-1.34 b/RELEASE-NOTES-1.34 index 6113a5f33b..db24a44e26 100644 --- a/RELEASE-NOTES-1.34 +++ b/RELEASE-NOTES-1.34 @@ -155,6 +155,7 @@ because of Phabricator reports. removed. * ChangeTags::purgeTagUsageCache(), deprecated in 1.33, has been removed. * JobQueueGroup::pushLazyJobs(), deprecated in 1.33, has been removed. +* MediaWikiTestCase::stashMwGlobals(), deprecated in 1.32, has been removed. * … === Deprecations in 1.34 === diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 329f0ba12d..999813fdb3 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -817,29 +817,6 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase { return false; } - /** - * Stashes the global, will be restored in tearDown() - * - * Individual test functions may override globals through the setMwGlobals() function - * or directly. When directly overriding globals their keys should first be passed to this - * method in setUp to avoid breaking global state for other tests - * - * That way all other tests are executed with the same settings (instead of using the - * unreliable local settings for most tests and fix it only for some tests). - * - * @param array|string $globalKeys Key to the global variable, or an array of keys. - * - * @note To allow changes to global variables to take effect on global service instances, - * call overrideMwServices(). - * - * @since 1.23 - * @deprecated since 1.32, use setMwGlobals() and don't alter globals directly - */ - protected function stashMwGlobals( $globalKeys ) { - wfDeprecated( __METHOD__, '1.32' ); - $this->doStashMwGlobals( $globalKeys ); - } - private function doStashMwGlobals( $globalKeys ) { if ( is_string( $globalKeys ) ) { $globalKeys = [ $globalKeys ]; diff --git a/tests/phpunit/tests/MediaWikiTestCaseTest.php b/tests/phpunit/tests/MediaWikiTestCaseTest.php index 6b5a487634..cfc01ea540 100644 --- a/tests/phpunit/tests/MediaWikiTestCaseTest.php +++ b/tests/phpunit/tests/MediaWikiTestCaseTest.php @@ -67,32 +67,7 @@ class MediaWikiTestCaseTest extends MediaWikiTestCase { } /** - * @dataProvider provideExistingKeysAndNewValues - * - * @covers MediaWikiTestCase::stashMwGlobals - * @covers MediaWikiTestCase::tearDown - */ - public function testStashedGlobalsAreRestoredOnTearDown( $globalKey, $newValue ) { - $this->hideDeprecated( 'MediaWikiTestCase::stashMwGlobals' ); - $this->stashMwGlobals( $globalKey ); - $GLOBALS[$globalKey] = $newValue; - $this->assertEquals( - $newValue, - $GLOBALS[$globalKey], - 'Global failed to correctly set' - ); - - $this->tearDown(); - - $this->assertEquals( - self::$startGlobals[$globalKey], - $GLOBALS[$globalKey], - 'Global failed to be restored on tearDown' - ); - } - - /** - * @covers MediaWikiTestCase::stashMwGlobals + * @covers MediaWikiTestCase::setMwGlobals * @covers MediaWikiTestCase::tearDown */ public function testSetNonExistentGlobalsAreUnsetOnTearDown() {