diff options
author | mainframe98 <k.s.werf@hotmail.com> | 2023-07-19 09:22:29 +0200 |
---|---|---|
committer | mainframe98 <k.s.werf@hotmail.com> | 2023-07-19 09:23:52 +0200 |
commit | ec28fcb09e709015eaefe01ec2a43d88e95a6880 (patch) | |
tree | eadfaedc8e46743882b17c1c0076dc92511bbb6e | |
parent | 516b227bba9fe63ff375439fea5ac4a3e6b9ad32 (diff) | |
download | mediawikicore-ec28fcb09e709015eaefe01ec2a43d88e95a6880.tar.gz mediawikicore-ec28fcb09e709015eaefe01ec2a43d88e95a6880.zip |
tests: Prevent leaking $_SERVER in RequestFromGlobalsTest
These tests modified $_SERVER, but did not restore it afterwards,
which caused trouble for MediaWikiTest.
Bug: T342192
Change-Id: If8084381b91f2a79fdaaf6d96dbf5fe625410297
-rw-r--r-- | tests/phpunit/includes/Rest/RequestFromGlobalsTest.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/phpunit/includes/Rest/RequestFromGlobalsTest.php b/tests/phpunit/includes/Rest/RequestFromGlobalsTest.php index 2106551d7dcd..351387bed074 100644 --- a/tests/phpunit/includes/Rest/RequestFromGlobalsTest.php +++ b/tests/phpunit/includes/Rest/RequestFromGlobalsTest.php @@ -14,9 +14,21 @@ class RequestFromGlobalsTest extends MediaWikiIntegrationTestCase { */ private $reqFromGlobals; + /** + * @var array + */ + private $oldServer; + protected function setUp(): void { parent::setUp(); $this->reqFromGlobals = new RequestFromGlobals(); + + $this->oldServer = $_SERVER; + } + + protected function tearDown(): void { + $_SERVER = $this->oldServer; + parent::tearDown(); } /** |