Merge #20039 Major cleanup of config

The commit "Remove ldi_local_option setting" was removed.

Closes #20039

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
This commit is contained in:
Maurício Meneghini Fauth 2026-02-03 10:08:59 -03:00
commit 0cc19558ff
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
68 changed files with 129 additions and 309 deletions

View File

@ -313,13 +313,7 @@ parameters:
path: src/Config.php
-
message: '#^Property PhpMyAdmin\\Config\:\:\$settings \(array\{PmaAbsoluteUri\: string, AuthLog\: string, AuthLogSuccess\: bool, PmaNoRelation_DisableWarning\: bool, SuhosinDisableWarning\: bool, LoginCookieValidityDisableWarning\: bool, ReservedWordDisableWarning\: bool, TranslationWarningThreshold\: int, \.\.\.\}\) does not accept array\.$#'
identifier: assign.propertyType
count: 1
path: src/Config.php
-
message: '#^Property PhpMyAdmin\\Config\:\:\$settings \(array\{PmaAbsoluteUri\: string, AuthLog\: string, AuthLogSuccess\: bool, PmaNoRelation_DisableWarning\: bool, SuhosinDisableWarning\: bool, LoginCookieValidityDisableWarning\: bool, ReservedWordDisableWarning\: bool, TranslationWarningThreshold\: int, \.\.\.\}\) does not accept non\-empty\-array\<string, mixed\>\.$#'
message: '#^Property PhpMyAdmin\\Config\:\:\$settings \(array\{PmaAbsoluteUri\: string, AuthLog\: string, AuthLogSuccess\: bool, PmaNoRelation_DisableWarning\: bool, SuhosinDisableWarning\: bool, LoginCookieValidityDisableWarning\: bool, ReservedWordDisableWarning\: bool, TranslationWarningThreshold\: int, \.\.\.\}\) does not accept array\<mixed\>\.$#'
identifier: assign.propertyType
count: 1
path: src/Config.php
@ -951,12 +945,6 @@ parameters:
count: 5
path: src/Config/UserPreferencesHandler.php
-
message: '#^Cannot access offset ''userprefs_mtime'' on mixed\.$#'
identifier: offsetAccess.nonOffsetAccessible
count: 2
path: src/Config/UserPreferencesHandler.php
-
message: '#^Cannot access offset ''userprefs_type'' on mixed\.$#'
identifier: offsetAccess.nonOffsetAccessible
@ -1011,12 +999,6 @@ parameters:
count: 1
path: src/Config/UserPreferencesHandler.php
-
message: '#^Property PhpMyAdmin\\Config\:\:\$settings \(array\{PmaAbsoluteUri\: string, AuthLog\: string, AuthLogSuccess\: bool, PmaNoRelation_DisableWarning\: bool, SuhosinDisableWarning\: bool, LoginCookieValidityDisableWarning\: bool, ReservedWordDisableWarning\: bool, TranslationWarningThreshold\: int, \.\.\.\}\) does not accept array\<mixed\>\.$#'
identifier: assign.propertyType
count: 1
path: src/Config/UserPreferencesHandler.php
-
message: '#^Property PhpMyAdmin\\Config\\UserPreferencesHandler\:\:\$storageType \(''''\|''db''\|''session''\) does not accept mixed\.$#'
identifier: assign.propertyType
@ -13809,15 +13791,6 @@ parameters:
count: 1
path: tests/test_data/config.inc.php
-
message: '''
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
Use dependency injection instead\.$#
'''
identifier: staticMethod.deprecated
count: 1
path: tests/unit/AbstractTestCase.php
-
message: '''
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Dbal\\DatabaseInterface\:
@ -14301,15 +14274,6 @@ parameters:
count: 5
path: tests/unit/ConfigStorage/RelationTest.php
-
message: '''
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
Use dependency injection instead\.$#
'''
identifier: staticMethod.deprecated
count: 1
path: tests/unit/ConfigTest.php
-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertArrayHasKey\(\) with ''Server'' and array\{PmaAbsoluteUri\: string, AuthLog\: string, AuthLogSuccess\: bool, PmaNoRelation_DisableWarning\: bool, SuhosinDisableWarning\: bool, LoginCookieValidityDisableWarning\: bool, ReservedWordDisableWarning\: bool, TranslationWarningThreshold\: int, \.\.\.\} will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
@ -16851,12 +16815,6 @@ parameters:
count: 1
path: tests/unit/TwoFactorTest.php
-
message: '#^Missing call to parent\:\:tearDown\(\) method\.$#'
identifier: phpunit.callParent
count: 1
path: tests/unit/TwoFactorTest.php
-
message: '#^Parameter \#1 \$secret of method PragmaRX\\Google2FA\\Google2FA\:\:oathTotp\(\) expects string, mixed given\.$#'
identifier: argument.type
@ -16921,7 +16879,7 @@ parameters:
path: tests/unit/UtilTest.php
-
message: '#^Cannot access offset ''server_2'' on mixed\.$#'
message: '#^Cannot access offset ''server_2_'' on mixed\.$#'
identifier: offsetAccess.nonOffsetAccessible
count: 4
path: tests/unit/UtilTest.php
@ -16932,12 +16890,6 @@ parameters:
count: 2
path: tests/unit/UtilTest.php
-
message: '#^Property PhpMyAdmin\\Config\:\:\$selectedServer \(array\{host\: string, port\: string, socket\: string, ssl\: bool, ssl_key\: string\|null, ssl_cert\: string\|null, ssl_ca\: string\|null, ssl_ca_path\: string\|null, \.\.\.\}\) does not accept array\{host\: string, port\: string, socket\: string, ssl\: bool, ssl_key\: string\|null, ssl_cert\: string\|null, ssl_ca\: string\|null, ssl_ca_path\: string\|null, \.\.\.\}\.$#'
identifier: assign.propertyType
count: 1
path: tests/unit/UtilTest.php
-
message: '''
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
@ -16999,7 +16951,7 @@ parameters:
path: tests/unit/Utils/SessionCacheTest.php
-
message: '#^Cannot access offset ''server_2'' on mixed\.$#'
message: '#^Cannot access offset ''server_2_'' on mixed\.$#'
identifier: offsetAccess.nonOffsetAccessible
count: 4
path: tests/unit/Utils/SessionCacheTest.php
@ -17028,12 +16980,6 @@ parameters:
count: 2
path: tests/unit/Utils/SessionCacheTest.php
-
message: '#^Property PhpMyAdmin\\Config\:\:\$selectedServer \(array\{host\: string, port\: string, socket\: string, ssl\: bool, ssl_key\: string\|null, ssl_cert\: string\|null, ssl_ca\: string\|null, ssl_ca_path\: string\|null, \.\.\.\}\) does not accept array\{host\: string, port\: string, socket\: string, ssl\: bool, ssl_key\: string\|null, ssl_cert\: string\|null, ssl_ca\: string\|null, ssl_ca_path\: string\|null, \.\.\.\}\.$#'
identifier: assign.propertyType
count: 5
path: tests/unit/Utils/SessionCacheTest.php
-
message: '''
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:

