From 8caf17b0acf90ae030c78dad0adeefe2771a1789 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Mon, 31 Oct 2022 22:00:26 +0000 Subject: [PATCH 1/6] SystemDatabase Signed-off-by: Kamil Tekiela --- libraries/classes/SystemDatabase.php | 4 +--- phpstan-baseline.neon | 5 +++++ test/classes/SystemDatabaseTest.php | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libraries/classes/SystemDatabase.php b/libraries/classes/SystemDatabase.php index 6c68c30acc..3b9b2acc81 100644 --- a/libraries/classes/SystemDatabase.php +++ b/libraries/classes/SystemDatabase.php @@ -108,9 +108,7 @@ class SystemDatabase $dataRow['comment'], $dataRow['mimetype'], $dataRow['transformation'], - $GLOBALS['dbi']->escapeString( - $dataRow['transformation_options'] - ) + $this->dbi->escapeString($dataRow['transformation_options']) ); $addComma = true; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d7d160f556..1070902349 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -8005,6 +8005,11 @@ parameters: count: 1 path: libraries/classes/SystemDatabase.php + - + message: "#^Parameter \\#1 \\$str of method PhpMyAdmin\\\\DatabaseInterface\\:\\:escapeString\\(\\) expects string, string\\|null given\\.$#" + count: 1 + path: libraries/classes/SystemDatabase.php + - message: "#^Cannot cast mixed to string\\.$#" count: 1 diff --git a/test/classes/SystemDatabaseTest.php b/test/classes/SystemDatabaseTest.php index ab0716a9b9..886d5fe9fd 100644 --- a/test/classes/SystemDatabaseTest.php +++ b/test/classes/SystemDatabaseTest.php @@ -27,7 +27,6 @@ class SystemDatabaseTest extends AbstractTestCase protected function setUp(): void { parent::setUp(); - $GLOBALS['dbi'] = $this->createDatabaseInterface(); /** * SET these to avoid undefine d index error */ @@ -44,6 +43,10 @@ class SystemDatabaseTest extends AbstractTestCase ->method('tryQuery') ->will($this->returnValue($resultStub)); + $dbi->expects($this->any()) + ->method('escapeString') + ->will($this->returnArgument(0)); + $_SESSION['relation'] = []; $_SESSION['relation'][$GLOBALS['server']] = RelationParameters::fromArray([ 'table_coords' => 'table_name', From 98902c87a8754e1186286fd2f8a9fbef867fa259 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Mon, 31 Oct 2022 22:05:49 +0000 Subject: [PATCH 2/6] Update Designer.php Signed-off-by: Kamil Tekiela --- libraries/classes/Database/Designer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/classes/Database/Designer.php b/libraries/classes/Database/Designer.php index bee380b19a..51bf3a2fec 100644 --- a/libraries/classes/Database/Designer.php +++ b/libraries/classes/Database/Designer.php @@ -166,7 +166,7 @@ class Designer . Util::backquote($databaseDesignerSettingsFeature->database) . '.' . Util::backquote($databaseDesignerSettingsFeature->designerSettings) . ' WHERE ' . Util::backquote('username') . ' = "' - . $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['user']) + . $this->dbi->escapeString($GLOBALS['cfg']['Server']['user']) . '";'; $result = $this->dbi->fetchSingleRow($query); From e62241b0793e36e250db8d5241dd14a36ec75ef7 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Mon, 31 Oct 2022 22:06:30 +0000 Subject: [PATCH 3/6] Update Routines.php Signed-off-by: Kamil Tekiela --- libraries/classes/Database/Routines.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/classes/Database/Routines.php b/libraries/classes/Database/Routines.php index 9e41943696..03832e6a9c 100644 --- a/libraries/classes/Database/Routines.php +++ b/libraries/classes/Database/Routines.php @@ -871,7 +871,7 @@ class Routines } if (! empty($itemParamOpsText[$i])) { - if ($GLOBALS['dbi']->types->getTypeClass($itemParamType[$i]) === 'CHAR') { + if ($this->dbi->types->getTypeClass($itemParamType[$i]) === 'CHAR') { if (! in_array($itemParamType[$i], ['VARBINARY', 'BINARY'])) { $params .= ' CHARSET ' . mb_strtolower($itemParamOpsText[$i]); @@ -880,7 +880,7 @@ class Routines } if (! empty($itemParamOpsNum[$i])) { - if ($GLOBALS['dbi']->types->getTypeClass($itemParamType[$i]) === 'NUMBER') { + if ($this->dbi->types->getTypeClass($itemParamType[$i]) === 'NUMBER') { $params .= ' ' . mb_strtoupper($itemParamOpsNum[$i]); } @@ -937,14 +937,14 @@ class Routines } if (! empty($_POST['item_returnopts_text'])) { - if ($GLOBALS['dbi']->types->getTypeClass($itemReturnType) === 'CHAR') { + if ($this->dbi->types->getTypeClass($itemReturnType) === 'CHAR') { $query .= ' CHARSET ' . mb_strtolower($_POST['item_returnopts_text']); } } if (! empty($_POST['item_returnopts_num'])) { - if ($GLOBALS['dbi']->types->getTypeClass($itemReturnType) === 'NUMBER') { + if ($this->dbi->types->getTypeClass($itemReturnType) === 'NUMBER') { $query .= ' ' . mb_strtoupper($_POST['item_returnopts_num']); } From 828a5f713775ebee54c94295b584796dd20fe9ab Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Mon, 31 Oct 2022 22:12:48 +0000 Subject: [PATCH 4/6] Update Privileges.php Signed-off-by: Kamil Tekiela --- libraries/classes/Server/Privileges.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libraries/classes/Server/Privileges.php b/libraries/classes/Server/Privileges.php index b16faf87a0..fc745a1d42 100644 --- a/libraries/classes/Server/Privileges.php +++ b/libraries/classes/Server/Privileges.php @@ -85,7 +85,7 @@ class Privileges */ public function __construct( Template $template, - $dbi, + DatabaseInterface $dbi, Relation $relation, RelationCleanup $relationCleanup, Plugins $plugins @@ -870,9 +870,9 @@ class Privileges if (isset($username, $hostname) && $mode === 'change') { $row = $this->dbi->fetchSingleRow( 'SELECT `plugin` FROM `mysql`.`user` WHERE `User` = "' - . $GLOBALS['dbi']->escapeString($username) + . $this->dbi->escapeString($username) . '" AND `Host` = "' - . $GLOBALS['dbi']->escapeString($hostname) + . $this->dbi->escapeString($hostname) . '" LIMIT 1' ); // Table 'mysql'.'user' may not exist for some previous @@ -885,9 +885,9 @@ class Privileges $row = $this->dbi->fetchSingleRow( 'SELECT `plugin` FROM `mysql`.`user` WHERE `User` = "' - . $GLOBALS['dbi']->escapeString($username) + . $this->dbi->escapeString($username) . '" AND `Host` = "' - . $GLOBALS['dbi']->escapeString($hostname) + . $this->dbi->escapeString($hostname) . '"' ); if (is_array($row) && isset($row['plugin'])) { @@ -1014,8 +1014,8 @@ class Privileges . " `authentication_string` = '" . $hashedPassword . "', `Password` = '', " . " `plugin` = '" . $authenticationPlugin . "'" - . " WHERE `User` = '" . $GLOBALS['dbi']->escapeString($username) - . "' AND Host = '" . $GLOBALS['dbi']->escapeString($hostname) . "';"; + . " WHERE `User` = '" . $this->dbi->escapeString($username) + . "' AND Host = '" . $this->dbi->escapeString($hostname) . "';"; } else { // USE 'SET PASSWORD ...' syntax for rest of the versions // Backup the old value, to be reset later @@ -1023,8 +1023,8 @@ class Privileges $origValue = $row['@@old_passwords']; $updatePluginQuery = 'UPDATE `mysql`.`user` SET' . " `plugin` = '" . $authenticationPlugin . "'" - . " WHERE `User` = '" . $GLOBALS['dbi']->escapeString($username) - . "' AND Host = '" . $GLOBALS['dbi']->escapeString($hostname) . "';"; + . " WHERE `User` = '" . $this->dbi->escapeString($username) + . "' AND Host = '" . $this->dbi->escapeString($hostname) . "';"; // Update the plugin for the user if (! $this->dbi->tryQuery($updatePluginQuery)) { From 15915a45e094eeeab923eb73f4e55dfec1af99aa Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Mon, 31 Oct 2022 22:30:26 +0000 Subject: [PATCH 5/6] Send DBI to SqlQueryForm using DI Signed-off-by: Kamil Tekiela --- libraries/classes/SqlQueryForm.php | 12 ++++-- libraries/services.php | 2 +- .../Controllers/Table/SqlControllerTest.php | 4 +- .../Table/TrackingControllerTest.php | 2 +- test/classes/SqlQueryFormTest.php | 43 +++++++++---------- test/classes/TrackingTest.php | 2 +- 6 files changed, 34 insertions(+), 31 deletions(-) diff --git a/libraries/classes/SqlQueryForm.php b/libraries/classes/SqlQueryForm.php index f3bb312ca5..b4055a99aa 100644 --- a/libraries/classes/SqlQueryForm.php +++ b/libraries/classes/SqlQueryForm.php @@ -31,12 +31,16 @@ class SqlQueryForm /** @var Template */ private $template; + /** @var DatabaseInterface */ + private $dbi; + /** * @param Template $template Template object */ - public function __construct(Template $template) + public function __construct(Template $template, DatabaseInterface $dbi) { $this->template = $template; + $this->dbi = $dbi; } /** @@ -90,14 +94,14 @@ class SqlQueryForm [$legend, $query, $columns_list] = $this->init($query); } - $relation = new Relation($GLOBALS['dbi']); + $relation = new Relation($this->dbi); $bookmarkFeature = $relation->getRelationParameters()->bookmarkFeature; $bookmarks = []; if ($display_tab === 'full' && $bookmarkFeature !== null) { $bookmark_list = Bookmark::getList( $bookmarkFeature, - $GLOBALS['dbi'], + $this->dbi, $GLOBALS['cfg']['Server']['user'], $db ); @@ -173,7 +177,7 @@ class SqlQueryForm // Get the list and number of fields // we do a try_query here, because we could be in the query window, // trying to synchronize and the table has not yet been created - $columns_list = $GLOBALS['dbi']->getColumns($db, $GLOBALS['table'], true); + $columns_list = $this->dbi->getColumns($db, $GLOBALS['table'], true); $scriptName = Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabTable'], 'table'); $tmp_tbl_link = ''; diff --git a/libraries/services.php b/libraries/services.php index 08bb600332..04fa284cb4 100644 --- a/libraries/services.php +++ b/libraries/services.php @@ -197,7 +197,7 @@ return [ ], 'sql_query_form' => [ 'class' => PhpMyAdmin\SqlQueryForm::class, - 'arguments' => ['$template' => '@template'], + 'arguments' => ['$template' => '@template', '$dbi' => '@dbi'], ], 'status_data' => [ 'class' => PhpMyAdmin\Server\Status\Data::class, diff --git a/test/classes/Controllers/Table/SqlControllerTest.php b/test/classes/Controllers/Table/SqlControllerTest.php index d94d34a2ab..009462e4b7 100644 --- a/test/classes/Controllers/Table/SqlControllerTest.php +++ b/test/classes/Controllers/Table/SqlControllerTest.php @@ -81,7 +81,9 @@ class SqlControllerTest extends AbstractTestCase ]); $response = new ResponseRenderer(); - (new SqlController($response, $template, new SqlQueryForm($template)))($this->createStub(ServerRequest::class)); + ( + new SqlController($response, $template, new SqlQueryForm($template, $this->dbi)) + )($this->createStub(ServerRequest::class)); $this->assertSame($expected, $response->getHTMLResult()); } } diff --git a/test/classes/Controllers/Table/TrackingControllerTest.php b/test/classes/Controllers/Table/TrackingControllerTest.php index 712566ba97..b0618afc8d 100644 --- a/test/classes/Controllers/Table/TrackingControllerTest.php +++ b/test/classes/Controllers/Table/TrackingControllerTest.php @@ -51,7 +51,7 @@ class TrackingControllerTest extends AbstractTestCase (new TrackingController( $response, $template, - new Tracking(new SqlQueryForm($template), $template, new Relation($this->dbi), $this->dbi) + new Tracking(new SqlQueryForm($template, $this->dbi), $template, new Relation($this->dbi), $this->dbi) ))($this->createStub(ServerRequest::class)); $main = $template->render('table/tracking/main', [ diff --git a/test/classes/SqlQueryFormTest.php b/test/classes/SqlQueryFormTest.php index ff74ff5be9..438f28c497 100644 --- a/test/classes/SqlQueryFormTest.php +++ b/test/classes/SqlQueryFormTest.php @@ -39,9 +39,28 @@ class SqlQueryFormTest extends AbstractTestCase parent::setUp(); parent::setLanguage(); $this->dummyDbi = $this->createDbiDummy(); + $this->dummyDbi = $this->createDbiDummy(); + $this->dummyDbi->addResult( + 'SHOW FULL COLUMNS FROM `PMA_db`.`PMA_table`', + [ + [ + 'field1', + 'Comment1', + ], + ], + [ + 'Field', + 'Comment', + ] + ); + + $this->dummyDbi->addResult( + 'SHOW INDEXES FROM `PMA_db`.`PMA_table`', + [] + ); $this->dbi = $this->createDatabaseInterface($this->dummyDbi); $GLOBALS['dbi'] = $this->dbi; - $this->sqlQueryForm = new SqlQueryForm(new Template()); + $this->sqlQueryForm = new SqlQueryForm(new Template(), $this->dbi); //$GLOBALS $GLOBALS['PMA_PHP_SELF'] = Core::getenv('PHP_SELF'); @@ -77,28 +96,6 @@ class SqlQueryFormTest extends AbstractTestCase $GLOBALS['cfg']['Server']['user'] = 'user'; $GLOBALS['cfg']['Server']['pmadb'] = 'pmadb'; $GLOBALS['cfg']['Server']['bookmarktable'] = 'bookmarktable'; - - $this->dummyDbi = $this->createDbiDummy(); - $this->dbi = $this->createDatabaseInterface($this->dummyDbi); - $GLOBALS['dbi'] = $this->dbi; - $this->dummyDbi->addResult( - 'SHOW FULL COLUMNS FROM `PMA_db`.`PMA_table`', - [ - [ - 'field1', - 'Comment1', - ], - ], - [ - 'Field', - 'Comment', - ] - ); - - $this->dummyDbi->addResult( - 'SHOW INDEXES FROM `PMA_db`.`PMA_table`', - [] - ); } /** diff --git a/test/classes/TrackingTest.php b/test/classes/TrackingTest.php index 8e99787866..9e4e2ff21f 100644 --- a/test/classes/TrackingTest.php +++ b/test/classes/TrackingTest.php @@ -51,7 +51,7 @@ class TrackingTest extends AbstractTestCase $template = new Template(); $this->tracking = new Tracking( - new SqlQueryForm($template), + new SqlQueryForm($template, $GLOBALS['dbi']), $template, new Relation($GLOBALS['dbi']), $GLOBALS['dbi'] From a5a81d159fa919a412c24cad952fa6df2b3dfe76 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Mon, 31 Oct 2022 22:36:48 +0000 Subject: [PATCH 6/6] Send DBI to Data using DI Signed-off-by: Kamil Tekiela --- libraries/classes/Server/Status/Data.php | 14 ++++++++++---- libraries/services.php | 1 + .../Server/Status/AdvisorControllerTest.php | 2 +- .../Status/Monitor/GeneralLogControllerTest.php | 2 +- .../Status/Monitor/LogVarsControllerTest.php | 2 +- .../Status/Monitor/QueryAnalyzerControllerTest.php | 2 +- .../Status/Monitor/SlowLogControllerTest.php | 2 +- .../Server/Status/MonitorControllerTest.php | 2 +- .../Status/Processes/RefreshControllerTest.php | 2 +- .../Server/Status/ProcessesControllerTest.php | 2 +- .../Server/Status/QueriesControllerTest.php | 2 +- .../Server/Status/StatusControllerTest.php | 2 +- .../Server/Status/VariablesControllerTest.php | 2 +- 13 files changed, 22 insertions(+), 15 deletions(-) diff --git a/libraries/classes/Server/Status/Data.php b/libraries/classes/Server/Status/Data.php index 4a14a1fb4d..4d8476d2a8 100644 --- a/libraries/classes/Server/Status/Data.php +++ b/libraries/classes/Server/Status/Data.php @@ -8,6 +8,7 @@ declare(strict_types=1); namespace PhpMyAdmin\Server\Status; +use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\ReplicationInfo; use PhpMyAdmin\Url; @@ -63,6 +64,9 @@ class Data /** @var ReplicationInfo */ private $replicationInfo; + /** @var DatabaseInterface */ + private $dbi; + public function getReplicationInfo(): ReplicationInfo { return $this->replicationInfo; @@ -350,15 +354,17 @@ class Data ]; } - public function __construct() + public function __construct(DatabaseInterface $dbi) { - $this->replicationInfo = new ReplicationInfo($GLOBALS['dbi']); + $this->dbi = $dbi; + + $this->replicationInfo = new ReplicationInfo($this->dbi); $this->replicationInfo->load($_POST['primary_connection'] ?? null); $this->selfUrl = basename($GLOBALS['PMA_PHP_SELF']); // get status from server - $server_status_result = $GLOBALS['dbi']->tryQuery('SHOW GLOBAL STATUS'); + $server_status_result = $this->dbi->tryQuery('SHOW GLOBAL STATUS'); if ($server_status_result === false) { $server_status = []; $this->dataLoaded = false; @@ -369,7 +375,7 @@ class Data } // for some calculations we require also some server settings - $server_variables = $GLOBALS['dbi']->fetchResult('SHOW GLOBAL VARIABLES', 0, 1); + $server_variables = $this->dbi->fetchResult('SHOW GLOBAL VARIABLES', 0, 1); // cleanup of some deprecated values $server_status = self::cleanDeprecated($server_status); diff --git a/libraries/services.php b/libraries/services.php index 04fa284cb4..b455dd9612 100644 --- a/libraries/services.php +++ b/libraries/services.php @@ -201,6 +201,7 @@ return [ ], 'status_data' => [ 'class' => PhpMyAdmin\Server\Status\Data::class, + 'arguments' => ['@dbi'], ], 'status_monitor' => [ 'class' => PhpMyAdmin\Server\Status\Monitor::class, diff --git a/test/classes/Controllers/Server/Status/AdvisorControllerTest.php b/test/classes/Controllers/Server/Status/AdvisorControllerTest.php index ccc80b2037..fb6518fb38 100644 --- a/test/classes/Controllers/Server/Status/AdvisorControllerTest.php +++ b/test/classes/Controllers/Server/Status/AdvisorControllerTest.php @@ -42,7 +42,7 @@ class AdvisorControllerTest extends AbstractTestCase $this->response = new ResponseRenderer(); $this->template = new Template(); - $this->data = new Data(); + $this->data = new Data($GLOBALS['dbi']); } public function testIndexWithoutData(): void diff --git a/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php index 48b4edc25d..043f03a869 100644 --- a/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php +++ b/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php @@ -45,7 +45,7 @@ class GeneralLogControllerTest extends AbstractTestCase $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['cfg']['Server']['host'] = 'localhost'; - $this->data = new Data(); + $this->data = new Data($this->dbi); } public function testGeneralLog(): void diff --git a/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php index 38fff4775c..cce986dc20 100644 --- a/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php +++ b/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php @@ -45,7 +45,7 @@ class LogVarsControllerTest extends AbstractTestCase $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['cfg']['Server']['host'] = 'localhost'; - $this->data = new Data(); + $this->data = new Data($this->dbi); } public function testLogVars(): void diff --git a/test/classes/Controllers/Server/Status/Monitor/QueryAnalyzerControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/QueryAnalyzerControllerTest.php index 5163e328cd..dd52e9398d 100644 --- a/test/classes/Controllers/Server/Status/Monitor/QueryAnalyzerControllerTest.php +++ b/test/classes/Controllers/Server/Status/Monitor/QueryAnalyzerControllerTest.php @@ -44,7 +44,7 @@ class QueryAnalyzerControllerTest extends AbstractTestCase $dummyDbi = new DbiDummy(); $dbi = $this->createDatabaseInterface($dummyDbi); - $controller = new QueryAnalyzerController($response, new Template(), new Data(), new Monitor($dbi), $dbi); + $controller = new QueryAnalyzerController($response, new Template(), new Data($dbi), new Monitor($dbi), $dbi); $_POST['database'] = 'database'; $_POST['query'] = 'query'; diff --git a/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php index e6545d22ff..6651c28a8e 100644 --- a/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php +++ b/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php @@ -45,7 +45,7 @@ class SlowLogControllerTest extends AbstractTestCase $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['cfg']['Server']['host'] = 'localhost'; - $this->data = new Data(); + $this->data = new Data($this->dbi); } public function testSlowLog(): void diff --git a/test/classes/Controllers/Server/Status/MonitorControllerTest.php b/test/classes/Controllers/Server/Status/MonitorControllerTest.php index dc66b5dfa9..a608c0043b 100644 --- a/test/classes/Controllers/Server/Status/MonitorControllerTest.php +++ b/test/classes/Controllers/Server/Status/MonitorControllerTest.php @@ -46,7 +46,7 @@ class MonitorControllerTest extends AbstractTestCase $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['cfg']['Server']['host'] = 'localhost'; - $this->data = new Data(); + $this->data = new Data($this->dbi); } public function testIndex(): void diff --git a/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php b/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php index c83e59f578..5fccaacb01 100644 --- a/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php +++ b/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php @@ -39,7 +39,7 @@ class RefreshControllerTest extends AbstractTestCase $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['cfg']['Server']['host'] = 'localhost'; - $this->data = new Data(); + $this->data = new Data($GLOBALS['dbi']); } public function testRefresh(): void diff --git a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php index daab49a4d0..a0ddb6e27c 100644 --- a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php +++ b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php @@ -45,7 +45,7 @@ class ProcessesControllerTest extends AbstractTestCase $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['cfg']['Server']['host'] = 'localhost'; - $this->data = new Data(); + $this->data = new Data($this->dbi); } public function testIndex(): void diff --git a/test/classes/Controllers/Server/Status/QueriesControllerTest.php b/test/classes/Controllers/Server/Status/QueriesControllerTest.php index 00c35c5b38..ad080dd58e 100644 --- a/test/classes/Controllers/Server/Status/QueriesControllerTest.php +++ b/test/classes/Controllers/Server/Status/QueriesControllerTest.php @@ -49,7 +49,7 @@ class QueriesControllerTest extends AbstractTestCase $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['cfg']['Server']['host'] = 'localhost'; - $this->data = new Data(); + $this->data = new Data($this->dbi); $this->data->status['Uptime'] = 36000; $this->data->usedQueries = [ 'Com_change_db' => '15', diff --git a/test/classes/Controllers/Server/Status/StatusControllerTest.php b/test/classes/Controllers/Server/Status/StatusControllerTest.php index 925bab1d27..a1f8152147 100644 --- a/test/classes/Controllers/Server/Status/StatusControllerTest.php +++ b/test/classes/Controllers/Server/Status/StatusControllerTest.php @@ -46,7 +46,7 @@ class StatusControllerTest extends AbstractTestCase public function testIndex(): void { - $data = new Data(); + $data = new Data($GLOBALS['dbi']); $bytesReceived = 100; $bytesSent = 200; diff --git a/test/classes/Controllers/Server/Status/VariablesControllerTest.php b/test/classes/Controllers/Server/Status/VariablesControllerTest.php index 708dd8e803..48191dd2d5 100644 --- a/test/classes/Controllers/Server/Status/VariablesControllerTest.php +++ b/test/classes/Controllers/Server/Status/VariablesControllerTest.php @@ -44,7 +44,7 @@ class VariablesControllerTest extends AbstractTestCase $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['cfg']['Server']['host'] = 'localhost'; - $this->data = new Data(); + $this->data = new Data($this->dbi); } public function testIndex(): void