From 14cc0fdf8ecef1aa1121835d8c7f8d670e8933bf Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sun, 22 Feb 2015 11:02:15 +0100 Subject: [PATCH] Avoid @backupGlobals in ExtensionRegistryTest Change-Id: Ia2c764b1c1ee8cff64e1ccdb863e5ef7534a286a --- .../registration/ExtensionRegistryTest.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/includes/registration/ExtensionRegistryTest.php b/tests/phpunit/includes/registration/ExtensionRegistryTest.php index f73e5eace6..1b24628c6b 100644 --- a/tests/phpunit/includes/registration/ExtensionRegistryTest.php +++ b/tests/phpunit/includes/registration/ExtensionRegistryTest.php @@ -5,14 +5,20 @@ class ExtensionRegistryTest extends MediaWikiTestCase { /** * @covers ExtensionRegistry::exportExtractedData * @dataProvider provideExportExtractedDataGlobals - * @backupGlobals enabled */ public function testExportExtractedDataGlobals( $desc, $before, $globals, $expected ) { + // Set globals for test if ( $before ) { foreach ( $before as $key => $value ) { - $GLOBALS[$key] = $value; + // mw prefixed globals does not exist normally + if ( substr( $key, 0, 2 ) == 'mw' ) { + $GLOBALS[$key] = $value; + } else { + $this->setMwGlobals( $key, $value ); + } } } + $info = array( 'globals' => $globals, 'callbacks' => array(), @@ -29,6 +35,15 @@ class ExtensionRegistryTest extends MediaWikiTestCase { $this->assertArrayHasKey( $name, $GLOBALS, $desc ); $this->assertEquals( $value, $GLOBALS[$name], $desc ); } + + // Remove mw prefixed globals + if ( $before ) { + foreach ( $before as $key => $value ) { + if ( substr( $key, 0, 2 ) == 'mw' ) { + unset( $GLOBALS[$key] ); + } + } + } } public static function provideExportExtractedDataGlobals() { -- 2.20.1