aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormainframe98 <k.s.werf@hotmail.com>2023-07-19 09:22:29 +0200
committermainframe98 <k.s.werf@hotmail.com>2023-07-19 09:23:52 +0200
commitec28fcb09e709015eaefe01ec2a43d88e95a6880 (patch)
treeeadfaedc8e46743882b17c1c0076dc92511bbb6e
parent516b227bba9fe63ff375439fea5ac4a3e6b9ad32 (diff)
downloadmediawikicore-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.php12
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();
}
/**