View File

@ -118,15 +118,15 @@
<code><![CDATA[$this->settings]]></code>
<code><![CDATA[$this->settings]]></code>
</InvalidPropertyAssignmentValue>
<MixedAssignment>
<code><![CDATA[$array[$part]]]></code>
</MixedAssignment>
<MixedPropertyTypeCoercion>
<code><![CDATA[array_replace_recursive($this->settings, $this->config->asArray())]]></code>
<code><![CDATA[$this->settings]]></code>
</MixedPropertyTypeCoercion>
<PossiblyInvalidArrayOffset>
<code><![CDATA[$_COOKIE[$this->getCookieName($cookieName)]]]></code>
</PossiblyInvalidArrayOffset>
<PropertyTypeCoercion>
<code><![CDATA[$this->settings]]></code>
</PropertyTypeCoercion>
<RiskyTruthyFalsyComparison>
<code><![CDATA[empty($path)]]></code>
</RiskyTruthyFalsyComparison>
@ -420,7 +420,6 @@
<MixedArrayAccess>
<code><![CDATA[$_SESSION['cache'][$cacheKey]['userprefs']]]></code>
<code><![CDATA[$_SESSION['cache'][$cacheKey]['userprefs']['LoginCookieValidity']]]></code>
<code><![CDATA[$_SESSION['cache'][$cacheKey]['userprefs_mtime']]]></code>
<code><![CDATA[$_SESSION['cache'][$cacheKey]['userprefs_type']]]></code>
<code><![CDATA[$configData['lang']]]></code>
</MixedArrayAccess>
@ -428,10 +427,8 @@
<code><![CDATA[$_SESSION['cache'][$cacheKey]]]></code>
<code><![CDATA[$_SESSION['cache'][$cacheKey]]]></code>
<code><![CDATA[$_SESSION['cache'][$cacheKey]]]></code>
<code><![CDATA[$_SESSION['cache'][$cacheKey]]]></code>
<code><![CDATA[$_SESSION['cache'][$cacheKey]['config_mtime']]]></code>
<code><![CDATA[$_SESSION['cache'][$cacheKey]['userprefs']]]></code>
<code><![CDATA[$_SESSION['cache'][$cacheKey]['userprefs_mtime']]]></code>
<code><![CDATA[$_SESSION['cache'][$cacheKey]['userprefs_type']]]></code>
</MixedArrayAssignment>
<MixedAssignment>
@ -442,7 +439,6 @@
<code><![CDATA[$value]]></code>
</MixedAssignment>
<MixedPropertyTypeCoercion>
<code><![CDATA[$this->config->settings]]></code>
<code><![CDATA[array_replace_recursive($this->config->settings, $configData)]]></code>
</MixedPropertyTypeCoercion>
<PossiblyInvalidArgument>
@ -8792,9 +8788,6 @@
</TypeDoesNotContainNull>
</file>
<file src="tests/unit/AbstractTestCase.php">
<DeprecatedMethod>
<code><![CDATA[Config::getInstance()]]></code>
</DeprecatedMethod>
<PossiblyUndefinedArrayOffset>
<code><![CDATA[$_SERVER['PHP_SELF']]]></code>
<code><![CDATA[$_SERVER['REQUEST_TIME']]]></code>
@ -9151,9 +9144,6 @@
</TypeDoesNotContainType>
</file>
<file src="tests/unit/ConfigTest.php">
<DeprecatedMethod>
<code><![CDATA[Config::getInstance()]]></code>
</DeprecatedMethod>
<InvalidArrayOffset>
<code><![CDATA[$config->settings['Server']]]></code>
<code><![CDATA[$config->settings['Server']]]></code>
@ -10836,20 +10826,17 @@
<code><![CDATA[Config::getInstance()]]></code>
<code><![CDATA[Config::getInstance()]]></code>
</DeprecatedMethod>
<InvalidPropertyAssignmentValue>
<code><![CDATA[Config::getInstance()->selectedServer]]></code>
</InvalidPropertyAssignmentValue>
<MixedArgument>
<code><![CDATA[$_SESSION['cache']['server_2']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2_']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2_']]]></code>
</MixedArgument>
<MixedArrayAccess>
<code><![CDATA[$_SESSION['cache']['server_2']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2']['is_superuser']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2']['mysql_cur_user']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2_']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2_']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2_']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2_']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2_']['is_superuser']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2_']['mysql_cur_user']]]></code>
</MixedArrayAccess>
<PossiblyInvalidArgument>
<code><![CDATA[testBackquote]]></code>
@ -10922,24 +10909,17 @@
<code><![CDATA[$_SESSION['cache']]]></code>
<code><![CDATA[$_SESSION['cache']]]></code>
</EmptyArrayAccess>
<InvalidPropertyAssignmentValue>
<code><![CDATA[Config::getInstance()->selectedServer]]></code>
<code><![CDATA[Config::getInstance()->selectedServer]]></code>
<code><![CDATA[Config::getInstance()->selectedServer]]></code>
<code><![CDATA[Config::getInstance()->selectedServer]]></code>
<code><![CDATA[Config::getInstance()->selectedServer]]></code>
</InvalidPropertyAssignmentValue>
<MixedArgument>
<code><![CDATA[$_SESSION['cache']['server_2']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2_']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2_']]]></code>
</MixedArgument>
<MixedArrayAccess>
<code><![CDATA[$_SESSION['cache']['server_2']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2']['test_data']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2']['test_data_3']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2_']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2_']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2_']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2_']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2_']['test_data']]]></code>
<code><![CDATA[$_SESSION['cache']['server_2_']['test_data_3']]]></code>
</MixedArrayAccess>
</file>
<file src="tests/unit/VersionInformationTest.php">

