Skip to content

Commit a1bdc9b

Browse files
authored
Use @backupGlobals to backup $_SERVER (#44911)
1 parent b5104a9 commit a1bdc9b

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

tests/Unit/Libraries/Cms/Environment/BrowserTest.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,11 @@
1717
* Test class for JBrowser.
1818
*
1919
* @since 4.0.0
20+
*
21+
* @backupGlobals enabled
2022
*/
2123
class BrowserTest extends UnitTestCase
2224
{
23-
/**
24-
* Backup of the SERVER superglobal
25-
*
26-
* @var array
27-
*
28-
* @return void
29-
*
30-
* @since 4.0.0
31-
*/
32-
protected $backupServer;
33-
3425
/**
3526
* Object being tested
3627
*

tests/Unit/Libraries/Cms/Uri/UriTest.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* @package Joomla.UnitTest
2020
* @subpackage Uri
2121
* @since 1.7.0
22+
*
23+
* @backupGlobals enabled
2224
*/
2325
class UriTest extends UnitTestCase
2426
{
@@ -27,14 +29,6 @@ class UriTest extends UnitTestCase
2729
*/
2830
protected $object;
2931

30-
/**
31-
* Backup of the SERVER superglobal
32-
*
33-
* @var array
34-
* @since 3.6
35-
*/
36-
protected $backupServer;
37-
3832
/**
3933
* Sets up the fixture, for example, opens a network connection.
4034
* This method is called before a test is executed.
@@ -46,7 +40,6 @@ class UriTest extends UnitTestCase
4640
protected function setUp(): void
4741
{
4842
parent::setUp();
49-
$this->backupServer = $_SERVER;
5043
Uri::reset();
5144

5245
$_SERVER['HTTP_HOST'] = 'www.example.com:80';
@@ -68,8 +61,6 @@ protected function setUp(): void
6861
*/
6962
protected function tearDown(): void
7063
{
71-
$_SERVER = $this->backupServer;
72-
unset($this->backupServer);
7364
unset($this->object);
7465
parent::tearDown();
7566
}

0 commit comments

Comments
 (0)