Skip to content

Commit 41c1d2b

Browse files
committed
Fix some failing tests
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent 58bd13f commit 41c1d2b

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

test/classes/Config/PageSettingsTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
namespace PhpMyAdmin\Tests\Config;
66

77
use PhpMyAdmin\Config\PageSettings;
8+
use PhpMyAdmin\ResponseRenderer;
89
use PhpMyAdmin\Tests\AbstractTestCase;
910
use PhpMyAdmin\UserPreferences;
11+
use PHPUnit\Framework\Attributes\BackupStaticProperties;
1012
use PHPUnit\Framework\Attributes\CoversClass;
13+
use ReflectionProperty;
1114

1215
#[CoversClass(PageSettings::class)]
1316
class PageSettingsTest extends AbstractTestCase
@@ -47,8 +50,11 @@ public function testShowGroupNonExistent(): void
4750
/**
4851
* Test showGroup with a known group name
4952
*/
53+
#[BackupStaticProperties(true)]
5054
public function testShowGroupBrowse(): void
5155
{
56+
(new ReflectionProperty(ResponseRenderer::class, 'instance'))->setValue(null, null);
57+
5258
$object = new PageSettings(new UserPreferences($GLOBALS['dbi']));
5359
$object->init('Browse');
5460

test/classes/Plugins/Auth/AuthenticationSignonTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use PhpMyAdmin\ResponseRenderer;
1111
use PhpMyAdmin\Tests\AbstractTestCase;
1212
use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseRendererStub;
13+
use PHPUnit\Framework\Attributes\BackupStaticProperties;
1314
use PHPUnit\Framework\Attributes\CoversClass;
1415
use ReflectionProperty;
1516
use Throwable;
@@ -55,8 +56,10 @@ protected function tearDown(): void
5556
unset($this->object);
5657
}
5758

59+
#[BackupStaticProperties(true)]
5860
public function testAuth(): void
5961
{
62+
(new ReflectionProperty(ResponseRenderer::class, 'instance'))->setValue(null, null);
6063
$GLOBALS['cfg']['Server']['SignonURL'] = '';
6164
$_REQUEST = [];
6265
ResponseRenderer::getInstance()->setAjax(false);
@@ -76,6 +79,7 @@ public function testAuth(): void
7679
$this->assertStringContainsString('You must set SignonURL!', $result);
7780
}
7881

82+
#[BackupStaticProperties(true)]
7983
public function testAuthLogoutURL(): void
8084
{
8185
$responseStub = new ResponseRendererStub();
@@ -91,6 +95,7 @@ public function testAuthLogoutURL(): void
9195
$this->assertSame(302, $response->getStatusCode());
9296
}
9397

98+
#[BackupStaticProperties(true)]
9499
public function testAuthLogout(): void
95100
{
96101
$responseStub = new ResponseRendererStub();
@@ -139,6 +144,7 @@ public function testAuthCheckSession(): void
139144
$this->assertEquals('https://example.com/SignonURL', $_SESSION['LAST_SIGNON_URL']);
140145
}
141146

147+
#[BackupStaticProperties(true)]
142148
public function testAuthCheckToken(): void
143149
{
144150
$_SESSION = [' PMA_token ' => 'eefefef'];

0 commit comments

Comments
 (0)