MediaWiki  1.28.1
/home/jenkins/workspace/mediawiki-core-doxygen-publish/src/tests/phpunit/MediaWikiTestCase.php

Sets a global, maintaining a stashed version of the previous global to be restored in tearDownThe key is added to the array of globals that will be reset afterwards in the tearDown().

protected function setUp() { $this->setMwGlobals( 'wgRestrictStuff', true ); }

function testFoo() {}

function testBar() {} $this->assertTrue( self::getX()->doStuff() );

$this->setMwGlobals( 'wgRestrictStuff', false ); $this->assertTrue( self::getX()->doStuff() ); }

function testQuux() {}

Parameters
array | string$pairsKey to the global variable, or an array of key/value pairs.
mixed$valueValue to set the global to (ignored if an array is given as first argument).
Note
To allow changes to global variables to take effect on global service instances, call overrideMwServices().
Since
1.21