View File

@ -13,7 +13,7 @@ use Throwable;
use function __;
use function array_key_last;
use function array_replace_recursive;
use function array_shift;
use function array_slice;
use function count;
use function defined;
@ -68,9 +68,6 @@ class Config
{
public static self|null $instance = null;
/** @var mixed[] default configuration settings */
public array $default;
/** @var mixed[] configuration settings, without user preferences applied */
public array $baseSettings;
@ -102,7 +99,6 @@ class Config
{
$this->config = new Settings([]);
$config = $this->config->asArray();
$this->default = $config;
$this->settings = $config;
$this->baseSettings = $config;
$this->selectedServer = (new Server())->asArray();
@ -208,7 +204,7 @@ class Config
}
$this->config = new Settings($cfg);
$this->settings = array_replace_recursive($this->settings, $this->config->asArray());
$this->settings = $this->config->asArray();
}
/**
@ -288,15 +284,44 @@ class Config
*
* @param string $setting configuration option
* @param mixed $value new value for configuration option
*
* @throws ConfigException
*/
public function set(string $setting, mixed $value): void
{
if (isset($this->settings[$setting]) && $this->settings[$setting] === $value) {
$parts = explode('/', $setting);
if (! $this->setValueRecursive($this->settings, $parts, $value)) {
return;
}
$this->settings[$setting] = $value;
$this->config = new Settings($this->settings);
$this->settings = $this->config->asArray();
}
/**
* @param mixed[] $array
* @param array-key[] $parts
*
* @throws ConfigException
*/
private function setValueRecursive(array &$array, array $parts, mixed $value): bool
{
$part = array_shift($parts);
if ($parts === []) {
if ($array[$part] === $value) {
return false;
}
$array[$part] = $value;
return true;
}
if (! is_array($array[$part])) {
throw new ConfigException('Failed to set configuration value.');
}
return $this->setValueRecursive($array[$part], $parts, $value);
}
/**

View File

@ -3920,10 +3920,10 @@ final class Settings
}
return match ($settings['NavigationTreeDefaultTabTable']) {
'sql', 'tbl_sql.php' => '/table/sql',
'search', 'tbl_select.php' => '/table/search',
'insert', 'tbl_change.php' => '/table/change',
'browse', 'sql.php' => '/sql',
'sql', 'tbl_sql.php', '/table/sql' => '/table/sql',
'search', 'tbl_select.php', '/table/search' => '/table/search',
'insert', 'tbl_change.php', '/table/change' => '/table/change',
'browse', 'sql.php', '/sql' => '/sql',
default => '/table/structure',
};
}
@ -3940,11 +3940,11 @@ final class Settings
}
return match ($settings['NavigationTreeDefaultTabTable2']) {
'structure', 'tbl_structure.php' => '/table/structure',
'sql', 'tbl_sql.php' => '/table/sql',
'search', 'tbl_select.php' => '/table/search',
'insert', 'tbl_change.php' => '/table/change',
'browse', 'sql.php' => '/sql',
'structure', 'tbl_structure.php', '/table/structure' => '/table/structure',
'sql', 'tbl_sql.php', '/table/sql' => '/table/sql',
'search', 'tbl_select.php', '/table/search' => '/table/search',
'insert', 'tbl_change.php', '/table/change' => '/table/change',
'browse', 'sql.php', '/sql' => '/sql',
default => '',
};
}
@ -4520,10 +4520,10 @@ final class Settings
}
return match ($settings['DefaultTabServer']) {
'databases', 'server_databases.php' => '/server/databases',
'status', 'server_status.php' => '/server/status',
'variables', 'server_variables.php' => '/server/variables',
'privileges', 'server_privileges.php' => '/server/privileges',
'databases', 'server_databases.php', '/server/databases' => '/server/databases',
'status', 'server_status.php', '/server/status' => '/server/status',
'variables', 'server_variables.php', '/server/variables' => '/server/variables',
'privileges', 'server_privileges.php', '/server/privileges' => '/server/privileges',
default => '/',
};
}
@ -4540,9 +4540,9 @@ final class Settings
}
return match ($settings['DefaultTabDatabase']) {
'sql', 'db_sql.php' => '/database/sql',
'search', 'db_search.php' => '/database/search',
'operations', 'db_operations.php' => '/database/operations',
'sql', 'db_sql.php', '/database/sql' => '/database/sql',
'search', 'db_search.php', '/database/search' => '/database/search',
'operations', 'db_operations.php', '/database/operations' => '/database/operations',
default => '/database/structure',
};
}
@ -4559,10 +4559,10 @@ final class Settings
}
return match ($settings['DefaultTabTable']) {
'structure', 'tbl_structure.php' => '/table/structure',
'sql', 'tbl_sql.php' => '/table/sql',
'search', 'tbl_select.php' => '/table/search',
'insert', 'tbl_change.php' => '/table/change',
'structure', 'tbl_structure.php', '/table/structure' => '/table/structure',
'sql', 'tbl_sql.php', '/table/sql' => '/table/sql',
'search', 'tbl_select.php', '/table/search' => '/table/search',
'insert', 'tbl_change.php', '/table/change' => '/table/change',
default => '/sql',
};
}

View File

@ -21,6 +21,9 @@ class UserPreferencesHandler
/** @var ''|'db'|'session' */
public string $storageType = '';
/** @var mixed[] default configuration settings */
public array $defaultSettings;
public function __construct(
private readonly Config $config,
private readonly DatabaseInterface $dbi,
@ -28,6 +31,7 @@ class UserPreferencesHandler
private readonly LanguageManager $languageManager,
private readonly ThemeManager $themeManager,
) {
$this->defaultSettings = (new Settings([]))->asArray();
}
/**
@ -45,7 +49,6 @@ class UserPreferencesHandler
) {
$prefs = $this->userPreferences->load();
$_SESSION['cache'][$cacheKey]['userprefs'] = $this->userPreferences->apply($prefs['config_data']);
$_SESSION['cache'][$cacheKey]['userprefs_mtime'] = $prefs['mtime'];
$_SESSION['cache'][$cacheKey]['userprefs_type'] = $prefs['type'];
$_SESSION['cache'][$cacheKey]['config_mtime'] = $this->config->sourceMtime;
}
@ -58,7 +61,6 @@ class UserPreferencesHandler
$configData = $_SESSION['cache'][$cacheKey]['userprefs'];
// type is 'db' or 'session'
$this->storageType = $_SESSION['cache'][$cacheKey]['userprefs_type'];
$this->config->set('user_preferences_mtime', $_SESSION['cache'][$cacheKey]['userprefs_mtime']);
if (isset($configData['Server']) && is_array($configData['Server'])) {
$serverConfig = array_replace_recursive($this->config->selectedServer, $configData['Server']);
@ -165,7 +167,7 @@ class UserPreferencesHandler
// use permanent user preferences if possible
if ($this->storageType !== '') {
if ($defaultValue === null) {
$defaultValue = Core::arrayRead($cfgPath, $this->config->default);
$defaultValue = Core::arrayRead($cfgPath, $this->defaultSettings);
}
$result = $this->userPreferences->persistOption($cfgPath, $newCfgValue, $defaultValue);
@ -180,7 +182,7 @@ class UserPreferencesHandler
$this->config->setCookie($cookieName, (string) $newCfgValue, $defaultValue);
}
Core::arrayWrite($cfgPath, $this->config->settings, $newCfgValue);
$this->config->set($cfgPath, $newCfgValue);
return $result;
}

View File

@ -39,11 +39,9 @@ final readonly class UserPasswordController implements InvocableController
* Displays an error message and exits if the user isn't allowed to use this
* script
*/
if (! $this->config->settings['ShowChgPassword']) {
$this->config->settings['ShowChgPassword'] = $this->dbi->selectDb('mysql');
}
$hasAccessPrivilege = $this->config->config->ShowChgPassword || $this->dbi->selectDb('mysql');
if ($this->config->selectedServer['auth_type'] === 'config' || ! $this->config->settings['ShowChgPassword']) {
if ($this->config->selectedServer['auth_type'] === 'config' || ! $hasAccessPrivilege) {
$this->response->addHTML(Message::error(
__('You don\'t have sufficient privileges to be here right now!'),
)->getDisplay());

View File

@ -176,9 +176,6 @@ class ThemeManager
$this->theme->getColorMode(),
$this->theme->getColorModes()[0],
);
// force a change of a dummy session variable to avoid problems
// with the caching of phpmyadmin.css.php
$config->set('theme-update', $this->theme->id);
}
public function loadThemes(): void

View File

@ -14,11 +14,8 @@ final class SessionCache
$key = 'server_' . Current::$server;
$config = Config::getInstance();
if (isset($config->selectedServer['user'])) {
return $key . '_' . $config->selectedServer['user'];
}
return $key;
return $key . '_' . $config->selectedServer['user'];
}
public static function has(string $name): bool

