From d3978dc03b71477b80cf048177554d55ac5b59de Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Sat, 13 Nov 2010 08:32:40 +0000 Subject: [PATCH] Tests: removed assignments of null to globals that are usually not null in tearDown() methods. This practice leads to other tests having to play whack-a-mole by initializing random variables they don't need directly just to avoid crashing. --- maintenance/tests/phpunit/includes/ExtraParserTest.php | 6 ------ .../tests/phpunit/includes/LanguageConverterTest.php | 2 +- maintenance/tests/phpunit/includes/TitlePermissionTest.php | 5 ----- maintenance/tests/phpunit/includes/api/ApiSetup.php | 5 ----- maintenance/tests/phpunit/includes/api/ApiUploadTest.php | 5 ----- .../tests/phpunit/includes/search/SearchUpdateTest.php | 1 - 6 files changed, 1 insertion(+), 23 deletions(-) diff --git a/maintenance/tests/phpunit/includes/ExtraParserTest.php b/maintenance/tests/phpunit/includes/ExtraParserTest.php index b95d79349a..f879011353 100644 --- a/maintenance/tests/phpunit/includes/ExtraParserTest.php +++ b/maintenance/tests/phpunit/includes/ExtraParserTest.php @@ -15,12 +15,6 @@ class ExtraParserTest extends PHPUnit_Framework_TestCase { $wgMemc = new FakeMemCachedClient; } - function tearDown() { - global $wgMemc; - - $wgMemc = null; - } - // Bug 8689 - Long numeric lines kill the parser function testBug8689() { global $wgLang; diff --git a/maintenance/tests/phpunit/includes/LanguageConverterTest.php b/maintenance/tests/phpunit/includes/LanguageConverterTest.php index 8c533430e8..944195f4db 100644 --- a/maintenance/tests/phpunit/includes/LanguageConverterTest.php +++ b/maintenance/tests/phpunit/includes/LanguageConverterTest.php @@ -21,7 +21,7 @@ class LanguageConverterTest extends PHPUnit_Framework_TestCase { unset( $wgMemc ); unset( $this->lc ); unset( $this->lang ); - $wgContLang = null; + $wgContLang = Language::factory( 'en' ); } function testGetPreferredVariantDefaults() { diff --git a/maintenance/tests/phpunit/includes/TitlePermissionTest.php b/maintenance/tests/phpunit/includes/TitlePermissionTest.php index d24359ff29..9619036394 100644 --- a/maintenance/tests/phpunit/includes/TitlePermissionTest.php +++ b/maintenance/tests/phpunit/includes/TitlePermissionTest.php @@ -50,11 +50,6 @@ class TitlePermissionTest extends PHPUnit_Framework_TestCase { } } - function tearDown() { - global $wgContLang, $wgLang; - $wgContLang = $wgLang = null; - } - function setUserPerm( $perm ) { if ( is_array( $perm ) ) { self::$user->mRights = $perm; diff --git a/maintenance/tests/phpunit/includes/api/ApiSetup.php b/maintenance/tests/phpunit/includes/api/ApiSetup.php index 45790d4abe..cbf0b27cf4 100644 --- a/maintenance/tests/phpunit/includes/api/ApiSetup.php +++ b/maintenance/tests/phpunit/includes/api/ApiSetup.php @@ -39,11 +39,6 @@ abstract class ApiTestSetup extends PHPUnit_Framework_TestCase { $GLOBALS['wgUser'] = self::$sysopUser->user; } - - function tearDown() { - global $wgMemc; - $wgMemc = null; - } } class UserWrapper { diff --git a/maintenance/tests/phpunit/includes/api/ApiUploadTest.php b/maintenance/tests/phpunit/includes/api/ApiUploadTest.php index a134dd31c3..ebfbd34ecd 100644 --- a/maintenance/tests/phpunit/includes/api/ApiUploadTest.php +++ b/maintenance/tests/phpunit/includes/api/ApiUploadTest.php @@ -108,11 +108,6 @@ abstract class ApiTestCase extends PHPUnit_Framework_TestCase { } - function tearDown() { - global $wgMemc; - $wgMemc = null; - } - protected function doApiRequest( $params, $session = null ) { $_SESSION = isset( $session ) ? $session : array(); diff --git a/maintenance/tests/phpunit/includes/search/SearchUpdateTest.php b/maintenance/tests/phpunit/includes/search/SearchUpdateTest.php index 0befcd32aa..4555bb1d60 100644 --- a/maintenance/tests/phpunit/includes/search/SearchUpdateTest.php +++ b/maintenance/tests/phpunit/includes/search/SearchUpdateTest.php @@ -91,7 +91,6 @@ class SearchUpdateTest extends PHPUnit_Framework_TestCase { $wgDBtype = self::$dbtype; $wgLBFactoryConf = self::$factoryconf; $wgDBservers = self::$dbservers; - $wgContLang = null; } function testUpdateText() { -- 2.20.1