Remove setGlobalConfig()

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
Kamil Tekiela 2026-01-20 23:06:10 +00:00 committed by Maurício Meneghini Fauth
parent 93488cc127
commit cc6c910d9b
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
46 changed files with 0 additions and 125 deletions

View File

@ -13809,15 +13809,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\:

View File

@ -8792,9 +8792,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>

View File

@ -65,7 +65,6 @@ abstract class AbstractTestCase extends TestCase
ExportSql::$noConstraintsComments = false;
// Config before DBI
$this->setGlobalConfig();
Cache::purge();
Tracker::disable();
@ -93,14 +92,6 @@ abstract class AbstractTestCase extends TestCase
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

@ -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

@ -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

@ -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

@ -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

@ -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;

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();