View File

@ -65,7 +65,6 @@ abstract class AbstractTestCase extends TestCase
ExportSql::$noConstraintsComments = false;
// Config before DBI
$this->setGlobalConfig();
Cache::purge();
Tracker::disable();
@ -85,22 +84,6 @@ abstract class AbstractTestCase extends TestCase
return new DbiDummy();
}
protected function createConfig(): Config
{
$config = new Config();
$config->loadFromFile();
return $config;
}
protected function setGlobalConfig(): void
{
Config::$instance = null;
$config = Config::getInstance();
$config->loadFromFile();
$config->set('environment', 'development');
}
protected function setLanguage(string $code = 'en'): void
{
Current::$lang = $code;

View File

@ -20,8 +20,6 @@ class AdvisorTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
DatabaseInterface::$instance = $this->createDatabaseInterface();
}

View File

@ -24,8 +24,7 @@ final class BookmarkRepositoryTest extends AbstractTestCase
]);
(new ReflectionProperty(Relation::class, 'cache'))->setValue(null, $relationParameters);
$dbi = $this->createDatabaseInterface();
$config = Config::$instance = new Config();
$bookmarkRepository = new BookmarkRepository($dbi, new Relation($dbi, $config));
$bookmarkRepository = new BookmarkRepository($dbi, new Relation($dbi, new Config()));
$bookmark = $bookmarkRepository->createBookmark('SELECT "phpmyadmin"', 'bookmark1', 'root', 'phpmyadmin');
self::assertNotFalse($bookmark);
self::assertSame(0, $bookmark->getId());

