Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaurício Meneghini Fauth <mauricio@fauth.dev>2022-07-13 06:15:53 +0300
committerMaurício Meneghini Fauth <mauricio@fauth.dev>2022-07-13 06:15:53 +0300
commit63d57b1f1c64a87d56d4cd2207963b54da458c03 (patch)
treea3a8f54dff48645eefc2a6ec6d4220d3096bfefe /test
parent641ba501916295d4dd42af5417108d97d100ef59 (diff)
Push dbi and dummyDbi members down
The idea is to only load the DBI when needed. Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'test')
-rw-r--r--test/classes/AbstractTestCase.php23
-rw-r--r--test/classes/BookmarkTest.php11
-rw-r--r--test/classes/Controllers/CheckRelationsControllerTest.php16
-rw-r--r--test/classes/Controllers/Database/MultiTableQuery/TablesControllerTest.php12
-rw-r--r--test/classes/Controllers/Database/PrivilegesControllerTest.php14
-rw-r--r--test/classes/Controllers/Database/Structure/FavoriteTableControllerTest.php16
-rw-r--r--test/classes/Controllers/Database/Structure/RealRowCountControllerTest.php16
-rw-r--r--test/classes/Controllers/Export/ExportControllerTest.php16
-rw-r--r--test/classes/Controllers/Export/Template/CreateControllerTest.php16
-rw-r--r--test/classes/Controllers/Export/Template/DeleteControllerTest.php16
-rw-r--r--test/classes/Controllers/Export/Template/LoadControllerTest.php16
-rw-r--r--test/classes/Controllers/Export/Template/UpdateControllerTest.php16
-rw-r--r--test/classes/Controllers/Import/ImportControllerTest.php16
-rw-r--r--test/classes/Controllers/NavigationControllerTest.php16
-rw-r--r--test/classes/Controllers/NormalizationControllerTest.php12
-rw-r--r--test/classes/Controllers/Server/BinlogControllerTest.php14
-rw-r--r--test/classes/Controllers/Server/CollationsControllerTest.php11
-rw-r--r--test/classes/Controllers/Server/Databases/CreateControllerTest.php16
-rw-r--r--test/classes/Controllers/Server/DatabasesControllerTest.php11
-rw-r--r--test/classes/Controllers/Server/EnginesControllerTest.php11
-rw-r--r--test/classes/Controllers/Server/PluginsControllerTest.php10
-rw-r--r--test/classes/Controllers/Server/PrivilegesControllerTest.php16
-rw-r--r--test/classes/Controllers/Server/ShowEngineControllerTest.php16
-rw-r--r--test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php11
-rw-r--r--test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php11
-rw-r--r--test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php11
-rw-r--r--test/classes/Controllers/Server/Status/MonitorControllerTest.php11
-rw-r--r--test/classes/Controllers/Server/Status/ProcessesControllerTest.php11
-rw-r--r--test/classes/Controllers/Server/Status/QueriesControllerTest.php11
-rw-r--r--test/classes/Controllers/Server/Status/StatusControllerTest.php11
-rw-r--r--test/classes/Controllers/Server/Status/VariablesControllerTest.php11
-rw-r--r--test/classes/Controllers/Sql/EnumValuesControllerTest.php12
-rw-r--r--test/classes/Controllers/Sql/SetValuesControllerTest.php12
-rw-r--r--test/classes/Controllers/Table/OperationsControllerTest.php16
-rw-r--r--test/classes/Controllers/Table/RecentFavoriteControllerTest.php16
-rw-r--r--test/classes/Controllers/Table/ReplaceControllerTest.php11
-rw-r--r--test/classes/Controllers/Table/SearchControllerTest.php14
-rw-r--r--test/classes/Controllers/Table/SqlControllerTest.php16
-rw-r--r--test/classes/Controllers/Table/Structure/ChangeControllerTest.php16
-rw-r--r--test/classes/Controllers/Table/StructureControllerTest.php16
-rw-r--r--test/classes/Controllers/Table/TrackingControllerTest.php16
-rw-r--r--test/classes/Controllers/Table/TriggersControllerTest.php16
-rw-r--r--test/classes/Controllers/Table/ZoomSearchControllerTest.php16
-rw-r--r--test/classes/Database/Designer/CommonTest.php26
-rw-r--r--test/classes/Dbal/DbiDummyTest.php11
-rw-r--r--test/classes/Display/ResultsTest.php10
-rw-r--r--test/classes/ErrorReportTest.php11
-rw-r--r--test/classes/Import/SimulateDmlTest.php16
-rw-r--r--test/classes/InsertEditTest.php10
-rw-r--r--test/classes/MenuTest.php11
-rw-r--r--test/classes/NormalizationTest.php10
-rw-r--r--test/classes/OperationsTest.php11
-rw-r--r--test/classes/Plugins/Export/ExportHtmlwordTest.php10
-rw-r--r--test/classes/Plugins/Export/ExportOdtTest.php10
-rw-r--r--test/classes/Plugins/Export/ExportTexytextTest.php10
-rw-r--r--test/classes/Plugins/Import/ImportCsvTest.php18
-rw-r--r--test/classes/Plugins/Import/ImportOdsTest.php16
-rw-r--r--test/classes/Server/PrivilegesTest.php14
-rw-r--r--test/classes/SqlQueryFormTest.php15
-rw-r--r--test/classes/SqlTest.php11
-rw-r--r--test/classes/StorageEngineTest.php11
-rw-r--r--test/classes/TwoFactorTest.php15
62 files changed, 804 insertions, 44 deletions
diff --git a/test/classes/AbstractTestCase.php b/test/classes/AbstractTestCase.php
index cf07295c60..d56e07972e 100644
--- a/test/classes/AbstractTestCase.php
+++ b/test/classes/AbstractTestCase.php
@@ -45,20 +45,6 @@ abstract class AbstractTestCase extends TestCase
];
/**
- * The DatabaseInterface loaded by setGlobalDbi
- *
- * @var DatabaseInterface
- */
- protected $dbi;
-
- /**
- * The DbiDummy loaded by setGlobalDbi
- *
- * @var DbiDummy
- */
- protected $dummyDbi;
-
- /**
* Prepares environment for the test.
* Clean all variables
*/
@@ -97,7 +83,7 @@ abstract class AbstractTestCase extends TestCase
// Config before DBI
$this->setGlobalConfig();
$this->loadContainerBuilder();
- $this->setGlobalDbi();
+ $GLOBALS['dbi'] = $this->createDatabaseInterface();
$this->setTheme();
Cache::purge();
}
@@ -160,13 +146,6 @@ abstract class AbstractTestCase extends TestCase
$this->assertTrue($response->hasSuccessState(), 'expected the request not to fail');
}
- protected function setGlobalDbi(): void
- {
- $this->dummyDbi = $this->createDbiDummy();
- $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
- $GLOBALS['dbi'] = $this->dbi;
- }
-
protected function createDatabaseInterface(?DbiExtension $extension = null): DatabaseInterface
{
return new DatabaseInterface($extension ?? $this->createDbiDummy());
diff --git a/test/classes/BookmarkTest.php b/test/classes/BookmarkTest.php
index 24cd7ad5f1..39006160d3 100644
--- a/test/classes/BookmarkTest.php
+++ b/test/classes/BookmarkTest.php
@@ -6,14 +6,22 @@ namespace PhpMyAdmin\Tests;
use PhpMyAdmin\Bookmark;
use PhpMyAdmin\ConfigStorage\Features\BookmarkFeature;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Dbal\DatabaseName;
use PhpMyAdmin\Dbal\TableName;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
/**
* @covers \PhpMyAdmin\Bookmark
*/
class BookmarkTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
@@ -21,6 +29,9 @@ class BookmarkTest extends AbstractTestCase
protected function setUp(): void
{
parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['cfg']['Server']['user'] = 'root';
$GLOBALS['cfg']['Server']['pmadb'] = 'phpmyadmin';
$GLOBALS['cfg']['Server']['bookmarktable'] = 'pma_bookmark';
diff --git a/test/classes/Controllers/CheckRelationsControllerTest.php b/test/classes/Controllers/CheckRelationsControllerTest.php
index bc3d36ff85..72085e2ba0 100644
--- a/test/classes/Controllers/CheckRelationsControllerTest.php
+++ b/test/classes/Controllers/CheckRelationsControllerTest.php
@@ -6,9 +6,11 @@ namespace PhpMyAdmin\Tests\Controllers;
use PhpMyAdmin\ConfigStorage\Relation;
use PhpMyAdmin\Controllers\CheckRelationsController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -16,6 +18,20 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class CheckRelationsControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testCheckRelationsController(): void
{
$GLOBALS['server'] = 1;
diff --git a/test/classes/Controllers/Database/MultiTableQuery/TablesControllerTest.php b/test/classes/Controllers/Database/MultiTableQuery/TablesControllerTest.php
index 7fa05e550f..a858c5cb98 100644
--- a/test/classes/Controllers/Database/MultiTableQuery/TablesControllerTest.php
+++ b/test/classes/Controllers/Database/MultiTableQuery/TablesControllerTest.php
@@ -5,18 +5,28 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Database\MultiTableQuery;
use PhpMyAdmin\Controllers\Database\MultiTableQuery\TablesController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
/**
* @covers \PhpMyAdmin\Controllers\Database\MultiTableQuery\TablesController
*/
class TablesControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
protected function setUp(): void
{
parent::setUp();
parent::setLanguage();
- parent::setGlobalDbi();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
parent::loadContainerBuilder();
parent::loadDbiIntoContainerBuilder();
$GLOBALS['server'] = 1;
diff --git a/test/classes/Controllers/Database/PrivilegesControllerTest.php b/test/classes/Controllers/Database/PrivilegesControllerTest.php
index 7a4845876c..57a08d6812 100644
--- a/test/classes/Controllers/Database/PrivilegesControllerTest.php
+++ b/test/classes/Controllers/Database/PrivilegesControllerTest.php
@@ -5,9 +5,11 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Database;
use PhpMyAdmin\Controllers\Database\PrivilegesController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Server\Privileges;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
use PhpMyAdmin\Url;
@@ -19,14 +21,20 @@ use function _pgettext;
*/
class PrivilegesControllerTest extends AbstractTestCase
{
- /**
- * Configures global environment.
- */
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
protected function setUp(): void
{
parent::setUp();
parent::setLanguage();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
}
public function testIndex(): void
diff --git a/test/classes/Controllers/Database/Structure/FavoriteTableControllerTest.php b/test/classes/Controllers/Database/Structure/FavoriteTableControllerTest.php
index b813115b25..b723148042 100644
--- a/test/classes/Controllers/Database/Structure/FavoriteTableControllerTest.php
+++ b/test/classes/Controllers/Database/Structure/FavoriteTableControllerTest.php
@@ -6,9 +6,11 @@ namespace PhpMyAdmin\Tests\Controllers\Database\Structure;
use PhpMyAdmin\ConfigStorage\Relation;
use PhpMyAdmin\Controllers\Database\Structure\FavoriteTableController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\RecentFavoriteTable;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub;
use ReflectionClass;
@@ -19,6 +21,20 @@ use function json_encode;
*/
class FavoriteTableControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testSynchronizeFavoriteTables(): void
{
$GLOBALS['server'] = 1;
diff --git a/test/classes/Controllers/Database/Structure/RealRowCountControllerTest.php b/test/classes/Controllers/Database/Structure/RealRowCountControllerTest.php
index e880a915b6..a2b801a982 100644
--- a/test/classes/Controllers/Database/Structure/RealRowCountControllerTest.php
+++ b/test/classes/Controllers/Database/Structure/RealRowCountControllerTest.php
@@ -5,8 +5,10 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Database\Structure;
use PhpMyAdmin\Controllers\Database\Structure\RealRowCountController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub;
use function json_encode;
@@ -16,6 +18,20 @@ use function json_encode;
*/
class RealRowCountControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testRealRowCount(): void
{
$GLOBALS['server'] = 1;
diff --git a/test/classes/Controllers/Export/ExportControllerTest.php b/test/classes/Controllers/Export/ExportControllerTest.php
index d5007f3921..98594de963 100644
--- a/test/classes/Controllers/Export/ExportControllerTest.php
+++ b/test/classes/Controllers/Export/ExportControllerTest.php
@@ -5,11 +5,13 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Export;
use PhpMyAdmin\Controllers\Export\ExportController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Export;
use PhpMyAdmin\FieldMetadata;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
use function htmlspecialchars;
@@ -25,6 +27,20 @@ use const MYSQLI_TYPE_STRING;
*/
class ExportControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testExportController(): void
{
parent::loadDbiIntoContainerBuilder();
diff --git a/test/classes/Controllers/Export/Template/CreateControllerTest.php b/test/classes/Controllers/Export/Template/CreateControllerTest.php
index 6b45a93084..238c46fdf7 100644
--- a/test/classes/Controllers/Export/Template/CreateControllerTest.php
+++ b/test/classes/Controllers/Export/Template/CreateControllerTest.php
@@ -7,11 +7,13 @@ namespace PhpMyAdmin\Tests\Controllers\Export\Template;
use PhpMyAdmin\ConfigStorage\Relation;
use PhpMyAdmin\ConfigStorage\RelationParameters;
use PhpMyAdmin\Controllers\Export\Template\CreateController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Export\Template as ExportTemplate;
use PhpMyAdmin\Export\TemplateModel;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -19,6 +21,20 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class CreateControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testCreate(): void
{
$GLOBALS['server'] = 1;
diff --git a/test/classes/Controllers/Export/Template/DeleteControllerTest.php b/test/classes/Controllers/Export/Template/DeleteControllerTest.php
index f738e4dfef..3adb988eb9 100644
--- a/test/classes/Controllers/Export/Template/DeleteControllerTest.php
+++ b/test/classes/Controllers/Export/Template/DeleteControllerTest.php
@@ -6,10 +6,12 @@ namespace PhpMyAdmin\Tests\Controllers\Export\Template;
use PhpMyAdmin\ConfigStorage\Relation;
use PhpMyAdmin\Controllers\Export\Template\DeleteController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Export\TemplateModel;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -17,6 +19,20 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class DeleteControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testDelete(): void
{
$GLOBALS['server'] = 1;
diff --git a/test/classes/Controllers/Export/Template/LoadControllerTest.php b/test/classes/Controllers/Export/Template/LoadControllerTest.php
index 042dfb811c..b2fcad5ed3 100644
--- a/test/classes/Controllers/Export/Template/LoadControllerTest.php
+++ b/test/classes/Controllers/Export/Template/LoadControllerTest.php
@@ -7,10 +7,12 @@ namespace PhpMyAdmin\Tests\Controllers\Export\Template;
use PhpMyAdmin\ConfigStorage\Relation;
use PhpMyAdmin\ConfigStorage\RelationParameters;
use PhpMyAdmin\Controllers\Export\Template\LoadController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Export\TemplateModel;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -18,6 +20,20 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class LoadControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testLoad(): void
{
$GLOBALS['server'] = 1;
diff --git a/test/classes/Controllers/Export/Template/UpdateControllerTest.php b/test/classes/Controllers/Export/Template/UpdateControllerTest.php
index 3d1cb7b169..abcced8f5f 100644
--- a/test/classes/Controllers/Export/Template/UpdateControllerTest.php
+++ b/test/classes/Controllers/Export/Template/UpdateControllerTest.php
@@ -6,10 +6,12 @@ namespace PhpMyAdmin\Tests\Controllers\Export\Template;
use PhpMyAdmin\ConfigStorage\Relation;
use PhpMyAdmin\Controllers\Export\Template\UpdateController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Export\TemplateModel;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -17,6 +19,20 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class UpdateControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testUpdate(): void
{
$GLOBALS['server'] = 1;
diff --git a/test/classes/Controllers/Import/ImportControllerTest.php b/test/classes/Controllers/Import/ImportControllerTest.php
index a7cbee1b59..1d429e5af9 100644
--- a/test/classes/Controllers/Import/ImportControllerTest.php
+++ b/test/classes/Controllers/Import/ImportControllerTest.php
@@ -5,13 +5,29 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Import;
use PhpMyAdmin\Controllers\Import\ImportController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
/**
* @covers \PhpMyAdmin\Controllers\Import\ImportController
*/
class ImportControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testIndexParametrized(): void
{
parent::loadContainerBuilder();
diff --git a/test/classes/Controllers/NavigationControllerTest.php b/test/classes/Controllers/NavigationControllerTest.php
index a6783e4961..50e254e77e 100644
--- a/test/classes/Controllers/NavigationControllerTest.php
+++ b/test/classes/Controllers/NavigationControllerTest.php
@@ -5,7 +5,9 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers;
use PhpMyAdmin\Controllers\NavigationController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use function sprintf;
@@ -14,6 +16,20 @@ use function sprintf;
*/
class NavigationControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testIndex(): void
{
parent::loadContainerBuilder();
diff --git a/test/classes/Controllers/NormalizationControllerTest.php b/test/classes/Controllers/NormalizationControllerTest.php
index b5155210f9..93589fcc45 100644
--- a/test/classes/Controllers/NormalizationControllerTest.php
+++ b/test/classes/Controllers/NormalizationControllerTest.php
@@ -5,7 +5,9 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers;
use PhpMyAdmin\Controllers\NormalizationController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use function json_encode;
@@ -14,12 +16,20 @@ use function json_encode;
*/
class NormalizationControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
protected function setUp(): void
{
parent::setUp();
parent::setLanguage();
parent::setTheme();
- parent::setGlobalDbi();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
parent::loadContainerBuilder();
parent::loadDbiIntoContainerBuilder();
$GLOBALS['server'] = 1;
diff --git a/test/classes/Controllers/Server/BinlogControllerTest.php b/test/classes/Controllers/Server/BinlogControllerTest.php
index 6499422712..2a14a563a8 100644
--- a/test/classes/Controllers/Server/BinlogControllerTest.php
+++ b/test/classes/Controllers/Server/BinlogControllerTest.php
@@ -5,8 +5,10 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Server;
use PhpMyAdmin\Controllers\Server\BinlogController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
use PhpMyAdmin\Url;
use PhpMyAdmin\Utils\SessionCache;
@@ -16,15 +18,21 @@ use PhpMyAdmin\Utils\SessionCache;
*/
class BinlogControllerTest extends AbstractTestCase
{
- /**
- * Prepares environment for the test.
- */
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
protected function setUp(): void
{
parent::setUp();
$GLOBALS['text_dir'] = 'ltr';
parent::setGlobalConfig();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['cfg']['MaxRows'] = 10;
$GLOBALS['cfg']['ServerDefault'] = 'server';
diff --git a/test/classes/Controllers/Server/CollationsControllerTest.php b/test/classes/Controllers/Server/CollationsControllerTest.php
index 2784e01443..d41f3e38e6 100644
--- a/test/classes/Controllers/Server/CollationsControllerTest.php
+++ b/test/classes/Controllers/Server/CollationsControllerTest.php
@@ -5,8 +5,10 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Server;
use PhpMyAdmin\Controllers\Server\CollationsController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -14,6 +16,12 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class CollationsControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/**
* Prepares environment for the test.
*/
@@ -23,6 +31,9 @@ class CollationsControllerTest extends AbstractTestCase
$GLOBALS['text_dir'] = 'ltr';
parent::setGlobalConfig();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$GLOBALS['db'] = 'db';
diff --git a/test/classes/Controllers/Server/Databases/CreateControllerTest.php b/test/classes/Controllers/Server/Databases/CreateControllerTest.php
index 53116cfa6a..0f154aa514 100644
--- a/test/classes/Controllers/Server/Databases/CreateControllerTest.php
+++ b/test/classes/Controllers/Server/Databases/CreateControllerTest.php
@@ -5,8 +5,10 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Server\Databases;
use PhpMyAdmin\Controllers\Server\Databases\CreateController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
use function __;
@@ -17,6 +19,20 @@ use function sprintf;
*/
final class CreateControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testCreateDatabase(): void
{
$GLOBALS['server'] = 1;
diff --git a/test/classes/Controllers/Server/DatabasesControllerTest.php b/test/classes/Controllers/Server/DatabasesControllerTest.php
index fb040ee0e9..e1436dd0f2 100644
--- a/test/classes/Controllers/Server/DatabasesControllerTest.php
+++ b/test/classes/Controllers/Server/DatabasesControllerTest.php
@@ -7,8 +7,10 @@ namespace PhpMyAdmin\Tests\Controllers\Server;
use PhpMyAdmin\ConfigStorage\Relation;
use PhpMyAdmin\ConfigStorage\RelationCleanup;
use PhpMyAdmin\Controllers\Server\DatabasesController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
use PhpMyAdmin\Transformations;
use stdClass;
@@ -20,11 +22,20 @@ use function __;
*/
class DatabasesControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
protected function setUp(): void
{
parent::setUp();
parent::setGlobalConfig();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$GLOBALS['db'] = 'pma_test';
diff --git a/test/classes/Controllers/Server/EnginesControllerTest.php b/test/classes/Controllers/Server/EnginesControllerTest.php
index 46a1d900d5..9c88eb8e4d 100644
--- a/test/classes/Controllers/Server/EnginesControllerTest.php
+++ b/test/classes/Controllers/Server/EnginesControllerTest.php
@@ -5,8 +5,10 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Server;
use PhpMyAdmin\Controllers\Server\EnginesController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -14,6 +16,12 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class EnginesControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/**
* Prepares environment for the test.
*/
@@ -23,6 +31,9 @@ class EnginesControllerTest extends AbstractTestCase
$GLOBALS['text_dir'] = 'ltr';
parent::setGlobalConfig();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$GLOBALS['db'] = 'db';
diff --git a/test/classes/Controllers/Server/PluginsControllerTest.php b/test/classes/Controllers/Server/PluginsControllerTest.php
index 1ea14cb65a..4926edd707 100644
--- a/test/classes/Controllers/Server/PluginsControllerTest.php
+++ b/test/classes/Controllers/Server/PluginsControllerTest.php
@@ -9,6 +9,7 @@ use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Server\Plugins;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\DummyResult;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
@@ -17,6 +18,12 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class PluginsControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/**
* Prepares environment for the test.
*/
@@ -26,6 +33,9 @@ class PluginsControllerTest extends AbstractTestCase
$GLOBALS['text_dir'] = 'ltr';
parent::setGlobalConfig();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$GLOBALS['db'] = 'db';
diff --git a/test/classes/Controllers/Server/PrivilegesControllerTest.php b/test/classes/Controllers/Server/PrivilegesControllerTest.php
index 424a49ab7d..99600d0fce 100644
--- a/test/classes/Controllers/Server/PrivilegesControllerTest.php
+++ b/test/classes/Controllers/Server/PrivilegesControllerTest.php
@@ -6,9 +6,11 @@ namespace PhpMyAdmin\Tests\Controllers\Server;
use PhpMyAdmin\ConfigStorage\Relation;
use PhpMyAdmin\Controllers\Server\PrivilegesController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -16,6 +18,20 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class PrivilegesControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testPrivilegesController(): void
{
$GLOBALS['server'] = 1;
diff --git a/test/classes/Controllers/Server/ShowEngineControllerTest.php b/test/classes/Controllers/Server/ShowEngineControllerTest.php
index 6da1e97071..8f607e6378 100644
--- a/test/classes/Controllers/Server/ShowEngineControllerTest.php
+++ b/test/classes/Controllers/Server/ShowEngineControllerTest.php
@@ -5,11 +5,13 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Server;
use PhpMyAdmin\Controllers\Server\ShowEngineController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Html\MySQLDocumentation;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\StorageEngine;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
use function __;
@@ -20,13 +22,25 @@ use function htmlspecialchars;
*/
class ShowEngineControllerTest extends AbstractTestCase
{
- public function testShowEngine(): void
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
{
parent::setUp();
$GLOBALS['text_dir'] = 'ltr';
parent::setGlobalConfig();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+ public function testShowEngine(): void
+ {
$GLOBALS['server'] = 1;
$GLOBALS['db'] = 'db';
$GLOBALS['table'] = 'table';
diff --git a/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php
index 772258e7b2..7011b5761c 100644
--- a/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php
+++ b/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Server\Status\Monitor;
use PhpMyAdmin\Controllers\Server\Status\Monitor\GeneralLogController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Server\Status\Data;
use PhpMyAdmin\Server\Status\Monitor;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -16,6 +18,12 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class GeneralLogControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var Data */
private $data;
@@ -25,6 +33,9 @@ class GeneralLogControllerTest extends AbstractTestCase
$GLOBALS['text_dir'] = 'ltr';
parent::setGlobalConfig();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$GLOBALS['db'] = 'db';
diff --git a/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php
index cec8744a61..102d825320 100644
--- a/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php
+++ b/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Server\Status\Monitor;
use PhpMyAdmin\Controllers\Server\Status\Monitor\LogVarsController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Server\Status\Data;
use PhpMyAdmin\Server\Status\Monitor;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -16,6 +18,12 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class LogVarsControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var Data */
private $data;
@@ -25,6 +33,9 @@ class LogVarsControllerTest extends AbstractTestCase
$GLOBALS['text_dir'] = 'ltr';
parent::setGlobalConfig();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$GLOBALS['db'] = 'db';
diff --git a/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php
index d98a449787..e1a17d37bc 100644
--- a/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php
+++ b/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Server\Status\Monitor;
use PhpMyAdmin\Controllers\Server\Status\Monitor\SlowLogController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Server\Status\Data;
use PhpMyAdmin\Server\Status\Monitor;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -16,6 +18,12 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class SlowLogControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var Data */
private $data;
@@ -25,6 +33,9 @@ class SlowLogControllerTest extends AbstractTestCase
$GLOBALS['text_dir'] = 'ltr';
parent::setGlobalConfig();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$GLOBALS['db'] = 'db';
diff --git a/test/classes/Controllers/Server/Status/MonitorControllerTest.php b/test/classes/Controllers/Server/Status/MonitorControllerTest.php
index 2b4861e846..9feeb80477 100644
--- a/test/classes/Controllers/Server/Status/MonitorControllerTest.php
+++ b/test/classes/Controllers/Server/Status/MonitorControllerTest.php
@@ -5,9 +5,11 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Server\Status;
use PhpMyAdmin\Controllers\Server\Status\MonitorController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Server\Status\Data;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
use function __;
@@ -17,6 +19,12 @@ use function __;
*/
class MonitorControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var Data */
private $data;
@@ -26,6 +34,9 @@ class MonitorControllerTest extends AbstractTestCase
$GLOBALS['text_dir'] = 'ltr';
parent::setGlobalConfig();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$GLOBALS['db'] = 'db';
diff --git a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php
index 226e5c5812..a1253165ac 100644
--- a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php
+++ b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Server\Status;
use PhpMyAdmin\Controllers\Server\Status\ProcessesController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Server\Status\Data;
use PhpMyAdmin\Server\Status\Processes;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -16,6 +18,12 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class ProcessesControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var Data */
private $data;
@@ -25,6 +33,9 @@ class ProcessesControllerTest extends AbstractTestCase
$GLOBALS['text_dir'] = 'ltr';
parent::setGlobalConfig();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$GLOBALS['db'] = 'db';
diff --git a/test/classes/Controllers/Server/Status/QueriesControllerTest.php b/test/classes/Controllers/Server/Status/QueriesControllerTest.php
index e174d344b2..0aa49fa341 100644
--- a/test/classes/Controllers/Server/Status/QueriesControllerTest.php
+++ b/test/classes/Controllers/Server/Status/QueriesControllerTest.php
@@ -5,9 +5,11 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Server\Status;
use PhpMyAdmin\Controllers\Server\Status\QueriesController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Server\Status\Data;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
use PhpMyAdmin\Util;
@@ -20,6 +22,12 @@ use function htmlspecialchars;
*/
class QueriesControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var Data */
private $data;
@@ -29,6 +37,9 @@ class QueriesControllerTest extends AbstractTestCase
$GLOBALS['text_dir'] = 'ltr';
parent::setGlobalConfig();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$GLOBALS['db'] = 'db';
diff --git a/test/classes/Controllers/Server/Status/StatusControllerTest.php b/test/classes/Controllers/Server/Status/StatusControllerTest.php
index 24398f790c..7aa4ce1fb9 100644
--- a/test/classes/Controllers/Server/Status/StatusControllerTest.php
+++ b/test/classes/Controllers/Server/Status/StatusControllerTest.php
@@ -5,11 +5,13 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Server\Status;
use PhpMyAdmin\Controllers\Server\Status\StatusController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Replication;
use PhpMyAdmin\ReplicationGui;
use PhpMyAdmin\Server\Status\Data;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -17,12 +19,21 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class StatusControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
protected function setUp(): void
{
parent::setUp();
$GLOBALS['text_dir'] = 'ltr';
parent::setGlobalConfig();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$GLOBALS['db'] = 'db';
diff --git a/test/classes/Controllers/Server/Status/VariablesControllerTest.php b/test/classes/Controllers/Server/Status/VariablesControllerTest.php
index e020664c1a..c4e81bb6a2 100644
--- a/test/classes/Controllers/Server/Status/VariablesControllerTest.php
+++ b/test/classes/Controllers/Server/Status/VariablesControllerTest.php
@@ -5,9 +5,11 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Server\Status;
use PhpMyAdmin\Controllers\Server\Status\VariablesController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Server\Status\Data;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -15,6 +17,12 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class VariablesControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var Data */
private $data;
@@ -23,6 +31,9 @@ class VariablesControllerTest extends AbstractTestCase
parent::setUp();
parent::setGlobalConfig();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['text_dir'] = 'ltr';
$GLOBALS['server'] = 1;
diff --git a/test/classes/Controllers/Sql/EnumValuesControllerTest.php b/test/classes/Controllers/Sql/EnumValuesControllerTest.php
index ece829a734..305727892b 100644
--- a/test/classes/Controllers/Sql/EnumValuesControllerTest.php
+++ b/test/classes/Controllers/Sql/EnumValuesControllerTest.php
@@ -5,17 +5,27 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Sql;
use PhpMyAdmin\Controllers\Sql\EnumValuesController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
/**
* @covers \PhpMyAdmin\Controllers\Sql\EnumValuesController
*/
class EnumValuesControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
protected function setUp(): void
{
parent::setUp();
- parent::setGlobalDbi();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
parent::loadContainerBuilder();
parent::loadDbiIntoContainerBuilder();
$GLOBALS['server'] = 1;
diff --git a/test/classes/Controllers/Sql/SetValuesControllerTest.php b/test/classes/Controllers/Sql/SetValuesControllerTest.php
index 0a3a941ae4..db738fd1ec 100644
--- a/test/classes/Controllers/Sql/SetValuesControllerTest.php
+++ b/test/classes/Controllers/Sql/SetValuesControllerTest.php
@@ -5,17 +5,27 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Sql;
use PhpMyAdmin\Controllers\Sql\SetValuesController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
/**
* @covers \PhpMyAdmin\Controllers\Sql\SetValuesController
*/
class SetValuesControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
protected function setUp(): void
{
parent::setUp();
- parent::setGlobalDbi();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
parent::loadContainerBuilder();
parent::loadDbiIntoContainerBuilder();
$GLOBALS['server'] = 1;
diff --git a/test/classes/Controllers/Table/OperationsControllerTest.php b/test/classes/Controllers/Table/OperationsControllerTest.php
index fad802c7a0..cd6949cd6d 100644
--- a/test/classes/Controllers/Table/OperationsControllerTest.php
+++ b/test/classes/Controllers/Table/OperationsControllerTest.php
@@ -6,15 +6,31 @@ namespace PhpMyAdmin\Tests\Controllers\Table;
use PhpMyAdmin\Charsets;
use PhpMyAdmin\Controllers\Table\OperationsController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\StorageEngine;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
/**
* @covers \PhpMyAdmin\Controllers\Table\OperationsController
*/
class OperationsControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testOperationsController(): void
{
$GLOBALS['server'] = 1;
diff --git a/test/classes/Controllers/Table/RecentFavoriteControllerTest.php b/test/classes/Controllers/Table/RecentFavoriteControllerTest.php
index a60da88a72..faad20c6b3 100644
--- a/test/classes/Controllers/Table/RecentFavoriteControllerTest.php
+++ b/test/classes/Controllers/Table/RecentFavoriteControllerTest.php
@@ -6,9 +6,11 @@ namespace PhpMyAdmin\Tests\Controllers\Table;
use PhpMyAdmin\Controllers\Sql\SqlController;
use PhpMyAdmin\Controllers\Table\RecentFavoriteController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\RecentFavoriteTable;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
use Psr\Container\ContainerInterface;
@@ -19,6 +21,20 @@ use Psr\Container\ContainerInterface;
*/
class RecentFavoriteControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testRecentFavoriteControllerWithValidDbAndTable(): void
{
$GLOBALS['server'] = 2;
diff --git a/test/classes/Controllers/Table/ReplaceControllerTest.php b/test/classes/Controllers/Table/ReplaceControllerTest.php
index a856fb282d..101a5266bb 100644
--- a/test/classes/Controllers/Table/ReplaceControllerTest.php
+++ b/test/classes/Controllers/Table/ReplaceControllerTest.php
@@ -11,6 +11,7 @@ use PhpMyAdmin\ConfigStorage\RelationParameters;
use PhpMyAdmin\Controllers\Sql\SqlController;
use PhpMyAdmin\Controllers\Table\ChangeController;
use PhpMyAdmin\Controllers\Table\ReplaceController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\FileListing;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\InsertEdit;
@@ -18,6 +19,7 @@ use PhpMyAdmin\Operations;
use PhpMyAdmin\Sql;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
use PhpMyAdmin\Transformations;
use Psr\Container\ContainerInterface;
@@ -27,9 +29,18 @@ use Psr\Container\ContainerInterface;
*/
class ReplaceControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
protected function setUp(): void
{
parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$GLOBALS['showtable'] = null;
$GLOBALS['PMA_PHP_SELF'] = 'index.php';
diff --git a/test/classes/Controllers/Table/SearchControllerTest.php b/test/classes/Controllers/Table/SearchControllerTest.php
index c2018852b1..3bcb1c794f 100644
--- a/test/classes/Controllers/Table/SearchControllerTest.php
+++ b/test/classes/Controllers/Table/SearchControllerTest.php
@@ -12,6 +12,7 @@ use PhpMyAdmin\FieldMetadata;
use PhpMyAdmin\Table\Search;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub;
use PhpMyAdmin\Types;
@@ -24,6 +25,12 @@ use const MYSQLI_TYPE_LONG;
*/
class SearchControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var ResponseStub */
private $response;
@@ -37,6 +44,9 @@ class SearchControllerTest extends AbstractTestCase
{
parent::setUp();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
/**
* SET these to avoid undefined index error
@@ -125,7 +135,9 @@ class SearchControllerTest extends AbstractTestCase
*/
public function testGetDataRowAction(): void
{
- parent::setGlobalDbi();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
parent::loadDbiIntoContainerBuilder();
parent::loadResponseIntoContainerBuilder();
diff --git a/test/classes/Controllers/Table/SqlControllerTest.php b/test/classes/Controllers/Table/SqlControllerTest.php
index 6d35bf4a0f..ae4270a3f5 100644
--- a/test/classes/Controllers/Table/SqlControllerTest.php
+++ b/test/classes/Controllers/Table/SqlControllerTest.php
@@ -6,10 +6,12 @@ namespace PhpMyAdmin\Tests\Controllers\Table;
use PhpMyAdmin\Config\PageSettings;
use PhpMyAdmin\Controllers\Table\SqlController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Html\MySQLDocumentation;
use PhpMyAdmin\SqlQueryForm;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -18,6 +20,20 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class SqlControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testSqlController(): void
{
$GLOBALS['server'] = 2;
diff --git a/test/classes/Controllers/Table/Structure/ChangeControllerTest.php b/test/classes/Controllers/Table/Structure/ChangeControllerTest.php
index c2133077ce..ad7a81e6c5 100644
--- a/test/classes/Controllers/Table/Structure/ChangeControllerTest.php
+++ b/test/classes/Controllers/Table/Structure/ChangeControllerTest.php
@@ -6,9 +6,11 @@ namespace PhpMyAdmin\Tests\Controllers\Table\Structure;
use PhpMyAdmin\ConfigStorage\Relation;
use PhpMyAdmin\Controllers\Table\Structure\ChangeController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Table\ColumnsDefinition;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer as ResponseStub;
use PhpMyAdmin\Transformations;
use ReflectionClass;
@@ -18,6 +20,20 @@ use ReflectionClass;
*/
class ChangeControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testChangeController(): void
{
$GLOBALS['server'] = 1;
diff --git a/test/classes/Controllers/Table/StructureControllerTest.php b/test/classes/Controllers/Table/StructureControllerTest.php
index f3e6a2334d..25ce6bd468 100644
--- a/test/classes/Controllers/Table/StructureControllerTest.php
+++ b/test/classes/Controllers/Table/StructureControllerTest.php
@@ -9,11 +9,13 @@ use PhpMyAdmin\ConfigStorage\Relation;
use PhpMyAdmin\ConfigStorage\RelationCleanup;
use PhpMyAdmin\Controllers\Table\StructureController;
use PhpMyAdmin\CreateAddField;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\FlashMessages;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\Index;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
use PhpMyAdmin\Transformations;
use PhpMyAdmin\Util;
@@ -23,6 +25,20 @@ use PhpMyAdmin\Util;
*/
class StructureControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testStructureController(): void
{
$GLOBALS['server'] = 2;
diff --git a/test/classes/Controllers/Table/TrackingControllerTest.php b/test/classes/Controllers/Table/TrackingControllerTest.php
index 113968d244..b2cbebc2d2 100644
--- a/test/classes/Controllers/Table/TrackingControllerTest.php
+++ b/test/classes/Controllers/Table/TrackingControllerTest.php
@@ -6,9 +6,11 @@ namespace PhpMyAdmin\Tests\Controllers\Table;
use PhpMyAdmin\ConfigStorage\Relation;
use PhpMyAdmin\Controllers\Table\TrackingController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\SqlQueryForm;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
use PhpMyAdmin\Tracking;
@@ -17,6 +19,20 @@ use PhpMyAdmin\Tracking;
*/
class TrackingControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testTrackingController(): void
{
$GLOBALS['server'] = 2;
diff --git a/test/classes/Controllers/Table/TriggersControllerTest.php b/test/classes/Controllers/Table/TriggersControllerTest.php
index a416de5a24..ac7e3f8aef 100644
--- a/test/classes/Controllers/Table/TriggersControllerTest.php
+++ b/test/classes/Controllers/Table/TriggersControllerTest.php
@@ -5,8 +5,10 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers\Table;
use PhpMyAdmin\Controllers\Table\TriggersController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -14,6 +16,20 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class TriggersControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testTriggersController(): void
{
$GLOBALS['server'] = 2;
diff --git a/test/classes/Controllers/Table/ZoomSearchControllerTest.php b/test/classes/Controllers/Table/ZoomSearchControllerTest.php
index 75378df1fe..cb6f076749 100644
--- a/test/classes/Controllers/Table/ZoomSearchControllerTest.php
+++ b/test/classes/Controllers/Table/ZoomSearchControllerTest.php
@@ -6,9 +6,11 @@ namespace PhpMyAdmin\Tests\Controllers\Table;
use PhpMyAdmin\ConfigStorage\Relation;
use PhpMyAdmin\Controllers\Table\ZoomSearchController;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Table\Search;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
/**
@@ -16,6 +18,20 @@ use PhpMyAdmin\Tests\Stubs\ResponseRenderer;
*/
class ZoomSearchControllerTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testZoomSearchController(): void
{
$GLOBALS['server'] = 2;
diff --git a/test/classes/Database/Designer/CommonTest.php b/test/classes/Database/Designer/CommonTest.php
index bac5348d46..e6f97fee23 100644
--- a/test/classes/Database/Designer/CommonTest.php
+++ b/test/classes/Database/Designer/CommonTest.php
@@ -9,6 +9,7 @@ use PhpMyAdmin\ConfigStorage\RelationParameters;
use PhpMyAdmin\Database\Designer\Common;
use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\DummyResult;
use PhpMyAdmin\Version;
@@ -19,6 +20,12 @@ use function sprintf;
*/
class CommonTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var Common */
private $designerCommon;
@@ -28,6 +35,9 @@ class CommonTest extends AbstractTestCase
protected function setUp(): void
{
parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$_SESSION = [
'relation' => [
@@ -359,7 +369,9 @@ class CommonTest extends AbstractTestCase
'relation' => 'rel db',
])->toArray();
- parent::setGlobalDbi();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$this->loadTestDataForRelationDeleteAddTests(
'CREATE TABLE `table\'2` (`field\'1` int(11) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1'
);
@@ -383,7 +395,9 @@ class CommonTest extends AbstractTestCase
'relation' => 'rel db',
])->toArray();
- parent::setGlobalDbi();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$this->loadTestDataForRelationDeleteAddTests(
'CREATE TABLE `table\'2` (`field\'1` int(11) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1'
@@ -426,7 +440,9 @@ class CommonTest extends AbstractTestCase
'relation' => 'rel db',
])->toArray();
- parent::setGlobalDbi();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$this->loadTestDataForRelationDeleteAddTests(
'CREATE TABLE `table\'2` ('
@@ -489,7 +505,9 @@ class CommonTest extends AbstractTestCase
'relation' => 'rel db',
])->toArray();
- parent::setGlobalDbi();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$this->loadTestDataForRelationDeleteAddTests(
'CREATE TABLE `table\'2` (`field\'1` int(11) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1'
diff --git a/test/classes/Dbal/DbiDummyTest.php b/test/classes/Dbal/DbiDummyTest.php
index b1987f2ff6..9aa180dfc9 100644
--- a/test/classes/Dbal/DbiDummyTest.php
+++ b/test/classes/Dbal/DbiDummyTest.php
@@ -4,8 +4,10 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Dbal;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Query\Utilities;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\DummyResult;
/**
@@ -13,12 +15,21 @@ use PhpMyAdmin\Tests\Stubs\DummyResult;
*/
class DbiDummyTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/**
* Configures test parameters.
*/
protected function setUp(): void
{
parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['cfg']['DBG']['sql'] = false;
$GLOBALS['cfg']['IconvExtraParams'] = '';
$GLOBALS['server'] = 1;
diff --git a/test/classes/Display/ResultsTest.php b/test/classes/Display/ResultsTest.php
index c2956979bb..31fd1632c8 100644
--- a/test/classes/Display/ResultsTest.php
+++ b/test/classes/Display/ResultsTest.php
@@ -19,6 +19,7 @@ use PhpMyAdmin\SqlParser\Utils\Query;
use PhpMyAdmin\StatementInfo;
use PhpMyAdmin\Template;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Transformations;
use stdClass;
@@ -44,6 +45,12 @@ use const MYSQLI_TYPE_TIMESTAMP;
*/
class ResultsTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var DisplayResults */
protected $object;
@@ -56,6 +63,9 @@ class ResultsTest extends AbstractTestCase
parent::setUp();
parent::setLanguage();
parent::setGlobalConfig();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$this->setTheme();
$GLOBALS['server'] = 0;
$GLOBALS['db'] = 'db';
diff --git a/test/classes/ErrorReportTest.php b/test/classes/ErrorReportTest.php
index b10a6712f2..14db8db1cc 100644
--- a/test/classes/ErrorReportTest.php
+++ b/test/classes/ErrorReportTest.php
@@ -5,9 +5,11 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests;
use PhpMyAdmin\ConfigStorage\Relation;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Error;
use PhpMyAdmin\ErrorReport;
use PhpMyAdmin\Template;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Utils\HttpRequest;
use PhpMyAdmin\Version;
@@ -24,12 +26,21 @@ use const JSON_UNESCAPED_SLASHES;
*/
class ErrorReportTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var ErrorReport $errorReport */
private $errorReport;
protected function setUp(): void
{
parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$GLOBALS['cfg']['ServerDefault'] = 1;
$GLOBALS['cfg']['ProxyUrl'] = '';
diff --git a/test/classes/Import/SimulateDmlTest.php b/test/classes/Import/SimulateDmlTest.php
index f17ee3c440..276aa6cdd0 100644
--- a/test/classes/Import/SimulateDmlTest.php
+++ b/test/classes/Import/SimulateDmlTest.php
@@ -5,10 +5,12 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Import;
use PhpMyAdmin\Core;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Html\Generator;
use PhpMyAdmin\Import\SimulateDml;
use PhpMyAdmin\SqlParser\Parser;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Url;
/**
@@ -16,6 +18,20 @@ use PhpMyAdmin\Url;
*/
class SimulateDmlTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
/**
* @dataProvider providerForTestGetMatchedRows
*/
diff --git a/test/classes/InsertEditTest.php b/test/classes/InsertEditTest.php
index 984d0077cd..ecdff50432 100644
--- a/test/classes/InsertEditTest.php
+++ b/test/classes/InsertEditTest.php
@@ -14,6 +14,7 @@ use PhpMyAdmin\InsertEdit;
use PhpMyAdmin\ResponseRenderer;
use PhpMyAdmin\Table;
use PhpMyAdmin\Template;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\DummyResult;
use PhpMyAdmin\Transformations;
use PhpMyAdmin\Url;
@@ -37,6 +38,12 @@ use const MYSQLI_TYPE_TINY;
*/
class InsertEditTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var InsertEdit */
private $insertEdit;
@@ -49,6 +56,9 @@ class InsertEditTest extends AbstractTestCase
parent::setLanguage();
parent::setGlobalConfig();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$GLOBALS['PMA_PHP_SELF'] = 'index.php';
$GLOBALS['cfg']['ServerDefault'] = 1;
diff --git a/test/classes/MenuTest.php b/test/classes/MenuTest.php
index 3298ee5c85..01a943cc14 100644
--- a/test/classes/MenuTest.php
+++ b/test/classes/MenuTest.php
@@ -5,13 +5,21 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests;
use PhpMyAdmin\Core;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Menu;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
/**
* @covers \PhpMyAdmin\Menu
*/
class MenuTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/**
* Configures global environment.
*/
@@ -19,6 +27,9 @@ class MenuTest extends AbstractTestCase
{
parent::setUp();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['server'] = 0;
diff --git a/test/classes/NormalizationTest.php b/test/classes/NormalizationTest.php
index d867021de4..234352301b 100644
--- a/test/classes/NormalizationTest.php
+++ b/test/classes/NormalizationTest.php
@@ -9,6 +9,7 @@ use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Message;
use PhpMyAdmin\Normalization;
use PhpMyAdmin\Template;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Transformations;
use PhpMyAdmin\Types;
use PhpMyAdmin\Url;
@@ -23,6 +24,12 @@ use function json_encode;
*/
class NormalizationTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var Normalization */
private $normalization;
@@ -32,6 +39,9 @@ class NormalizationTest extends AbstractTestCase
protected function setUp(): void
{
parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['cfg']['LimitChars'] = 50;
$GLOBALS['cfg']['ServerDefault'] = 'PMA_server';
$GLOBALS['cfg']['ShowHint'] = true;
diff --git a/test/classes/OperationsTest.php b/test/classes/OperationsTest.php
index 4f1075ebcc..ff5cc8f608 100644
--- a/test/classes/OperationsTest.php
+++ b/test/classes/OperationsTest.php
@@ -5,7 +5,9 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests;
use PhpMyAdmin\ConfigStorage\Relation;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Operations;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use function array_merge;
@@ -14,12 +16,21 @@ use function array_merge;
*/
class OperationsTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var Operations */
private $object;
protected function setUp(): void
{
parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
diff --git a/test/classes/Plugins/Export/ExportHtmlwordTest.php b/test/classes/Plugins/Export/ExportHtmlwordTest.php
index f9b911514c..47d8de8022 100644
--- a/test/classes/Plugins/Export/ExportHtmlwordTest.php
+++ b/test/classes/Plugins/Export/ExportHtmlwordTest.php
@@ -16,6 +16,7 @@ use PhpMyAdmin\Properties\Options\Items\RadioPropertyItem;
use PhpMyAdmin\Properties\Options\Items\TextPropertyItem;
use PhpMyAdmin\Properties\Plugins\ExportPluginProperties;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\DummyResult;
use PhpMyAdmin\Transformations;
use ReflectionMethod;
@@ -32,6 +33,12 @@ use function ob_start;
*/
class ExportHtmlwordTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var ExportHtmlword */
protected $object;
@@ -41,6 +48,9 @@ class ExportHtmlwordTest extends AbstractTestCase
protected function setUp(): void
{
parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 0;
$this->object = new ExportHtmlword(
new Relation($GLOBALS['dbi']),
diff --git a/test/classes/Plugins/Export/ExportOdtTest.php b/test/classes/Plugins/Export/ExportOdtTest.php
index db7bbe1ea8..9f9c4c4a19 100644
--- a/test/classes/Plugins/Export/ExportOdtTest.php
+++ b/test/classes/Plugins/Export/ExportOdtTest.php
@@ -17,6 +17,7 @@ use PhpMyAdmin\Properties\Options\Items\RadioPropertyItem;
use PhpMyAdmin\Properties\Options\Items\TextPropertyItem;
use PhpMyAdmin\Properties\Plugins\ExportPluginProperties;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Tests\Stubs\DummyResult;
use PhpMyAdmin\Transformations;
use ReflectionMethod;
@@ -38,6 +39,12 @@ use const MYSQLI_TYPE_STRING;
*/
class ExportOdtTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var ExportOdt */
protected $object;
@@ -47,6 +54,9 @@ class ExportOdtTest extends AbstractTestCase
protected function setUp(): void
{
parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['output_charset_conversion'] = false;
diff --git a/test/classes/Plugins/Export/ExportTexytextTest.php b/test/classes/Plugins/Export/ExportTexytextTest.php
index 44cc59ce5b..ea50468b47 100644
--- a/test/classes/Plugins/Export/ExportTexytextTest.php
+++ b/test/classes/Plugins/Export/ExportTexytextTest.php
@@ -16,6 +16,7 @@ use PhpMyAdmin\Properties\Options\Items\RadioPropertyItem;
use PhpMyAdmin\Properties\Options\Items\TextPropertyItem;
use PhpMyAdmin\Properties\Plugins\ExportPluginProperties;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Transformations;
use ReflectionMethod;
use ReflectionProperty;
@@ -30,6 +31,12 @@ use function ob_start;
*/
class ExportTexytextTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var ExportTexytext */
protected $object;
@@ -39,6 +46,9 @@ class ExportTexytextTest extends AbstractTestCase
protected function setUp(): void
{
parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
diff --git a/test/classes/Plugins/Import/ImportCsvTest.php b/test/classes/Plugins/Import/ImportCsvTest.php
index cc59a88448..963acdebc9 100644
--- a/test/classes/Plugins/Import/ImportCsvTest.php
+++ b/test/classes/Plugins/Import/ImportCsvTest.php
@@ -8,6 +8,7 @@ use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\File;
use PhpMyAdmin\Plugins\Import\ImportCsv;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use function __;
use function basename;
@@ -17,6 +18,12 @@ use function basename;
*/
class ImportCsvTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var ImportCsv */
protected $object;
@@ -27,6 +34,9 @@ class ImportCsvTest extends AbstractTestCase
protected function setUp(): void
{
parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 0;
$GLOBALS['plugin_param'] = 'csv';
$GLOBALS['errorUrl'] = 'index.php?route=/';
@@ -238,7 +248,9 @@ class ImportCsvTest extends AbstractTestCase
$GLOBALS['csv_terminated'] = ',';
$GLOBALS['import_text'] = '"Row 1","Row 2"' . "\n" . '"123","456"';
- parent::setGlobalDbi();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$this->dummyDbi->addResult(
'SHOW DATABASES',
@@ -282,7 +294,9 @@ class ImportCsvTest extends AbstractTestCase
$_REQUEST['csv_col_names'] = 'something';
- parent::setGlobalDbi();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$this->dummyDbi->addResult(
'SHOW DATABASES',
diff --git a/test/classes/Plugins/Import/ImportOdsTest.php b/test/classes/Plugins/Import/ImportOdsTest.php
index 769bb41814..f32ae22761 100644
--- a/test/classes/Plugins/Import/ImportOdsTest.php
+++ b/test/classes/Plugins/Import/ImportOdsTest.php
@@ -4,9 +4,11 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests\Plugins\Import;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\File;
use PhpMyAdmin\Plugins\Import\ImportOds;
use PhpMyAdmin\Tests\AbstractTestCase;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use function __;
use function str_repeat;
@@ -17,6 +19,12 @@ use function str_repeat;
*/
class ImportOdsTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var ImportOds */
protected $object;
@@ -106,7 +114,9 @@ class ImportOdsTest extends AbstractTestCase
$GLOBALS['import_file'] = 'test/test_data/db_test.ods';
$_REQUEST['ods_empty_rows'] = true;
- parent::setGlobalDbi();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$importHandle = new File($GLOBALS['import_file']);
$importHandle->setDecompressContent(true);
@@ -165,7 +175,9 @@ class ImportOdsTest extends AbstractTestCase
$_REQUEST['ods_col_names'] = true;
$_REQUEST['ods_empty_rows'] = $odsEmptyRowsMode;
- parent::setGlobalDbi();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$importHandle = new File($GLOBALS['import_file']);
$importHandle->setDecompressContent(false);// Not compressed
diff --git a/test/classes/Server/PrivilegesTest.php b/test/classes/Server/PrivilegesTest.php
index 507e58e5cc..2a2a1ebba7 100644
--- a/test/classes/Server/PrivilegesTest.php
+++ b/test/classes/Server/PrivilegesTest.php
@@ -33,6 +33,20 @@ use function implode;
*/
class PrivilegesTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
+ }
+
public function testGetDataForDBInfo(): void
{
$_REQUEST['username'] = 'PMA_username';
diff --git a/test/classes/SqlQueryFormTest.php b/test/classes/SqlQueryFormTest.php
index fdf4d7711d..ff74ff5be9 100644
--- a/test/classes/SqlQueryFormTest.php
+++ b/test/classes/SqlQueryFormTest.php
@@ -6,10 +6,12 @@ namespace PhpMyAdmin\Tests;
use PhpMyAdmin\ConfigStorage\RelationParameters;
use PhpMyAdmin\Core;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Encoding;
use PhpMyAdmin\Html\MySQLDocumentation;
use PhpMyAdmin\SqlQueryForm;
use PhpMyAdmin\Template;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Url;
use function __;
@@ -20,6 +22,12 @@ use function htmlspecialchars;
*/
class SqlQueryFormTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var SqlQueryForm */
private $sqlQueryForm;
@@ -30,6 +38,9 @@ class SqlQueryFormTest extends AbstractTestCase
{
parent::setUp();
parent::setLanguage();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$this->sqlQueryForm = new SqlQueryForm(new Template());
//$GLOBALS
@@ -67,7 +78,9 @@ class SqlQueryFormTest extends AbstractTestCase
$GLOBALS['cfg']['Server']['pmadb'] = 'pmadb';
$GLOBALS['cfg']['Server']['bookmarktable'] = 'bookmarktable';
- parent::setGlobalDbi();
+ $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`',
[
diff --git a/test/classes/SqlTest.php b/test/classes/SqlTest.php
index 6cc393239d..1034123efb 100644
--- a/test/classes/SqlTest.php
+++ b/test/classes/SqlTest.php
@@ -6,11 +6,13 @@ namespace PhpMyAdmin\Tests;
use PhpMyAdmin\ConfigStorage\Relation;
use PhpMyAdmin\ConfigStorage\RelationCleanup;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\FieldMetadata;
use PhpMyAdmin\Operations;
use PhpMyAdmin\ParseAnalyze;
use PhpMyAdmin\Sql;
use PhpMyAdmin\Template;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\Transformations;
use stdClass;
@@ -23,6 +25,12 @@ use const MYSQLI_TYPE_VAR_STRING;
*/
class SqlTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var Sql */
private $sql;
@@ -34,6 +42,9 @@ class SqlTest extends AbstractTestCase
parent::setUp();
parent::setLanguage();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$GLOBALS['db'] = 'db';
$GLOBALS['table'] = 'table';
diff --git a/test/classes/StorageEngineTest.php b/test/classes/StorageEngineTest.php
index 819890ec89..430f2bc253 100644
--- a/test/classes/StorageEngineTest.php
+++ b/test/classes/StorageEngineTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests;
use PhpMyAdmin\Cache;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Engines\Bdb;
use PhpMyAdmin\Engines\Berkeleydb;
use PhpMyAdmin\Engines\Binlog;
@@ -18,6 +19,7 @@ use PhpMyAdmin\Engines\Ndbcluster;
use PhpMyAdmin\Engines\Pbxt;
use PhpMyAdmin\Engines\PerformanceSchema;
use PhpMyAdmin\StorageEngine;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PHPUnit\Framework\MockObject\MockObject;
use function json_encode;
@@ -27,6 +29,12 @@ use function json_encode;
*/
class StorageEngineTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
/** @var StorageEngine|MockObject */
protected $object;
@@ -37,6 +45,9 @@ class StorageEngineTest extends AbstractTestCase
protected function setUp(): void
{
parent::setUp();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$this->object = $this->getMockForAbstractClass(
StorageEngine::class,
diff --git a/test/classes/TwoFactorTest.php b/test/classes/TwoFactorTest.php
index 19c6bb1a3b..42c92d98df 100644
--- a/test/classes/TwoFactorTest.php
+++ b/test/classes/TwoFactorTest.php
@@ -6,7 +6,9 @@ namespace PhpMyAdmin\Tests;
use CodeLts\U2F\U2FServer\RegistrationRequest;
use CodeLts\U2F\U2FServer\SignRequest;
+use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Plugins\TwoFactor\Application;
+use PhpMyAdmin\Tests\Stubs\DbiDummy;
use PhpMyAdmin\TwoFactor;
use function count;
@@ -21,10 +23,19 @@ use const JSON_UNESCAPED_SLASHES;
*/
class TwoFactorTest extends AbstractTestCase
{
+ /** @var DatabaseInterface */
+ protected $dbi;
+
+ /** @var DbiDummy */
+ protected $dummyDbi;
+
protected function setUp(): void
{
parent::setUp();
parent::setTheme();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$GLOBALS['server'] = 1;
$GLOBALS['db'] = '';
$GLOBALS['table'] = 'table';
@@ -66,7 +77,9 @@ class TwoFactorTest extends AbstractTestCase
$GLOBALS['cfg']['Server']['designer_settings'] = '';
$GLOBALS['cfg']['Server']['export_templates'] = '';
- parent::setGlobalDbi();
+ $this->dummyDbi = $this->createDbiDummy();
+ $this->dbi = $this->createDatabaseInterface($this->dummyDbi);
+ $GLOBALS['dbi'] = $this->dbi;
$this->dummyDbi->removeDefaultResults();