Remove setGlobalConfig()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
parent
93488cc127
commit
cc6c910d9b
@ -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\:
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -20,8 +20,6 @@ class AdvisorTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -31,8 +31,6 @@ class FormDisplayTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
Current::$server = 2;
|
||||
$this->object = new FormDisplay(new ConfigFile());
|
||||
Form::resetGroupCounter();
|
||||
|
||||
@ -28,8 +28,6 @@ class FormTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
$this->object = new Form(
|
||||
'pma_form_name',
|
||||
['pma_form1', 'pma_form2'],
|
||||
|
||||
@ -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.
|
||||
*
|
||||
|
||||
@ -30,8 +30,6 @@ class PageSettingsTest extends AbstractTestCase
|
||||
|
||||
$this->setLanguage();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
Current::$database = 'db';
|
||||
Current::$table = '';
|
||||
|
||||
@ -30,8 +30,6 @@ class ServerConfigChecksTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
$this->configFile = new ConfigFile();
|
||||
|
||||
$reflection = new ReflectionProperty(ConfigFile::class, 'id');
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -29,8 +29,6 @@ class AdvisorControllerTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
|
||||
$config = Config::getInstance();
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -31,8 +31,6 @@ class RefreshControllerTest extends AbstractTestCase
|
||||
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
Current::$database = 'db';
|
||||
Current::$table = 'table';
|
||||
$config = Config::getInstance();
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -35,8 +35,6 @@ class VariablesControllerTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
$this->setLanguage();
|
||||
|
||||
Current::$database = 'db';
|
||||
|
||||
@ -25,8 +25,6 @@ class OverviewControllerTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
Current::$database = 'db';
|
||||
Current::$table = 'table';
|
||||
}
|
||||
|
||||
@ -103,8 +103,6 @@ class CentralColumnsTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
$config = Config::getInstance();
|
||||
$config->selectedServer['user'] = 'pma_user';
|
||||
$config->selectedServer['DisableIS'] = true;
|
||||
|
||||
@ -24,8 +24,6 @@ class EventsTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
$this->setLanguage();
|
||||
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
|
||||
@ -28,8 +28,6 @@ class RoutinesTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
$this->setLanguage();
|
||||
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -35,8 +35,6 @@ class OptionsTest extends AbstractTestCase
|
||||
|
||||
$this->setLanguage();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
|
||||
|
||||
@ -34,8 +34,6 @@ class FooterTest extends AbstractTestCase
|
||||
|
||||
$this->setLanguage();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
$_SERVER['SCRIPT_NAME'] = 'index.php';
|
||||
Current::$database = '';
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -28,8 +28,6 @@ class NavigationTreeTest extends AbstractTestCase
|
||||
|
||||
$this->setLanguage();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$config = Config::getInstance();
|
||||
|
||||
@ -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
|
||||
*/
|
||||
|
||||
@ -32,8 +32,6 @@ class AuthenticationConfigTest extends AbstractTestCase
|
||||
|
||||
$this->setLanguage();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
Current::$server = 2;
|
||||
Current::$database = 'db';
|
||||
|
||||
@ -52,8 +52,6 @@ class AuthenticationCookieTest extends AbstractTestCase
|
||||
|
||||
$this->setLanguage();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
Current::$database = 'db';
|
||||
Current::$table = 'table';
|
||||
|
||||
@ -33,8 +33,6 @@ class AuthenticationHttpTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
Config::getInstance()->settings['Servers'] = [];
|
||||
Current::$database = 'db';
|
||||
|
||||
@ -37,8 +37,6 @@ class AuthenticationSignonTest extends AbstractTestCase
|
||||
|
||||
$this->setLanguage();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
Current::$database = 'db';
|
||||
Current::$table = 'table';
|
||||
|
||||
@ -31,8 +31,6 @@ class ConfigGeneratorTest extends AbstractTestCase
|
||||
{
|
||||
unset($_SESSION['eol']);
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
Current::$server = 2;
|
||||
$cf = new ConfigFile();
|
||||
$_SESSION['ConfigFile2'] = ['a', 'b', 'c'];
|
||||
|
||||
@ -19,8 +19,6 @@ class ThemeManagerTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
Current::$server = 99;
|
||||
}
|
||||
|
||||
|
||||
@ -32,8 +32,6 @@ class ThemeTest extends AbstractTestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->object = new Theme();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -26,8 +26,6 @@ class TriggersTest extends AbstractTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->setGlobalConfig();
|
||||
|
||||
$this->setLanguage();
|
||||
|
||||
DatabaseInterface::$instance = $this->createDatabaseInterface();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user