View File

@ -20,13 +20,6 @@ use function in_array;
#[RunTestsInSeparateProcesses]
class DescriptionTest extends AbstractTestCase
{
protected function setUp(): void
{
parent::setUp();
$this->setGlobalConfig();
}
/**
* @param string $item item
* @param string $type type

View File

@ -25,7 +25,7 @@ class FormDisplayTemplateTest extends AbstractTestCase
$this->setLanguage();
$this->config = $this->createConfig();
$this->config = new Config();
$this->formDisplayTemplate = new FormDisplayTemplate($this->config);
}

View File

@ -31,8 +31,6 @@ class FormDisplayTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
Current::$server = 2;
$this->object = new FormDisplay(new ConfigFile());
Form::resetGroupCounter();

View File

@ -28,8 +28,6 @@ class FormTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->object = new Form(
'pma_form_name',
['pma_form1', 'pma_form2'],

View File

@ -24,13 +24,6 @@ use PHPUnit\Framework\Attributes\DataProvider;
#[CoversClass(UserFormList::class)]
class FormListTest extends AbstractTestCase
{
protected function setUp(): void
{
parent::setUp();
$this->setGlobalConfig();
}
/**
* Tests for preferences forms.
*

View File

@ -4,7 +4,6 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Config\Forms\Setup;
use PhpMyAdmin\Config;
use PhpMyAdmin\Config\ConfigFile;
use PhpMyAdmin\Config\Form;
use PhpMyAdmin\Config\FormDisplay;
@ -22,8 +21,6 @@ final class FeaturesFormTest extends AbstractTestCase
public function testRegisteredForms(): void
{
Form::resetGroupCounter();
$config = new Config();
Config::$instance = $config;
$featuresForm = new FeaturesForm(new ConfigFile([]), 1);
self::assertSame('Features', FeaturesForm::getName());

View File

@ -30,8 +30,6 @@ class PageSettingsTest extends AbstractTestCase
$this->setLanguage();
$this->setGlobalConfig();
DatabaseInterface::$instance = $this->createDatabaseInterface();
Current::$database = 'db';
Current::$table = '';

View File

@ -30,8 +30,6 @@ class ServerConfigChecksTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->configFile = new ConfigFile();
$reflection = new ReflectionProperty(ConfigFile::class, 'id');

View File

@ -29,8 +29,8 @@ final class UserPreferencesHandlerTest extends AbstractTestCase
new LanguageManager($config),
new ThemeManager(),
);
$userPreferencesHandler->setUserValue(null, 'lang', 'cs', 'en');
$userPreferencesHandler->setUserValue('TEST_COOKIE_USER_VAL', '', 'cfg_val_1');
$userPreferencesHandler->setUserValue(null, 'Lang', 'cs', 'en');
$userPreferencesHandler->setUserValue('TEST_COOKIE_USER_VAL', 'Servers/1/hide_db', 'cfg_val_1');
self::assertSame('cfg_val_1', $userPreferencesHandler->getUserValue('TEST_COOKIE_USER_VAL', 'fail'));
$userPreferencesHandler->setUserValue(null, 'NavigationWidth', 300);
self::assertSame(300, $config->settings['NavigationWidth']);

View File

@ -4,7 +4,6 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Config;
use PhpMyAdmin\Config;
use PhpMyAdmin\Config\ConfigFile;
use PhpMyAdmin\Config\Validator;
use PhpMyAdmin\Tests\AbstractTestCase;
@ -15,7 +14,6 @@ final class ValidatorTest extends AbstractTestCase
{
public function testGetValidators(): void
{
Config::$instance = new Config();
$validator = new Validator(new ConfigFile([]));
$validators = $validator->getValidators();
$expected = [

View File

@ -26,7 +26,6 @@ use function tempnam;
use function unlink;
use const CHANGELOG_FILE;
use const CONFIG_FILE;
use const DIRECTORY_SEPARATOR;
use const PHP_OS;
@ -52,16 +51,20 @@ class ConfigTest extends AbstractTestCase
$this->object = $this->createConfig();
$_SESSION['git_location'] = '.git';
$_SESSION['is_git_revision'] = true;
Config::$instance = null;
$config = Config::getInstance();
$config->loadFromFile(CONFIG_FILE);
$config->settings['ProxyUrl'] = '';
//for testing file permissions
$this->permTestObj = new Config();
$this->permTestObj->loadFromFile(ROOT_PATH . 'config.sample.inc.php');
}
protected function createConfig(): Config
{
$config = new Config();
$config->loadFromFile();
return $config;
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
@ -159,7 +162,6 @@ class ConfigTest extends AbstractTestCase
$config = $settings->asArray();
self::assertIsArray($config['Servers']);
self::assertEquals($settings, $object->getSettings());
self::assertSame($config, $object->default);
self::assertSame($config, $object->settings);
self::assertSame($config, $object->baseSettings);
}

View File

@ -27,8 +27,6 @@ class BinlogControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->dummyDbi = $this->createDbiDummy();
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
DatabaseInterface::$instance = $this->dbi;

View File

@ -28,8 +28,6 @@ class CollationsControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->dummyDbi = $this->createDbiDummy();
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
DatabaseInterface::$instance = $this->dbi;

View File

@ -28,8 +28,6 @@ class DatabasesControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->dummyDbi = $this->createDbiDummy();
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
DatabaseInterface::$instance = $this->dbi;

View File

@ -28,8 +28,6 @@ class EnginesControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->dummyDbi = $this->createDbiDummy();
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
DatabaseInterface::$instance = $this->dbi;

View File

@ -30,8 +30,6 @@ class PluginsControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->dummyDbi = $this->createDbiDummy();
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
DatabaseInterface::$instance = $this->dbi;

View File

@ -30,8 +30,6 @@ class ShowEngineControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->dummyDbi = $this->createDbiDummy();
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
DatabaseInterface::$instance = $this->dbi;

View File

@ -29,8 +29,6 @@ class AdvisorControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
DatabaseInterface::$instance = $this->createDatabaseInterface();
$config = Config::getInstance();

View File

@ -30,8 +30,6 @@ class GeneralLogControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->dummyDbi = $this->createDbiDummy();
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
DatabaseInterface::$instance = $this->dbi;

View File

@ -30,8 +30,6 @@ class LogVarsControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->dummyDbi = $this->createDbiDummy();
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
DatabaseInterface::$instance = $this->dbi;

View File

@ -30,8 +30,6 @@ class SlowLogControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->dummyDbi = $this->createDbiDummy();
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
DatabaseInterface::$instance = $this->dbi;

View File

@ -31,8 +31,6 @@ class MonitorControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->dummyDbi = $this->createDbiDummy();
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
DatabaseInterface::$instance = $this->dbi;

View File

@ -31,8 +31,6 @@ class RefreshControllerTest extends AbstractTestCase
DatabaseInterface::$instance = $this->createDatabaseInterface();
$this->setGlobalConfig();
Current::$database = 'db';
Current::$table = 'table';
$config = Config::getInstance();

View File

@ -31,8 +31,6 @@ class ProcessesControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->dummyDbi = $this->createDbiDummy();
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
DatabaseInterface::$instance = $this->dbi;

View File

@ -34,8 +34,6 @@ class QueriesControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->dummyDbi = $this->createDbiDummy();
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
DatabaseInterface::$instance = $this->dbi;

View File

@ -29,8 +29,6 @@ class StatusControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->dummyDbi = $this->createDbiDummy();
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
DatabaseInterface::$instance = $this->dbi;

View File

@ -29,8 +29,6 @@ class VariablesControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->dummyDbi = $this->createDbiDummy();
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
DatabaseInterface::$instance = $this->dbi;

View File

@ -35,8 +35,6 @@ class VariablesControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->setLanguage();
Current::$database = 'db';

View File

@ -261,7 +261,7 @@ class AddFieldControllerTest extends AbstractTestCase
(new AddFieldController(
$response,
$transformations,
$this->createConfig(),
new Config(),
$dbi,
new ColumnsDefinition($dbi, $relation, $transformations),
new DbTableExists($dbi),

View File

@ -276,7 +276,7 @@ class CreateControllerTest extends AbstractTestCase
(new CreateController(
$response,
$transformations,
$this->createConfig(),
new Config(),
$dbi,
new ColumnsDefinition($dbi, $relation, $transformations),
new UserPrivilegesFactory($dbi),

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Table\Maintenance;
use PhpMyAdmin\Config;
use PhpMyAdmin\Controllers\Table\Maintenance\AnalyzeController;
use PhpMyAdmin\Dbal\DatabaseInterface;
use PhpMyAdmin\Http\ServerRequest;
@ -25,7 +26,7 @@ class AnalyzeControllerTest extends AbstractTestCase
$dbi = $this->createDatabaseInterface();
DatabaseInterface::$instance = $dbi;
$response = new ResponseRenderer();
$controller = new AnalyzeController($response, new Maintenance($dbi), $this->createConfig());
$controller = new AnalyzeController($response, new Maintenance($dbi), new Config());
$controller($request);
self::assertFalse($response->hasSuccessState());
self::assertSame(['message' => 'No table selected.'], $response->getJSONResult());

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Table\Maintenance;
use PhpMyAdmin\Config;
use PhpMyAdmin\Controllers\Table\Maintenance\CheckController;
use PhpMyAdmin\Dbal\DatabaseInterface;
use PhpMyAdmin\Http\ServerRequest;
@ -25,7 +26,7 @@ class CheckControllerTest extends AbstractTestCase
$dbi = $this->createDatabaseInterface();
DatabaseInterface::$instance = $dbi;
$response = new ResponseRenderer();
$controller = new CheckController($response, new Maintenance($dbi), $this->createConfig());
$controller = new CheckController($response, new Maintenance($dbi), new Config());
$controller($request);
self::assertFalse($response->hasSuccessState());
self::assertSame(['message' => 'No table selected.'], $response->getJSONResult());

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Table\Maintenance;
use PhpMyAdmin\Config;
use PhpMyAdmin\Controllers\Table\Maintenance\ChecksumController;
use PhpMyAdmin\Dbal\DatabaseInterface;
use PhpMyAdmin\Http\ServerRequest;
@ -25,7 +26,7 @@ class ChecksumControllerTest extends AbstractTestCase
$dbi = $this->createDatabaseInterface();
DatabaseInterface::$instance = $dbi;
$response = new ResponseRenderer();
$controller = new ChecksumController($response, new Maintenance($dbi), $this->createConfig());
$controller = new ChecksumController($response, new Maintenance($dbi), new Config());
$controller($request);
self::assertFalse($response->hasSuccessState());
self::assertSame(['message' => 'No table selected.'], $response->getJSONResult());

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Table\Maintenance;
use PhpMyAdmin\Config;
use PhpMyAdmin\Controllers\Table\Maintenance\OptimizeController;
use PhpMyAdmin\Dbal\DatabaseInterface;
use PhpMyAdmin\Http\ServerRequest;
@ -25,7 +26,7 @@ class OptimizeControllerTest extends AbstractTestCase
$dbi = $this->createDatabaseInterface();
DatabaseInterface::$instance = $dbi;
$response = new ResponseRenderer();
$controller = new OptimizeController($response, new Maintenance($dbi), $this->createConfig());
$controller = new OptimizeController($response, new Maintenance($dbi), new Config());
$controller($request);
self::assertFalse($response->hasSuccessState());
self::assertSame(['message' => 'No table selected.'], $response->getJSONResult());

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Table\Maintenance;
use PhpMyAdmin\Config;
use PhpMyAdmin\Controllers\Table\Maintenance\RepairController;
use PhpMyAdmin\Dbal\DatabaseInterface;
use PhpMyAdmin\Http\ServerRequest;
@ -25,7 +26,7 @@ class RepairControllerTest extends AbstractTestCase
$dbi = $this->createDatabaseInterface();
DatabaseInterface::$instance = $dbi;
$response = new ResponseRenderer();
$controller = new RepairController($response, new Maintenance($dbi), $this->createConfig());
$controller = new RepairController($response, new Maintenance($dbi), new Config());
$controller($request);
self::assertFalse($response->hasSuccessState());
self::assertSame(['message' => 'No table selected.'], $response->getJSONResult());

View File

@ -25,8 +25,6 @@ class OverviewControllerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
Current::$database = 'db';
Current::$table = 'table';
}

View File

@ -103,8 +103,6 @@ class CentralColumnsTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$config = Config::getInstance();
$config->selectedServer['user'] = 'pma_user';
$config->selectedServer['DisableIS'] = true;

View File

@ -24,8 +24,6 @@ class EventsTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->setLanguage();
DatabaseInterface::$instance = $this->createDatabaseInterface();

View File

@ -28,8 +28,6 @@ class RoutinesTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->setLanguage();
DatabaseInterface::$instance = $this->createDatabaseInterface();

View File

@ -73,8 +73,6 @@ class ResultsTest extends AbstractTestCase
$this->setLanguage();
$this->setGlobalConfig();
$this->dummyDbi = $this->createDbiDummy();
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
DatabaseInterface::$instance = $this->dbi;

View File

@ -35,8 +35,6 @@ class OptionsTest extends AbstractTestCase
$this->setLanguage();
$this->setGlobalConfig();
$dbi = $this->createDatabaseInterface();
DatabaseInterface::$instance = $dbi;
@ -56,13 +54,6 @@ class OptionsTest extends AbstractTestCase
$this->export = new Options($relation, new TemplateModel($dbi), $userPreferencesHandler);
}
protected function tearDown(): void
{
parent::tearDown();
Config::$instance = null;
}
public function testGetOptions(): void
{
$config = Config::getInstance();

View File

@ -34,8 +34,6 @@ class FooterTest extends AbstractTestCase
$this->setLanguage();
$this->setGlobalConfig();
DatabaseInterface::$instance = $this->createDatabaseInterface();
$_SERVER['SCRIPT_NAME'] = 'index.php';
Current::$database = '';

View File

@ -44,8 +44,6 @@ class HeaderTest extends AbstractTestCase
Current::$database = 'db';
Current::$table = '';
$this->setGlobalConfig();
$config = Config::getInstance();
$config->settings['Servers'] = [];
$config->selectedServer['DisableIS'] = false;

View File

@ -65,8 +65,6 @@ class InsertEditTest extends AbstractTestCase
$this->setLanguage();
$this->setGlobalConfig();
$this->dummyDbi = $this->createDbiDummy();
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
DatabaseInterface::$instance = $this->dbi;

View File

@ -28,8 +28,6 @@ class NavigationTreeTest extends AbstractTestCase
$this->setLanguage();
$this->setGlobalConfig();
$dbi = $this->createDatabaseInterface();
DatabaseInterface::$instance = $dbi;
$config = Config::getInstance();

View File

@ -12,16 +12,6 @@ use PHPUnit\Framework\Attributes\Large;
#[Large]
class PdfTest extends AbstractTestCase
{
/**
* SetUp for test cases
*/
protected function setUp(): void
{
parent::setUp();
$this->setGlobalConfig();
}
/**
* Test for Pdf::getPDFData
*/

View File

@ -32,8 +32,6 @@ class AuthenticationConfigTest extends AbstractTestCase
$this->setLanguage();
$this->setGlobalConfig();
DatabaseInterface::$instance = $this->createDatabaseInterface();
Current::$server = 2;
Current::$database = 'db';

View File

@ -52,8 +52,6 @@ class AuthenticationCookieTest extends AbstractTestCase
$this->setLanguage();
$this->setGlobalConfig();
DatabaseInterface::$instance = $this->createDatabaseInterface();
Current::$database = 'db';
Current::$table = 'table';

View File

@ -33,8 +33,6 @@ class AuthenticationHttpTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
DatabaseInterface::$instance = $this->createDatabaseInterface();
Config::getInstance()->settings['Servers'] = [];
Current::$database = 'db';

View File

@ -37,8 +37,6 @@ class AuthenticationSignonTest extends AbstractTestCase
$this->setLanguage();
$this->setGlobalConfig();
DatabaseInterface::$instance = $this->createDatabaseInterface();
Current::$database = 'db';
Current::$table = 'table';

View File

@ -31,8 +31,6 @@ class ConfigGeneratorTest extends AbstractTestCase
{
unset($_SESSION['eol']);
$this->setGlobalConfig();
Current::$server = 2;
$cf = new ConfigFile();
$_SESSION['ConfigFile2'] = ['a', 'b', 'c'];

View File

@ -19,8 +19,6 @@ class ThemeManagerTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
Current::$server = 99;
}

View File

@ -32,8 +32,6 @@ class ThemeTest extends AbstractTestCase
parent::setUp();
$this->object = new Theme();
$this->setGlobalConfig();
}
/**

View File

@ -26,8 +26,6 @@ class TriggersTest extends AbstractTestCase
{
parent::setUp();
$this->setGlobalConfig();
$this->setLanguage();
DatabaseInterface::$instance = $this->createDatabaseInterface();

View File

@ -61,6 +61,8 @@ class TwoFactorTest extends AbstractTestCase
protected function tearDown(): void
{
$this->dummyDbi->assertAllSelectsConsumed();
parent::tearDown();
}
private function initStorageConfigAndData(): void

View File

@ -104,17 +104,17 @@ class UtilTest extends AbstractTestCase
public function testClearUserCache(): void
{
Config::getInstance()->selectedServer['user'] = null;
Config::getInstance()->selectedServer['user'] = '';
Current::$server = 2;
SessionCache::set('is_superuser', 'yes');
self::assertSame('yes', $_SESSION['cache']['server_2']['is_superuser']);
self::assertSame('yes', $_SESSION['cache']['server_2_']['is_superuser']);
SessionCache::set('mysql_cur_user', 'mysql');
self::assertSame('mysql', $_SESSION['cache']['server_2']['mysql_cur_user']);
self::assertSame('mysql', $_SESSION['cache']['server_2_']['mysql_cur_user']);
Util::clearUserCache();
self::assertArrayNotHasKey('is_superuser', $_SESSION['cache']['server_2']);
self::assertArrayNotHasKey('mysql_cur_user', $_SESSION['cache']['server_2']);
self::assertArrayNotHasKey('is_superuser', $_SESSION['cache']['server_2_']);
self::assertArrayNotHasKey('mysql_cur_user', $_SESSION['cache']['server_2_']);
}
/**

View File

@ -16,7 +16,7 @@ class SessionCacheTest extends TestCase
public function testGet(): void
{
$_SESSION = [];
Config::getInstance()->selectedServer['user'] = null;
Config::getInstance()->selectedServer['user'] = '';
SessionCache::set('test_data', 5);
SessionCache::set('test_data_2', 5);
@ -29,35 +29,35 @@ class SessionCacheTest extends TestCase
public function testRemove(): void
{
$_SESSION = [];
Config::getInstance()->selectedServer['user'] = null;
Config::getInstance()->selectedServer['user'] = '';
Current::$server = 2;
SessionCache::set('test_data', 25);
SessionCache::set('test_data_2', 25);
SessionCache::remove('test_data');
self::assertArrayNotHasKey('test_data', $_SESSION['cache']['server_2']);
self::assertArrayNotHasKey('test_data', $_SESSION['cache']['server_2_']);
SessionCache::remove('test_data_2');
self::assertArrayNotHasKey('test_data_2', $_SESSION['cache']['server_2']);
self::assertArrayNotHasKey('test_data_2', $_SESSION['cache']['server_2_']);
}
public function testSet(): void
{
$_SESSION = [];
Config::getInstance()->selectedServer['user'] = null;
Config::getInstance()->selectedServer['user'] = '';
Current::$server = 2;
SessionCache::set('test_data', 25);
SessionCache::set('test_data', 5);
self::assertSame(5, $_SESSION['cache']['server_2']['test_data']);
self::assertSame(5, $_SESSION['cache']['server_2_']['test_data']);
SessionCache::set('test_data_3', 3);
self::assertSame(3, $_SESSION['cache']['server_2']['test_data_3']);
self::assertSame(3, $_SESSION['cache']['server_2_']['test_data_3']);
}
public function testHas(): void
{
$_SESSION = [];
Config::getInstance()->selectedServer['user'] = null;
Config::getInstance()->selectedServer['user'] = '';
SessionCache::set('test_data', 5);
SessionCache::set('test_data_2', 5);
@ -74,16 +74,16 @@ class SessionCacheTest extends TestCase
public function testKeyWithoutUser(): void
{
$_SESSION = [];
Config::getInstance()->selectedServer['user'] = null;
Config::getInstance()->selectedServer['user'] = '';
Current::$server = 123;
SessionCache::set('test_data', 5);
self::assertArrayHasKey('cache', $_SESSION);
self::assertIsArray($_SESSION['cache']);
self::assertArrayHasKey('server_123', $_SESSION['cache']);
self::assertIsArray($_SESSION['cache']['server_123']);
self::assertArrayHasKey('test_data', $_SESSION['cache']['server_123']);
self::assertSame(5, $_SESSION['cache']['server_123']['test_data']);
self::assertArrayHasKey('server_123_', $_SESSION['cache']);
self::assertIsArray($_SESSION['cache']['server_123_']);
self::assertArrayHasKey('test_data', $_SESSION['cache']['server_123_']);
self::assertSame(5, $_SESSION['cache']['server_123_']['test_data']);
}
public function testKeyWithUser(): void