Skip to content

Commit

Permalink
Use @backupGlobals to backup $_SERVER (#44911)
Browse files Browse the repository at this point in the history
  • Loading branch information
voronkovich authored Feb 15, 2025
1 parent b5104a9 commit a1bdc9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
13 changes: 2 additions & 11 deletions tests/Unit/Libraries/Cms/Environment/BrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,11 @@
* Test class for JBrowser.
*
* @since 4.0.0
*
* @backupGlobals enabled
*/
class BrowserTest extends UnitTestCase
{
/**
* Backup of the SERVER superglobal
*
* @var array
*
* @return void
*
* @since 4.0.0
*/
protected $backupServer;

/**
* Object being tested
*
Expand Down
13 changes: 2 additions & 11 deletions tests/Unit/Libraries/Cms/Uri/UriTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* @package Joomla.UnitTest
* @subpackage Uri
* @since 1.7.0
*
* @backupGlobals enabled
*/
class UriTest extends UnitTestCase
{
Expand All @@ -27,14 +29,6 @@ class UriTest extends UnitTestCase
*/
protected $object;

/**
* Backup of the SERVER superglobal
*
* @var array
* @since 3.6
*/
protected $backupServer;

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
Expand All @@ -46,7 +40,6 @@ class UriTest extends UnitTestCase
protected function setUp(): void
{
parent::setUp();
$this->backupServer = $_SERVER;
Uri::reset();

$_SERVER['HTTP_HOST'] = 'www.example.com:80';
Expand All @@ -68,8 +61,6 @@ protected function setUp(): void
*/
protected function tearDown(): void
{
$_SERVER = $this->backupServer;
unset($this->backupServer);
unset($this->object);
parent::tearDown();
}
Expand Down

0 comments on commit a1bdc9b

Please sign in to comment.