Merge pull request #19060 from MauricioFauth/config-DBG
Replace DBG config array access with Debug class
This commit is contained in:
commit
edfbb3defe
@ -15475,11 +15475,6 @@ parameters:
|
||||
count: 1
|
||||
path: tests/unit/Config/SettingsTest.php
|
||||
|
||||
-
|
||||
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'PhpMyAdmin\\\\\\\\Config\\\\\\\\Settings\\\\\\\\Debug' and PhpMyAdmin\\\\Config\\\\Settings\\\\Debug will always evaluate to true\\.$#"
|
||||
count: 1
|
||||
path: tests/unit/Config/SettingsTest.php
|
||||
|
||||
-
|
||||
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'PhpMyAdmin\\\\\\\\Config\\\\\\\\Settings\\\\\\\\Export' and PhpMyAdmin\\\\Config\\\\Settings\\\\Export will always evaluate to true\\.$#"
|
||||
count: 1
|
||||
@ -16725,16 +16720,6 @@ parameters:
|
||||
count: 2
|
||||
path: tests/unit/Tracking/TrackingTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'sql' on mixed\\.$#"
|
||||
count: 1
|
||||
path: tests/unit/TransformationsTest.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\\{PmaAbsoluteUri\\: string, AuthLog\\: string, AuthLogSuccess\\: bool, PmaNoRelation_DisableWarning\\: bool, SuhosinDisableWarning\\: bool, LoginCookieValidityDisableWarning\\: bool, ReservedWordDisableWarning\\: bool, TranslationWarningThreshold\\: int, \\.\\.\\.\\}\\.$#"
|
||||
count: 1
|
||||
path: tests/unit/TransformationsTest.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\\{ServerDefault\\: 1, ActionLinksMode\\: 'icons'\\}\\.$#"
|
||||
count: 1
|
||||
@ -16755,11 +16740,6 @@ parameters:
|
||||
count: 2
|
||||
path: tests/unit/TwoFactorTest.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\\{PmaAbsoluteUri\\: string, AuthLog\\: string, AuthLogSuccess\\: bool, PmaNoRelation_DisableWarning\\: bool, SuhosinDisableWarning\\: bool, LoginCookieValidityDisableWarning\\: bool, ReservedWordDisableWarning\\: bool, TranslationWarningThreshold\\: int, \\.\\.\\.\\}\\.$#"
|
||||
count: 1
|
||||
path: tests/unit/TwoFactorTest.php
|
||||
|
||||
-
|
||||
message: "#^Class PhpMyAdmin\\\\Tests\\\\TypesByDatabaseVersionTest has an uninitialized property \\$object\\. Give it default value or assign it in the constructor\\.$#"
|
||||
count: 1
|
||||
|
||||
@ -12245,6 +12245,7 @@
|
||||
<code><![CDATA[valuesForAllowThirdPartyFramingProvider]]></code>
|
||||
<code><![CDATA[valuesForAuthLogProvider]]></code>
|
||||
<code><![CDATA[valuesForBlowfishSecretProvider]]></code>
|
||||
<code><![CDATA[valuesForDebugProvider]]></code>
|
||||
<code><![CDATA[valuesForExecTimeLimitProvider]]></code>
|
||||
<code><![CDATA[valuesForLimitCharsProvider]]></code>
|
||||
<code><![CDATA[valuesForMaxCharactersInDisplayedSQLProvider]]></code>
|
||||
@ -13231,6 +13232,10 @@
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
<InaccessibleProperty>
|
||||
<code><![CDATA[$config->config->debug->sql]]></code>
|
||||
<code><![CDATA[$config->config->debug->sql]]></code>
|
||||
</InaccessibleProperty>
|
||||
<PossiblyUnusedMethod>
|
||||
<code><![CDATA[currentRolesData]]></code>
|
||||
<code><![CDATA[currentUserData]]></code>
|
||||
@ -13440,6 +13445,10 @@
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
<InaccessibleProperty>
|
||||
<code><![CDATA[$config->config->debug->sql]]></code>
|
||||
<code><![CDATA[$config->config->debug->sql]]></code>
|
||||
</InaccessibleProperty>
|
||||
<MixedArrayAssignment>
|
||||
<code><![CDATA[$_SESSION['debug']['queries']]]></code>
|
||||
</MixedArrayAssignment>
|
||||
@ -14409,7 +14418,6 @@
|
||||
<code><![CDATA[$config->settings]]></code>
|
||||
<code><![CDATA[$config->settings]]></code>
|
||||
<code><![CDATA[$config->settings]]></code>
|
||||
<code><![CDATA[$config->settings]]></code>
|
||||
</InvalidPropertyAssignmentValue>
|
||||
</file>
|
||||
<file src="tests/unit/Routing/RoutingTest.php">
|
||||
@ -14562,11 +14570,6 @@
|
||||
<code><![CDATA[providerGetEngine]]></code>
|
||||
</PossiblyUnusedMethod>
|
||||
</file>
|
||||
<file src="tests/unit/Stubs/DbiDummy.php">
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="tests/unit/Stubs/DummyResult.php">
|
||||
<InvalidReturnStatement>
|
||||
<code><![CDATA[array_column($this->result, 1, 0)]]></code>
|
||||
@ -14699,7 +14702,6 @@
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
<InvalidPropertyAssignmentValue>
|
||||
<code><![CDATA[$config->settings]]></code>
|
||||
<code><![CDATA[['ServerDefault' => 1, 'ActionLinksMode' => 'icons']]]></code>
|
||||
</InvalidPropertyAssignmentValue>
|
||||
<PossiblyUnusedMethod>
|
||||
@ -14737,10 +14739,14 @@
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
<code><![CDATA[Config::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
<InvalidPropertyAssignmentValue>
|
||||
<code><![CDATA[$config->settings]]></code>
|
||||
<code><![CDATA[$config->settings]]></code>
|
||||
</InvalidPropertyAssignmentValue>
|
||||
<InaccessibleProperty>
|
||||
<code><![CDATA[$config->config->debug->simple2fa]]></code>
|
||||
<code><![CDATA[$config->config->debug->simple2fa]]></code>
|
||||
<code><![CDATA[$config->config->debug->simple2fa]]></code>
|
||||
<code><![CDATA[$config->config->debug->simple2fa]]></code>
|
||||
<code><![CDATA[$config->config->debug->simple2fa]]></code>
|
||||
<code><![CDATA[$config->config->debug->simple2fa]]></code>
|
||||
</InaccessibleProperty>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$object->config['settings']['secret']]]></code>
|
||||
<code><![CDATA[$object->config['settings']['secret']]]></code>
|
||||
|
||||
@ -2507,7 +2507,7 @@ final class Settings
|
||||
*
|
||||
* @link https://docs.phpmyadmin.net/en/latest/config.html#cfg_DBG
|
||||
*/
|
||||
public Debug $DBG;
|
||||
public Debug $debug;
|
||||
|
||||
/**
|
||||
* Sets the working environment
|
||||
@ -2808,7 +2808,7 @@ final class Settings
|
||||
$this->SendErrorReports = $this->setSendErrorReports($settings);
|
||||
$this->ConsoleEnterExecutes = $this->setConsoleEnterExecutes($settings);
|
||||
$this->zeroConf = $this->setZeroConf($settings);
|
||||
$this->DBG = $this->setDBG($settings);
|
||||
$this->debug = $this->setDebug($settings);
|
||||
$this->environment = $this->setEnvironment($settings);
|
||||
$this->DefaultFunctions = $this->setDefaultFunctions($settings);
|
||||
$this->maxRowPlotLimit = $this->setMaxRowPlotLimit($settings);
|
||||
@ -3006,7 +3006,7 @@ final class Settings
|
||||
'SendErrorReports' => $this->SendErrorReports,
|
||||
'ConsoleEnterExecutes' => $this->ConsoleEnterExecutes,
|
||||
'ZeroConf' => $this->zeroConf,
|
||||
'DBG' => $this->DBG->asArray(),
|
||||
'DBG' => $this->debug->asArray(),
|
||||
'environment' => $this->environment,
|
||||
'DefaultFunctions' => $this->DefaultFunctions,
|
||||
'maxRowPlotLimit' => $this->maxRowPlotLimit,
|
||||
@ -5389,7 +5389,7 @@ final class Settings
|
||||
}
|
||||
|
||||
/** @param array<int|string, mixed> $settings */
|
||||
private function setDBG(array $settings): Debug
|
||||
private function setDebug(array $settings): Debug
|
||||
{
|
||||
if (isset($settings['DBG']) && is_array($settings['DBG'])) {
|
||||
return new Debug($settings['DBG']);
|
||||
|
||||
@ -220,7 +220,8 @@ class Validator
|
||||
string $pass,
|
||||
string $errorKey = 'Server',
|
||||
): bool|array {
|
||||
if (Config::getInstance()->settings['DBG']['demo']) {
|
||||
$config = Config::getInstance();
|
||||
if ($config->config->debug->demo) {
|
||||
// Connection test disabled on the demo server!
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -111,13 +111,12 @@ class Console
|
||||
$bookmarkFeature = $this->relation->getRelationParameters()->bookmarkFeature;
|
||||
$sqlHistory = $this->relation->getHistory($this->config->selectedServer['user']);
|
||||
$bookmarkContent = $this->getBookmarkContent();
|
||||
$debug = isset($this->config->settings['DBG']) && $this->config->settings['DBG']['sql'];
|
||||
|
||||
return $this->template->render('console/display', [
|
||||
'has_bookmark_feature' => $bookmarkFeature !== null,
|
||||
'sql_history' => $sqlHistory,
|
||||
'bookmark_content' => $bookmarkContent,
|
||||
'debug' => $debug,
|
||||
'debug' => $this->config->config->debug->sql,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ class HomeController extends AbstractController
|
||||
'server' => Current::$server,
|
||||
'sync_favorite_tables' => $syncFavoriteTables,
|
||||
'has_server' => $hasServer,
|
||||
'is_demo' => $config->settings['DBG']['demo'],
|
||||
'is_demo' => $config->config->debug->demo,
|
||||
'has_server_selection' => $hasServerSelection ?? false,
|
||||
'server_selection' => $serverSelection ?? '',
|
||||
'has_change_password_link' => ($config->selectedServer['auth_type'] ?? '') !== 'config'
|
||||
|
||||
@ -33,7 +33,7 @@ final class MainController
|
||||
public function __invoke(ServerRequest $request): Response
|
||||
{
|
||||
$config = Config::getInstance();
|
||||
if (@file_exists(CONFIG_FILE) && ! $config->settings['DBG']['demo']) {
|
||||
if (@file_exists(CONFIG_FILE) && ! $config->config->debug->demo) {
|
||||
$response = $this->responseFactory->createResponse(StatusCodeInterface::STATUS_NOT_FOUND);
|
||||
|
||||
return $response->write($this->template->render('error/generic', [
|
||||
|
||||
@ -209,7 +209,6 @@ class DatabaseInterface implements DbalInterface
|
||||
int $options = self::QUERY_BUFFERED,
|
||||
bool $cacheAffectedRows = true,
|
||||
): ResultInterface|false {
|
||||
$debug = isset($this->config->settings['DBG']) && $this->config->settings['DBG']['sql'];
|
||||
if (! isset($this->connections[$connectionType->value])) {
|
||||
return false;
|
||||
}
|
||||
@ -226,7 +225,7 @@ class DatabaseInterface implements DbalInterface
|
||||
$GLOBALS['cached_affected_rows'] = $this->affectedRows($connectionType, false);
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
if ($this->config->config->debug->sql) {
|
||||
$errorMessage = $this->getError($connectionType);
|
||||
Utilities::debugLogQueryIntoSession(
|
||||
$query,
|
||||
@ -234,7 +233,7 @@ class DatabaseInterface implements DbalInterface
|
||||
$result,
|
||||
$this->lastQueryExecutionTime,
|
||||
);
|
||||
if ($this->config->settings['DBG']['sqllog']) {
|
||||
if ($this->config->config->debug->sqllog) {
|
||||
openlog('phpMyAdmin', LOG_NDELAY | LOG_PID, LOG_USER);
|
||||
|
||||
syslog(
|
||||
|
||||
@ -101,9 +101,7 @@ class Footer
|
||||
public function getDebugMessage(): string
|
||||
{
|
||||
$retval = '\'false\'';
|
||||
if (
|
||||
$this->config->settings['DBG']['sql'] && empty($_REQUEST['no_debug']) && ! empty($_SESSION['debug'])
|
||||
) {
|
||||
if ($this->config->config->debug->sql && empty($_REQUEST['no_debug']) && ! empty($_SESSION['debug'])) {
|
||||
// Remove recursions and iterators from $_SESSION['debug']
|
||||
self::removeRecursion($_SESSION['debug']);
|
||||
|
||||
@ -241,7 +239,7 @@ class Footer
|
||||
$errorMessages = $this->getErrorMessages();
|
||||
$scripts = $this->scripts->getDisplay();
|
||||
|
||||
if ($this->config->settings['DBG']['demo']) {
|
||||
if ($this->config->config->debug->demo) {
|
||||
$gitRevisionInfo = $this->getGitRevisionInfo();
|
||||
}
|
||||
|
||||
@ -254,7 +252,7 @@ class Footer
|
||||
'self_url' => $url ?? null,
|
||||
'error_messages' => $errorMessages ?? '',
|
||||
'scripts' => $scripts ?? '',
|
||||
'is_demo' => $this->config->settings['DBG']['demo'],
|
||||
'is_demo' => $this->config->config->debug->demo,
|
||||
'git_revision_info' => $gitRevisionInfo ?? [],
|
||||
'footer' => $footer ?? '',
|
||||
]);
|
||||
|
||||
@ -161,7 +161,7 @@ class AuthenticationCookie extends AuthenticationPlugin
|
||||
|
||||
$response->addHTML($this->template->render('login/form', [
|
||||
'login_header' => $loginHeader,
|
||||
'is_demo' => $config->settings['DBG']['demo'],
|
||||
'is_demo' => $config->config->debug->demo,
|
||||
'error_messages' => $errorMessages,
|
||||
'available_languages' => $availableLanguages,
|
||||
'is_session_expired' => $sessionExpired,
|
||||
|
||||
@ -118,7 +118,8 @@ class TwoFactor
|
||||
public function getAvailableBackends(): array
|
||||
{
|
||||
$result = [];
|
||||
if (Config::getInstance()->settings['DBG']['simple2fa']) {
|
||||
$config = Config::getInstance();
|
||||
if ($config->config->debug->simple2fa) {
|
||||
$result[] = 'simple';
|
||||
}
|
||||
|
||||
|
||||
@ -226,7 +226,6 @@ class SettingsTest extends TestCase
|
||||
'DisableMultiTableMaintenance' => false,
|
||||
'SendErrorReports' => 'ask',
|
||||
'ConsoleEnterExecutes' => false,
|
||||
'DBG' => null,
|
||||
'environment' => 'production',
|
||||
'DefaultFunctions' => [
|
||||
'FUNC_CHAR' => '',
|
||||
@ -268,11 +267,6 @@ class SettingsTest extends TestCase
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($key === 'DBG') {
|
||||
self::assertInstanceOf(Debug::class, $settings->DBG);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($key === 'Export') {
|
||||
self::assertInstanceOf(Export::class, $settings->Export);
|
||||
continue;
|
||||
@ -468,7 +462,6 @@ class SettingsTest extends TestCase
|
||||
['DisableMultiTableMaintenance', null, false],
|
||||
['SendErrorReports', null, 'ask'],
|
||||
['ConsoleEnterExecutes', null, false],
|
||||
['DBG', null, null],
|
||||
['environment', null, 'production'],
|
||||
['DefaultFunctions', null, ['FUNC_CHAR' => '', 'FUNC_DATE' => '', 'FUNC_NUMBER' => '', 'FUNC_SPATIAL' => 'GeomFromText', 'FUNC_UUID' => 'UUID', 'first_timestamp' => 'NOW']],
|
||||
['maxRowPlotLimit', null, 500],
|
||||
@ -634,7 +627,6 @@ class SettingsTest extends TestCase
|
||||
['DisableMultiTableMaintenance', true, true],
|
||||
['SendErrorReports', 'never', 'never'],
|
||||
['ConsoleEnterExecutes', true, true],
|
||||
['DBG', [], null],
|
||||
['environment', 'development', 'development'],
|
||||
['DefaultFunctions', ['key' => 'value', 'key2' => 'value2'], ['key' => 'value', 'key2' => 'value2']],
|
||||
['maxRowPlotLimit', 1, 1],
|
||||
@ -963,7 +955,6 @@ class SettingsTest extends TestCase
|
||||
['TrustedProxies', 'invalid', []],
|
||||
['LinkLengthLimit', 0, 1000],
|
||||
['SendErrorReports', 'invalid', 'ask'],
|
||||
['DBG', 'invalid', null],
|
||||
['environment', 'invalid', 'production'],
|
||||
['DefaultFunctions', 'invalid', ['FUNC_CHAR' => '', 'FUNC_DATE' => '', 'FUNC_NUMBER' => '', 'FUNC_SPATIAL' => 'GeomFromText', 'FUNC_UUID' => 'UUID', 'first_timestamp' => 'NOW']],
|
||||
['maxRowPlotLimit', 0, 500],
|
||||
@ -1453,6 +1444,26 @@ class SettingsTest extends TestCase
|
||||
yield 'valid value with type coercion' => [0, false];
|
||||
}
|
||||
|
||||
/** @param mixed[] $expected */
|
||||
#[DataProvider('valuesForDebugProvider')]
|
||||
public function testDebug(mixed $actual, array $expected): void
|
||||
{
|
||||
$settings = new Settings(['DBG' => $actual]);
|
||||
$settingsArray = $settings->asArray();
|
||||
$expectedDebug = new Debug($expected);
|
||||
self::assertEquals($expectedDebug, $settings->debug);
|
||||
self::assertSame($expectedDebug->asArray(), $settingsArray['DBG']);
|
||||
}
|
||||
|
||||
/** @return iterable<string, array{mixed, mixed[]}> */
|
||||
public static function valuesForDebugProvider(): iterable
|
||||
{
|
||||
yield 'null value' => [null, []];
|
||||
yield 'valid value' => [[], []];
|
||||
yield 'valid value 2' => [['demo' => true], ['demo' => true]];
|
||||
yield 'invalid value' => ['invalid', []];
|
||||
}
|
||||
|
||||
/** @param array{internal: int, human: string} $expected */
|
||||
#[DataProvider('valuesForMysqlMinVersionProvider')]
|
||||
public function testMysqlMinVersion(mixed $actual, array $expected): void
|
||||
|
||||
@ -276,7 +276,6 @@ class DatabaseInterfaceTest extends AbstractTestCase
|
||||
|
||||
$config = Config::getInstance();
|
||||
$config->selectedServer['DisableIS'] = false;
|
||||
$config->settings['DBG']['sql'] = false;
|
||||
|
||||
self::assertSame(
|
||||
'utf8_general_ci',
|
||||
@ -300,8 +299,10 @@ class DatabaseInterfaceTest extends AbstractTestCase
|
||||
public function testGetServerCollation(): void
|
||||
{
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
Config::getInstance()->settings['DBG']['sql'] = true;
|
||||
$config = Config::getInstance();
|
||||
$config->config->debug->sql = true;
|
||||
self::assertSame('utf8_general_ci', $dbi->getServerCollation());
|
||||
$config->config->debug->sql = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -31,7 +31,6 @@ class DbiDummyTest extends AbstractTestCase
|
||||
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
|
||||
DatabaseInterface::$instance = $this->dbi;
|
||||
$config = Config::getInstance();
|
||||
$config->settings['DBG']['sql'] = false;
|
||||
$config->settings['IconvExtraParams'] = '';
|
||||
}
|
||||
|
||||
|
||||
@ -68,7 +68,8 @@ class FooterTest extends AbstractTestCase
|
||||
#[Group('medium')]
|
||||
public function testGetDebugMessage(): void
|
||||
{
|
||||
Config::getInstance()->settings['DBG']['sql'] = true;
|
||||
$config = Config::getInstance();
|
||||
$config->config->debug->sql = true;
|
||||
$_SESSION['debug']['queries'] = [
|
||||
['count' => 1, 'time' => 0.2, 'query' => 'SELECT * FROM `pma_bookmark` WHERE 1'],
|
||||
['count' => 1, 'time' => 2.5, 'query' => 'SELECT * FROM `db` WHERE 1'],
|
||||
@ -79,6 +80,7 @@ class FooterTest extends AbstractTestCase
|
||||
. '{"count":1,"time":2.5,"query":"SELECT * FROM `db` WHERE 1"}]}',
|
||||
$this->object->getDebugMessage(),
|
||||
);
|
||||
$config->config->debug->sql = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -44,7 +44,6 @@ class ReplicationGuiTest extends AbstractTestCase
|
||||
$config->settings['ShowSQL'] = true;
|
||||
$config->settings['TableNavigationLinksMode'] = 'icons';
|
||||
$config->settings['LimitChars'] = 100;
|
||||
$config->settings['DBG']['sql'] = false;
|
||||
$config->settings['ShowHint'] = true;
|
||||
|
||||
Current::$table = 'table';
|
||||
|
||||
@ -11,7 +11,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Tests\Stubs;
|
||||
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Config\Settings\Server;
|
||||
use PhpMyAdmin\Dbal\Connection;
|
||||
use PhpMyAdmin\Dbal\DbiExtension;
|
||||
@ -2256,8 +2255,5 @@ class DbiDummy implements DbiExtension
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
/* Some basic setup for dummy driver */
|
||||
Config::getInstance()->settings['DBG']['sql'] = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +41,6 @@ class TransformationsTest extends AbstractTestCase
|
||||
$config->selectedServer['table_info'] = '';
|
||||
$config->selectedServer['table_coords'] = '';
|
||||
$config->selectedServer['column_info'] = 'column_info';
|
||||
$config->settings['DBG']['sql'] = false;
|
||||
|
||||
$this->transformations = new Transformations();
|
||||
}
|
||||
|
||||
@ -46,7 +46,6 @@ class TwoFactorTest extends AbstractTestCase
|
||||
Current::$table = 'table';
|
||||
$config = Config::getInstance();
|
||||
$config->selectedServer['DisableIS'] = false;
|
||||
$config->settings['DBG'] = ['simple2fa' => false, 'sql' => false];
|
||||
$config->settings['NaturalOrder'] = true;
|
||||
$this->initStorageConfigAndData();
|
||||
}
|
||||
@ -175,11 +174,11 @@ class TwoFactorTest extends AbstractTestCase
|
||||
{
|
||||
$request = new ServerRequest(self::createStub(ServerRequestInterface::class));
|
||||
$config = Config::getInstance();
|
||||
$config->settings['DBG']['simple2fa'] = true;
|
||||
$config->config->debug->simple2fa = true;
|
||||
$object = $this->getTwoFactorAndLoadConfig('user', ['type' => 'db', 'backend' => 'simple']);
|
||||
$backend = $object->getBackend();
|
||||
self::assertSame('simple', $backend::$id);
|
||||
$config->settings['DBG']['simple2fa'] = false;
|
||||
$config->config->debug->simple2fa = false;
|
||||
|
||||
unset($_POST['2fa_confirm']);
|
||||
self::assertFalse($object->check($request, true));
|
||||
@ -204,7 +203,7 @@ class TwoFactorTest extends AbstractTestCase
|
||||
{
|
||||
$request = new ServerRequest(self::createStub(ServerRequestInterface::class));
|
||||
$config = Config::getInstance();
|
||||
$config->settings['DBG']['simple2fa'] = true;
|
||||
$config->config->debug->simple2fa = true;
|
||||
$object = $this->getTwoFactorAndLoadConfig('user', null);
|
||||
|
||||
$this->dummyDbi->assertAllQueriesConsumed();
|
||||
@ -229,7 +228,7 @@ class TwoFactorTest extends AbstractTestCase
|
||||
|
||||
$this->initStorageConfigAndData();// Needs a re-init
|
||||
|
||||
$config->settings['DBG']['simple2fa'] = false;
|
||||
$config->config->debug->simple2fa = false;
|
||||
$object = $this->getTwoFactorAndLoadConfig('user', null);
|
||||
self::assertFalse($object->configure($request, 'simple'));
|
||||
$this->dummyDbi->assertAllQueriesConsumed();
|
||||
@ -484,13 +483,13 @@ class TwoFactorTest extends AbstractTestCase
|
||||
public function testBackends(): void
|
||||
{
|
||||
$config = Config::getInstance();
|
||||
$config->settings['DBG']['simple2fa'] = true;
|
||||
$config->config->debug->simple2fa = true;
|
||||
$object = $this->getTwoFactorAndLoadConfig('user', null);
|
||||
$backends = $object->getAllBackends();
|
||||
self::assertCount(
|
||||
count($object->getAvailable()) + 1,
|
||||
$backends,
|
||||
);
|
||||
$config->settings['DBG']['simple2fa'] = false;
|
||||
$config->config->debug->simple2fa = false;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user