diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-07-28 07:00:08 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-07-28 07:00:08 +0300 |
commit | 3c618c22a9a717212742dd9a6d01d5277f3ba5b1 (patch) | |
tree | 6cd45de79354d23f78f29f40f3a794193ed6d671 /test | |
parent | b0c4426a43e82decacf60cbd14f8b318482add69 (diff) |
Add ServerRequest parameter to all controllers
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'test')
49 files changed, 164 insertions, 68 deletions
diff --git a/test/classes/Controllers/CollationConnectionControllerTest.php b/test/classes/Controllers/CollationConnectionControllerTest.php index 393fc2ea41..1b581104fd 100644 --- a/test/classes/Controllers/CollationConnectionControllerTest.php +++ b/test/classes/Controllers/CollationConnectionControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers; use PhpMyAdmin\Config; use PhpMyAdmin\Controllers\CollationConnectionController; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\ResponseRenderer; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; @@ -28,6 +29,10 @@ class CollationConnectionControllerTest extends AbstractTestCase $config->expects($this->once())->method('setUserValue') ->with(null, 'DefaultConnectionCollation', 'utf8mb4_general_ci', 'utf8mb4_unicode_ci'); - (new CollationConnectionController($response, new Template(), $config))(); + (new CollationConnectionController( + $response, + new Template(), + $config + ))($this->createStub(ServerRequest::class)); } } diff --git a/test/classes/Controllers/Database/MultiTableQuery/TablesControllerTest.php b/test/classes/Controllers/Database/MultiTableQuery/TablesControllerTest.php index a858c5cb98..3ee720c6fe 100644 --- a/test/classes/Controllers/Database/MultiTableQuery/TablesControllerTest.php +++ b/test/classes/Controllers/Database/MultiTableQuery/TablesControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Database\MultiTableQuery; use PhpMyAdmin\Controllers\Database\MultiTableQuery\TablesController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; @@ -44,7 +45,7 @@ class TablesControllerTest extends AbstractTestCase /** @var TablesController $multiTableQueryController */ $multiTableQueryController = $GLOBALS['containerBuilder']->get(TablesController::class); - $multiTableQueryController(); + $multiTableQueryController($this->createStub(ServerRequest::class)); $this->assertSame( [ 'foreignKeyConstrains' => [ diff --git a/test/classes/Controllers/Database/PrivilegesControllerTest.php b/test/classes/Controllers/Database/PrivilegesControllerTest.php index 57a08d6812..c3d1ae8171 100644 --- a/test/classes/Controllers/Database/PrivilegesControllerTest.php +++ b/test/classes/Controllers/Database/PrivilegesControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Database; use PhpMyAdmin\Controllers\Database\PrivilegesController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Server\Privileges; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; @@ -65,7 +66,12 @@ class PrivilegesControllerTest extends AbstractTestCase ->willReturn($privileges); $response = new ResponseRenderer(); - (new PrivilegesController($response, new Template(), $serverPrivileges, $GLOBALS['dbi']))(); + (new PrivilegesController( + $response, + new Template(), + $serverPrivileges, + $GLOBALS['dbi'] + ))($this->createStub(ServerRequest::class)); $actual = $response->getHTMLResult(); $this->assertStringContainsString( diff --git a/test/classes/Controllers/Database/Structure/RealRowCountControllerTest.php b/test/classes/Controllers/Database/Structure/RealRowCountControllerTest.php index a2b801a982..99af60b65a 100644 --- a/test/classes/Controllers/Database/Structure/RealRowCountControllerTest.php +++ b/test/classes/Controllers/Database/Structure/RealRowCountControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Database\Structure; use PhpMyAdmin\Controllers\Database\Structure\RealRowCountController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; @@ -46,14 +47,14 @@ class RealRowCountControllerTest extends AbstractTestCase $_REQUEST['table'] = 'City'; - (new RealRowCountController($response, new Template(), $this->dbi))(); + (new RealRowCountController($response, new Template(), $this->dbi))($this->createStub(ServerRequest::class)); $json = $response->getJSONResult(); $this->assertEquals('4,079', $json['real_row_count']); $_REQUEST['real_row_count_all'] = 'on'; - (new RealRowCountController($response, new Template(), $this->dbi))(); + (new RealRowCountController($response, new Template(), $this->dbi))($this->createStub(ServerRequest::class)); $json = $response->getJSONResult(); $expected = [ diff --git a/test/classes/Controllers/Import/ImportControllerTest.php b/test/classes/Controllers/Import/ImportControllerTest.php index 1d429e5af9..c2c48534dc 100644 --- a/test/classes/Controllers/Import/ImportControllerTest.php +++ b/test/classes/Controllers/Import/ImportControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Import; use PhpMyAdmin\Controllers\Import\ImportController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; @@ -73,7 +74,7 @@ class ImportControllerTest extends AbstractTestCase $importController = $GLOBALS['containerBuilder']->get(ImportController::class); $this->dummyDbi->addSelectDb('pma_test'); $this->dummyDbi->addSelectDb('pma_test'); - $importController(); + $importController($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $this->assertResponseWasSuccessfull(); diff --git a/test/classes/Controllers/LintControllerTest.php b/test/classes/Controllers/LintControllerTest.php index 9df89bd1a9..d125d9b1ae 100644 --- a/test/classes/Controllers/LintControllerTest.php +++ b/test/classes/Controllers/LintControllerTest.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Controllers; use PhpMyAdmin\Controllers\LintController; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; @@ -26,7 +27,7 @@ class LintControllerTest extends AbstractTestCase { $_POST = []; - $this->getLintController()(); + $this->getLintController()($this->createStub(ServerRequest::class)); $output = $this->getActualOutputForAssertion(); $this->assertJson($output); @@ -37,7 +38,7 @@ class LintControllerTest extends AbstractTestCase { $_POST['sql_query'] = 'SELECT * FROM `actor` WHERE `actor_id` = 1;'; - $this->getLintController()(); + $this->getLintController()($this->createStub(ServerRequest::class)); $output = $this->getActualOutputForAssertion(); $this->assertJson($output); @@ -84,7 +85,7 @@ class LintControllerTest extends AbstractTestCase ]); $this->assertNotFalse($expectedJson); - $this->getLintController()(); + $this->getLintController()($this->createStub(ServerRequest::class)); $output = $this->getActualOutputForAssertion(); $this->assertJson($output); diff --git a/test/classes/Controllers/NavigationControllerTest.php b/test/classes/Controllers/NavigationControllerTest.php index 50e254e77e..ededc3f9bc 100644 --- a/test/classes/Controllers/NavigationControllerTest.php +++ b/test/classes/Controllers/NavigationControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers; use PhpMyAdmin\Controllers\NavigationController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; @@ -129,7 +130,7 @@ class NavigationControllerTest extends AbstractTestCase $navigationController = $GLOBALS['containerBuilder']->get(NavigationController::class); $_POST['full'] = '1'; $this->setResponseIsAjax(); - $navigationController(); + $navigationController($this->createStub(ServerRequest::class)); $this->assertResponseWasSuccessfull(); $responseMessage = $this->getResponseJsonResult()['message']; @@ -283,7 +284,7 @@ class NavigationControllerTest extends AbstractTestCase $navigationController = $GLOBALS['containerBuilder']->get(NavigationController::class); $_POST['full'] = '1'; $this->setResponseIsAjax(); - $navigationController(); + $navigationController($this->createStub(ServerRequest::class)); $this->assertResponseWasSuccessfull(); $responseMessage = $this->getResponseJsonResult()['message']; diff --git a/test/classes/Controllers/NormalizationControllerTest.php b/test/classes/Controllers/NormalizationControllerTest.php index 93589fcc45..1000ecb90a 100644 --- a/test/classes/Controllers/NormalizationControllerTest.php +++ b/test/classes/Controllers/NormalizationControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers; use PhpMyAdmin\Controllers\NormalizationController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; @@ -73,7 +74,7 @@ class NormalizationControllerTest extends AbstractTestCase $GLOBALS['containerBuilder']->setParameter('table', $GLOBALS['table']); /** @var NormalizationController $normalizationController */ $normalizationController = $GLOBALS['containerBuilder']->get(NormalizationController::class); - $normalizationController(); + $normalizationController($this->createStub(ServerRequest::class)); $this->assertResponseWasSuccessfull(); @@ -123,7 +124,7 @@ class NormalizationControllerTest extends AbstractTestCase $GLOBALS['containerBuilder']->setParameter('table', $GLOBALS['table']); /** @var NormalizationController $normalizationController */ $normalizationController = $GLOBALS['containerBuilder']->get(NormalizationController::class); - $normalizationController(); + $normalizationController($this->createStub(ServerRequest::class)); $this->expectOutputString( '<p><b>In order to put the original table \'test_tbl\' into Second normal' . ' form we need to create the following tables:</b></p><p><input type="text" ' @@ -150,7 +151,7 @@ class NormalizationControllerTest extends AbstractTestCase /** @var NormalizationController $normalizationController */ $normalizationController = $GLOBALS['containerBuilder']->get(NormalizationController::class); $this->dummyDbi->addSelectDb('my_db'); - $normalizationController(); + $normalizationController($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $this->assertResponseWasSuccessfull(); @@ -188,7 +189,7 @@ class NormalizationControllerTest extends AbstractTestCase /** @var NormalizationController $normalizationController */ $normalizationController = $GLOBALS['containerBuilder']->get(NormalizationController::class); $this->dummyDbi->addSelectDb('my_db'); - $normalizationController(); + $normalizationController($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $this->assertResponseWasSuccessfull(); diff --git a/test/classes/Controllers/Server/BinlogControllerTest.php b/test/classes/Controllers/Server/BinlogControllerTest.php index 2a14a563a8..abd9418a42 100644 --- a/test/classes/Controllers/Server/BinlogControllerTest.php +++ b/test/classes/Controllers/Server/BinlogControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Server; use PhpMyAdmin\Controllers\Server\BinlogController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; @@ -55,7 +56,7 @@ class BinlogControllerTest extends AbstractTestCase $_POST['log'] = 'index1'; $_POST['pos'] = '3'; $this->dummyDbi->addSelectDb('mysql'); - $controller(); + $controller($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $actual = $response->getHTMLResult(); diff --git a/test/classes/Controllers/Server/CollationsControllerTest.php b/test/classes/Controllers/Server/CollationsControllerTest.php index d41f3e38e6..9497972e8a 100644 --- a/test/classes/Controllers/Server/CollationsControllerTest.php +++ b/test/classes/Controllers/Server/CollationsControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Server; use PhpMyAdmin\Controllers\Server\CollationsController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; @@ -49,7 +50,7 @@ class CollationsControllerTest extends AbstractTestCase $controller = new CollationsController($response, new Template(), $GLOBALS['dbi']); $this->dummyDbi->addSelectDb('mysql'); - $controller(); + $controller($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $actual = $response->getHTMLResult(); diff --git a/test/classes/Controllers/Server/Databases/CreateControllerTest.php b/test/classes/Controllers/Server/Databases/CreateControllerTest.php index 0f154aa514..98ab64d053 100644 --- a/test/classes/Controllers/Server/Databases/CreateControllerTest.php +++ b/test/classes/Controllers/Server/Databases/CreateControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Server\Databases; use PhpMyAdmin\Controllers\Server\Databases\CreateController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; @@ -50,7 +51,7 @@ final class CreateControllerTest extends AbstractTestCase $_POST['new_db'] = 'test_db_error'; - $controller(); + $controller($this->createStub(ServerRequest::class)); $actual = $response->getJSONResult(); $this->assertArrayHasKey('message', $actual); @@ -64,7 +65,7 @@ final class CreateControllerTest extends AbstractTestCase $_POST['new_db'] = 'test_db'; $_POST['db_collation'] = 'utf8_general_ci'; - $controller(); + $controller($this->createStub(ServerRequest::class)); $actual = $response->getJSONResult(); $this->assertArrayHasKey('message', $actual); diff --git a/test/classes/Controllers/Server/Databases/DestroyControllerTest.php b/test/classes/Controllers/Server/Databases/DestroyControllerTest.php index 07ac828a20..8cc5f44eb0 100644 --- a/test/classes/Controllers/Server/Databases/DestroyControllerTest.php +++ b/test/classes/Controllers/Server/Databases/DestroyControllerTest.php @@ -8,6 +8,7 @@ use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\ConfigStorage\RelationCleanup; use PhpMyAdmin\Controllers\Server\Databases\DestroyController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; @@ -49,7 +50,7 @@ class DestroyControllerTest extends AbstractTestCase new RelationCleanup($dbi, new Relation($dbi)) ); - $controller(); + $controller($this->createStub(ServerRequest::class)); $actual = $response->getJSONResult(); $this->assertArrayHasKey('message', $actual); diff --git a/test/classes/Controllers/Server/DatabasesControllerTest.php b/test/classes/Controllers/Server/DatabasesControllerTest.php index e1436dd0f2..a74da76a8a 100644 --- a/test/classes/Controllers/Server/DatabasesControllerTest.php +++ b/test/classes/Controllers/Server/DatabasesControllerTest.php @@ -8,6 +8,7 @@ use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\ConfigStorage\RelationCleanup; use PhpMyAdmin\Controllers\Server\DatabasesController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; @@ -71,7 +72,7 @@ class DatabasesControllerTest extends AbstractTestCase ); $this->dummyDbi->addSelectDb('mysql'); - $controller(); + $controller($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $actual = $response->getHTMLResult(); @@ -108,7 +109,7 @@ class DatabasesControllerTest extends AbstractTestCase $_REQUEST['sort_order'] = 'desc'; $this->dummyDbi->addSelectDb('mysql'); - $controller(); + $controller($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $actual = $response->getHTMLResult(); diff --git a/test/classes/Controllers/Server/EnginesControllerTest.php b/test/classes/Controllers/Server/EnginesControllerTest.php index 9c88eb8e4d..6503beb337 100644 --- a/test/classes/Controllers/Server/EnginesControllerTest.php +++ b/test/classes/Controllers/Server/EnginesControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Server; use PhpMyAdmin\Controllers\Server\EnginesController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; @@ -49,7 +50,7 @@ class EnginesControllerTest extends AbstractTestCase $controller = new EnginesController($response, new Template(), $GLOBALS['dbi']); $this->dummyDbi->addSelectDb('mysql'); - $controller->__invoke(); + $controller->__invoke($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $actual = $response->getHTMLResult(); diff --git a/test/classes/Controllers/Server/PluginsControllerTest.php b/test/classes/Controllers/Server/PluginsControllerTest.php index 4926edd707..0cba772b73 100644 --- a/test/classes/Controllers/Server/PluginsControllerTest.php +++ b/test/classes/Controllers/Server/PluginsControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Server; use PhpMyAdmin\Controllers\Server\PluginsController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Server\Plugins; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; @@ -78,7 +79,7 @@ class PluginsControllerTest extends AbstractTestCase $controller = new PluginsController($response, new Template(), new Plugins($dbi), $GLOBALS['dbi']); $this->dummyDbi->addSelectDb('mysql'); - $controller(); + $controller($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $actual = $response->getHTMLResult(); diff --git a/test/classes/Controllers/Server/Status/AdvisorControllerTest.php b/test/classes/Controllers/Server/Status/AdvisorControllerTest.php index 8549b6ed88..ccc80b2037 100644 --- a/test/classes/Controllers/Server/Status/AdvisorControllerTest.php +++ b/test/classes/Controllers/Server/Status/AdvisorControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Server\Status; use PhpMyAdmin\Advisory\Advisor; use PhpMyAdmin\Controllers\Server\Status\AdvisorController; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Server\Status\Data; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; @@ -55,7 +56,7 @@ class AdvisorControllerTest extends AbstractTestCase new Advisor($GLOBALS['dbi'], new ExpressionLanguage()) ); - $controller(); + $controller($this->createStub(ServerRequest::class)); $expected = $this->template->render('server/status/advisor/index', [ 'data' => [], @@ -99,7 +100,7 @@ class AdvisorControllerTest extends AbstractTestCase $controller = new AdvisorController($this->response, $this->template, $this->data, $advisor); - $controller(); + $controller($this->createStub(ServerRequest::class)); $expected = $this->template->render('server/status/advisor/index', ['data' => $advisorData]); diff --git a/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php index 7011b5761c..48b4edc25d 100644 --- a/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php +++ b/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Server\Status\Monitor; use PhpMyAdmin\Controllers\Server\Status\Monitor\GeneralLogController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Server\Status\Data; use PhpMyAdmin\Server\Status\Monitor; use PhpMyAdmin\Template; @@ -77,7 +78,7 @@ class GeneralLogControllerTest extends AbstractTestCase $_POST['limitTypes'] = '1'; $this->dummyDbi->addSelectDb('mysql'); - $controller(); + $controller($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $ret = $response->getJSONResult(); diff --git a/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php index 102d825320..38fff4775c 100644 --- a/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php +++ b/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Server\Status\Monitor; use PhpMyAdmin\Controllers\Server\Status\Monitor\LogVarsController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Server\Status\Data; use PhpMyAdmin\Server\Status\Monitor; use PhpMyAdmin\Template; @@ -70,7 +71,7 @@ class LogVarsControllerTest extends AbstractTestCase $_POST['varName'] = 'varName'; $this->dummyDbi->addSelectDb('mysql'); - $controller(); + $controller($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $ret = $response->getJSONResult(); diff --git a/test/classes/Controllers/Server/Status/Monitor/QueryAnalyzerControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/QueryAnalyzerControllerTest.php index 683b3662bd..5163e328cd 100644 --- a/test/classes/Controllers/Server/Status/Monitor/QueryAnalyzerControllerTest.php +++ b/test/classes/Controllers/Server/Status/Monitor/QueryAnalyzerControllerTest.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Controllers\Server\Status\Monitor; use PhpMyAdmin\Controllers\Server\Status\Monitor\QueryAnalyzerController; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Server\Status\Data; use PhpMyAdmin\Server\Status\Monitor; use PhpMyAdmin\Template; @@ -50,7 +51,7 @@ class QueryAnalyzerControllerTest extends AbstractTestCase $dummyDbi->addSelectDb('mysql'); $dummyDbi->addSelectDb('database'); - $controller(); + $controller($this->createStub(ServerRequest::class)); $dummyDbi->assertAllSelectsConsumed(); $ret = $response->getJSONResult(); diff --git a/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php index e1a17d37bc..e6545d22ff 100644 --- a/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php +++ b/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Server\Status\Monitor; use PhpMyAdmin\Controllers\Server\Status\Monitor\SlowLogController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Server\Status\Data; use PhpMyAdmin\Server\Status\Monitor; use PhpMyAdmin\Template; @@ -64,7 +65,7 @@ class SlowLogControllerTest extends AbstractTestCase $_POST['time_end'] = '10'; $this->dummyDbi->addSelectDb('mysql'); - $controller(); + $controller($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $ret = $response->getJSONResult(); diff --git a/test/classes/Controllers/Server/Status/MonitorControllerTest.php b/test/classes/Controllers/Server/Status/MonitorControllerTest.php index 9feeb80477..dc66b5dfa9 100644 --- a/test/classes/Controllers/Server/Status/MonitorControllerTest.php +++ b/test/classes/Controllers/Server/Status/MonitorControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Server\Status; use PhpMyAdmin\Controllers\Server\Status\MonitorController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Server\Status\Data; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; @@ -60,7 +61,7 @@ class MonitorControllerTest extends AbstractTestCase ); $this->dummyDbi->addSelectDb('mysql'); - $controller(); + $controller($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $html = $response->getHTMLResult(); diff --git a/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php b/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php index 1d26428d20..c83e59f578 100644 --- a/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php +++ b/test/classes/Controllers/Server/Status/Processes/RefreshControllerTest.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Controllers\Server\Status\Processes; use PhpMyAdmin\Controllers\Server\Status\Processes\RefreshController; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Server\Status\Data; use PhpMyAdmin\Server\Status\Processes; use PhpMyAdmin\Template; @@ -69,7 +70,7 @@ class RefreshControllerTest extends AbstractTestCase $_POST['order_by_field'] = 'process'; $_POST['sort_order'] = 'DESC'; - $controller(); + $controller($this->createStub(ServerRequest::class)); $html = $response->getHTMLResult(); $this->assertStringContainsString('index.php?route=/server/status/processes', $html); diff --git a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php index a1253165ac..daab49a4d0 100644 --- a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php +++ b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Server\Status; use PhpMyAdmin\Controllers\Server\Status\ProcessesController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Server\Status\Data; use PhpMyAdmin\Server\Status\Processes; use PhpMyAdmin\Template; @@ -60,7 +61,7 @@ class ProcessesControllerTest extends AbstractTestCase ); $this->dummyDbi->addSelectDb('mysql'); - $controller(); + $controller($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $html = $response->getHTMLResult(); @@ -92,7 +93,7 @@ class ProcessesControllerTest extends AbstractTestCase $_POST['sort_order'] = 'ASC'; $this->dummyDbi->addSelectDb('mysql'); - $controller(); + $controller($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $html = $response->getHTMLResult(); @@ -105,7 +106,7 @@ class ProcessesControllerTest extends AbstractTestCase $_POST['sort_order'] = 'DESC'; $this->dummyDbi->addSelectDb('mysql'); - $controller(); + $controller($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $html = $response->getHTMLResult(); diff --git a/test/classes/Controllers/Server/Status/QueriesControllerTest.php b/test/classes/Controllers/Server/Status/QueriesControllerTest.php index 0aa49fa341..00c35c5b38 100644 --- a/test/classes/Controllers/Server/Status/QueriesControllerTest.php +++ b/test/classes/Controllers/Server/Status/QueriesControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Server\Status; use PhpMyAdmin\Controllers\Server\Status\QueriesController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Server\Status\Data; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; @@ -67,7 +68,7 @@ class QueriesControllerTest extends AbstractTestCase $controller = new QueriesController($response, new Template(), $this->data, $GLOBALS['dbi']); $this->dummyDbi->addSelectDb('mysql'); - $controller(); + $controller($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $html = $response->getHTMLResult(); diff --git a/test/classes/Controllers/Server/Status/StatusControllerTest.php b/test/classes/Controllers/Server/Status/StatusControllerTest.php index 7aa4ce1fb9..925bab1d27 100644 --- a/test/classes/Controllers/Server/Status/StatusControllerTest.php +++ b/test/classes/Controllers/Server/Status/StatusControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Server\Status; use PhpMyAdmin\Controllers\Server\Status\StatusController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Replication; use PhpMyAdmin\ReplicationGui; use PhpMyAdmin\Server\Status\Data; @@ -75,7 +76,7 @@ class StatusControllerTest extends AbstractTestCase $replicationInfo->replicaVariables = []; $this->dummyDbi->addSelectDb('mysql'); - $controller(); + $controller($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $html = $response->getHTMLResult(); diff --git a/test/classes/Controllers/Server/Status/VariablesControllerTest.php b/test/classes/Controllers/Server/Status/VariablesControllerTest.php index c4e81bb6a2..708dd8e803 100644 --- a/test/classes/Controllers/Server/Status/VariablesControllerTest.php +++ b/test/classes/Controllers/Server/Status/VariablesControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Server\Status; use PhpMyAdmin\Controllers\Server\Status\VariablesController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Server\Status\Data; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; @@ -53,7 +54,7 @@ class VariablesControllerTest extends AbstractTestCase $controller = new VariablesController($response, new Template(), $this->data, $GLOBALS['dbi']); $this->dummyDbi->addSelectDb('mysql'); - $controller(); + $controller($this->createStub(ServerRequest::class)); $this->dummyDbi->assertAllSelectsConsumed(); $html = $response->getHTMLResult(); diff --git a/test/classes/Controllers/Server/VariablesControllerTest.php b/test/classes/Controllers/Server/VariablesControllerTest.php index be8f53034e..5c608817dc 100644 --- a/test/classes/Controllers/Server/VariablesControllerTest.php +++ b/test/classes/Controllers/Server/VariablesControllerTest.php @@ -7,6 +7,7 @@ namespace PhpMyAdmin\Tests\Controllers\Server; use PhpMyAdmin\Controllers\Server\VariablesController; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Html\Generator; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Providers\ServerVariables\ServerVariablesProvider; use PhpMyAdmin\Providers\ServerVariables\VoidProvider as ServerVariablesVoidProvider; use PhpMyAdmin\ResponseRenderer; @@ -96,7 +97,7 @@ class VariablesControllerTest extends AbstractTestCase $controller = new VariablesController($response, new Template(), $dbi); - $controller(); + $controller($this->createStub(ServerRequest::class)); $html = $response->getHTMLResult(); $this->assertStringContainsString( diff --git a/test/classes/Controllers/Sql/EnumValuesControllerTest.php b/test/classes/Controllers/Sql/EnumValuesControllerTest.php index 305727892b..fdb74b2e5b 100644 --- a/test/classes/Controllers/Sql/EnumValuesControllerTest.php +++ b/test/classes/Controllers/Sql/EnumValuesControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Sql; use PhpMyAdmin\Controllers\Sql\EnumValuesController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; @@ -52,7 +53,7 @@ class EnumValuesControllerTest extends AbstractTestCase $GLOBALS['containerBuilder']->setParameter('table', $GLOBALS['table']); /** @var EnumValuesController $sqlController */ $sqlController = $GLOBALS['containerBuilder']->get(EnumValuesController::class); - $sqlController(); + $sqlController($this->createStub(ServerRequest::class)); $this->assertResponseWasNotSuccessfull(); @@ -100,7 +101,7 @@ class EnumValuesControllerTest extends AbstractTestCase $GLOBALS['containerBuilder']->setParameter('table', $GLOBALS['table']); /** @var EnumValuesController $sqlController */ $sqlController = $GLOBALS['containerBuilder']->get(EnumValuesController::class); - $sqlController(); + $sqlController($this->createStub(ServerRequest::class)); $this->assertResponseWasSuccessfull(); diff --git a/test/classes/Controllers/Sql/SetValuesControllerTest.php b/test/classes/Controllers/Sql/SetValuesControllerTest.php index db738fd1ec..2d578cefef 100644 --- a/test/classes/Controllers/Sql/SetValuesControllerTest.php +++ b/test/classes/Controllers/Sql/SetValuesControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Sql; use PhpMyAdmin\Controllers\Sql\SetValuesController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; @@ -52,7 +53,7 @@ class SetValuesControllerTest extends AbstractTestCase $GLOBALS['containerBuilder']->setParameter('table', $GLOBALS['table']); /** @var SetValuesController $sqlController */ $sqlController = $GLOBALS['containerBuilder']->get(SetValuesController::class); - $sqlController(); + $sqlController($this->createStub(ServerRequest::class)); $this->assertResponseWasNotSuccessfull(); @@ -100,7 +101,7 @@ class SetValuesControllerTest extends AbstractTestCase $GLOBALS['containerBuilder']->setParameter('table', $GLOBALS['table']); /** @var SetValuesController $sqlController */ $sqlController = $GLOBALS['containerBuilder']->get(SetValuesController::class); - $sqlController(); + $sqlController($this->createStub(ServerRequest::class)); $this->assertResponseWasSuccessfull(); diff --git a/test/classes/Controllers/Table/ChartControllerTest.php b/test/classes/Controllers/Table/ChartControllerTest.php index 8f71a62886..19baba45f5 100644 --- a/test/classes/Controllers/Table/ChartControllerTest.php +++ b/test/classes/Controllers/Table/ChartControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Table; use PhpMyAdmin\Controllers\Table\ChartController; use PhpMyAdmin\FieldMetadata; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; @@ -94,7 +95,7 @@ class ChartControllerTest extends AbstractTestCase ], ]); - (new ChartController($response, $template, $dbi))(); + (new ChartController($response, $template, $dbi))($this->createStub(ServerRequest::class)); $this->assertSame($expected, $response->getHTMLResult()); } } diff --git a/test/classes/Controllers/Table/CreateControllerTest.php b/test/classes/Controllers/Table/CreateControllerTest.php index b1fc6be5ce..429f2f2a67 100644 --- a/test/classes/Controllers/Table/CreateControllerTest.php +++ b/test/classes/Controllers/Table/CreateControllerTest.php @@ -7,6 +7,7 @@ namespace PhpMyAdmin\Tests\Controllers\Table; use PhpMyAdmin\Config; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Controllers\Table\CreateController; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Table\ColumnsDefinition; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; @@ -253,7 +254,7 @@ class CreateControllerTest extends AbstractTestCase new Config(), $dbi, new ColumnsDefinition($dbi, $relation, $transformations) - ))(); + ))($this->createStub(ServerRequest::class)); $this->assertSame($expected, $response->getHTMLResult()); } diff --git a/test/classes/Controllers/Table/DeleteConfirmControllerTest.php b/test/classes/Controllers/Table/DeleteConfirmControllerTest.php index 4d0215ebf2..6649972f20 100644 --- a/test/classes/Controllers/Table/DeleteConfirmControllerTest.php +++ b/test/classes/Controllers/Table/DeleteConfirmControllerTest.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Controllers\Table; use PhpMyAdmin\Controllers\Table\DeleteConfirmController; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; @@ -42,7 +43,7 @@ class DeleteConfirmControllerTest extends AbstractTestCase 'is_foreign_key_check' => true, ]); - (new DeleteConfirmController($response, $template))(); + (new DeleteConfirmController($response, $template))($this->createStub(ServerRequest::class)); $this->assertSame($expected, $response->getHTMLResult()); } } diff --git a/test/classes/Controllers/Table/DeleteRowsControllerTest.php b/test/classes/Controllers/Table/DeleteRowsControllerTest.php index 73e0865967..e55650b6c8 100644 --- a/test/classes/Controllers/Table/DeleteRowsControllerTest.php +++ b/test/classes/Controllers/Table/DeleteRowsControllerTest.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Controllers\Table; use PhpMyAdmin\Controllers\Table\DeleteRowsController; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; @@ -52,7 +53,7 @@ class DeleteRowsControllerTest extends AbstractTestCase $GLOBALS['dbi'] = $dbi; $response = new ResponseRenderer(); - (new DeleteRowsController($response, new Template(), $dbi))(); + (new DeleteRowsController($response, new Template(), $dbi))($this->createStub(ServerRequest::class)); $actual = $response->getHTMLResult(); $this->assertStringContainsString( '<div class="alert alert-success" role="alert">Your SQL query has been executed successfully.</div>', diff --git a/test/classes/Controllers/Table/DropColumnControllerTest.php b/test/classes/Controllers/Table/DropColumnControllerTest.php index 30167965ec..64262322e7 100644 --- a/test/classes/Controllers/Table/DropColumnControllerTest.php +++ b/test/classes/Controllers/Table/DropColumnControllerTest.php @@ -8,6 +8,7 @@ use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\ConfigStorage\RelationCleanup; use PhpMyAdmin\Controllers\Table\DropColumnController; use PhpMyAdmin\FlashMessages; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; @@ -48,7 +49,7 @@ class DropColumnControllerTest extends AbstractTestCase $dbi, new FlashMessages(), new RelationCleanup($dbi, new Relation($dbi)) - ))(); + ))($this->createStub(ServerRequest::class)); $this->assertArrayHasKey('flashMessages', $_SESSION); /** @psalm-suppress InvalidArrayOffset */ diff --git a/test/classes/Controllers/Table/ExportControllerTest.php b/test/classes/Controllers/Table/ExportControllerTest.php index 138ad396a8..e86d4a1697 100644 --- a/test/classes/Controllers/Table/ExportControllerTest.php +++ b/test/classes/Controllers/Table/ExportControllerTest.php @@ -10,6 +10,7 @@ use PhpMyAdmin\Controllers\Table\ExportController; use PhpMyAdmin\Encoding; use PhpMyAdmin\Export\Options; use PhpMyAdmin\Export\TemplateModel; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Plugins; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; @@ -102,7 +103,7 @@ class ExportControllerTest extends AbstractTestCase $response, $template, new Options(new Relation($dbi), new TemplateModel($dbi)) - ))(); + ))($this->createStub(ServerRequest::class)); $this->assertSame($expected, $response->getHTMLResult()); } } diff --git a/test/classes/Controllers/Table/ExportRowsControllerTest.php b/test/classes/Controllers/Table/ExportRowsControllerTest.php index ee6e9726da..afb5c013b8 100644 --- a/test/classes/Controllers/Table/ExportRowsControllerTest.php +++ b/test/classes/Controllers/Table/ExportRowsControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Table; use PhpMyAdmin\Controllers\Table\ExportController; use PhpMyAdmin\Controllers\Table\ExportRowsController; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; @@ -33,7 +34,11 @@ class ExportRowsControllerTest extends AbstractTestCase $controller = $this->createMock(ExportController::class); $controller->expects($this->once())->method('__invoke'); - (new ExportRowsController(new ResponseRenderer(), new Template(), $controller))(); + (new ExportRowsController( + new ResponseRenderer(), + new Template(), + $controller + ))($this->createStub(ServerRequest::class)); /** @psalm-suppress InvalidArrayOffset */ $this->assertSame('index.php?route=/table/export&server=2&lang=en', $GLOBALS['active_page']); @@ -51,7 +56,11 @@ class ExportRowsControllerTest extends AbstractTestCase $controller->expects($this->never())->method('__invoke'); $response = new ResponseRenderer(); - (new ExportRowsController($response, new Template(), $controller))(); + (new ExportRowsController( + $response, + new Template(), + $controller + ))($this->createStub(ServerRequest::class)); $this->assertSame(['message' => 'No row selected.'], $response->getJSONResult()); $this->assertFalse($response->hasSuccessState()); @@ -71,7 +80,11 @@ class ExportRowsControllerTest extends AbstractTestCase $controller = $this->createMock(ExportController::class); $controller->expects($this->once())->method('__invoke'); - (new ExportRowsController(new ResponseRenderer(), new Template(), $controller))(); + (new ExportRowsController( + new ResponseRenderer(), + new Template(), + $controller + ))($this->createStub(ServerRequest::class)); /** @psalm-suppress InvalidArrayOffset */ $this->assertSame('index.php?route=/table/export&server=2&lang=en', $GLOBALS['active_page']); diff --git a/test/classes/Controllers/Table/GetFieldControllerTest.php b/test/classes/Controllers/Table/GetFieldControllerTest.php index 29511fdf48..8bb97a9522 100644 --- a/test/classes/Controllers/Table/GetFieldControllerTest.php +++ b/test/classes/Controllers/Table/GetFieldControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Table; use PhpMyAdmin\Controllers\Table\GetFieldController; use PhpMyAdmin\Core; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; @@ -53,7 +54,7 @@ class GetFieldControllerTest extends AbstractTestCase $dbi = $this->createDatabaseInterface($dummyDbi); $GLOBALS['dbi'] = $dbi; - (new GetFieldController(new ResponseRenderer(), new Template(), $dbi))(); + (new GetFieldController(new ResponseRenderer(), new Template(), $dbi))($this->createStub(ServerRequest::class)); $this->expectOutputString('46494c45'); } } diff --git a/test/classes/Controllers/Table/GisVisualizationControllerTest.php b/test/classes/Controllers/Table/GisVisualizationControllerTest.php index 2c3cacb1d4..fd93494a86 100644 --- a/test/classes/Controllers/Table/GisVisualizationControllerTest.php +++ b/test/classes/Controllers/Table/GisVisualizationControllerTest.php @@ -7,6 +7,7 @@ namespace PhpMyAdmin\Tests\Controllers\Table; use PhpMyAdmin\Controllers\Table\GisVisualizationController; use PhpMyAdmin\Core; use PhpMyAdmin\FieldMetadata; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; @@ -110,7 +111,7 @@ class GisVisualizationControllerTest extends AbstractTestCase ]); $response = new ResponseRenderer(); - (new GisVisualizationController($response, $template, $dbi))(); + (new GisVisualizationController($response, $template, $dbi))($this->createStub(ServerRequest::class)); $this->assertSame($expected, $response->getHTMLResult()); } } diff --git a/test/classes/Controllers/Table/ImportControllerTest.php b/test/classes/Controllers/Table/ImportControllerTest.php index 2771d8a23e..73820aa617 100644 --- a/test/classes/Controllers/Table/ImportControllerTest.php +++ b/test/classes/Controllers/Table/ImportControllerTest.php @@ -8,6 +8,7 @@ use PhpMyAdmin\Charsets; use PhpMyAdmin\Config\PageSettings; use PhpMyAdmin\Controllers\Table\ImportController; use PhpMyAdmin\Encoding; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Plugins; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; @@ -80,7 +81,7 @@ class ImportControllerTest extends AbstractTestCase ]); $response = new ResponseRenderer(); - (new ImportController($response, $template, $dbi))(); + (new ImportController($response, $template, $dbi))($this->createStub(ServerRequest::class)); $this->assertSame($expected, $response->getHTMLResult()); } } diff --git a/test/classes/Controllers/Table/IndexRenameControllerTest.php b/test/classes/Controllers/Table/IndexRenameControllerTest.php index 10a01617dd..6eea50b492 100644 --- a/test/classes/Controllers/Table/IndexRenameControllerTest.php +++ b/test/classes/Controllers/Table/IndexRenameControllerTest.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Controllers\Table; use PhpMyAdmin\Controllers\Table\IndexRenameController; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Index; use PhpMyAdmin\Table\Indexes; use PhpMyAdmin\Template; @@ -39,7 +40,12 @@ class IndexRenameControllerTest extends AbstractTestCase ]); $response = new ResponseRenderer(); - (new IndexRenameController($response, $template, $dbi, new Indexes($response, $template, $dbi)))(); + (new IndexRenameController( + $response, + $template, + $dbi, + new Indexes($response, $template, $dbi) + ))($this->createStub(ServerRequest::class)); $this->assertSame($expected, $response->getHTMLResult()); } } diff --git a/test/classes/Controllers/Table/OperationsControllerTest.php b/test/classes/Controllers/Table/OperationsControllerTest.php index cd6949cd6d..59bd2ed6b0 100644 --- a/test/classes/Controllers/Table/OperationsControllerTest.php +++ b/test/classes/Controllers/Table/OperationsControllerTest.php @@ -7,6 +7,7 @@ namespace PhpMyAdmin\Tests\Controllers\Table; use PhpMyAdmin\Charsets; use PhpMyAdmin\Controllers\Table\OperationsController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\StorageEngine; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; @@ -118,7 +119,7 @@ class OperationsControllerTest extends AbstractTestCase /** @var OperationsController $controller */ $controller = $GLOBALS['containerBuilder']->get(OperationsController::class); - $controller(); + $controller($this->createStub(ServerRequest::class)); $this->assertEquals($expectedOutput, $this->getResponseHtmlResult()); } diff --git a/test/classes/Controllers/Table/PrivilegesControllerTest.php b/test/classes/Controllers/Table/PrivilegesControllerTest.php index e9afa08345..5490ad8cc6 100644 --- a/test/classes/Controllers/Table/PrivilegesControllerTest.php +++ b/test/classes/Controllers/Table/PrivilegesControllerTest.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Controllers\Table; use PhpMyAdmin\Controllers\Table\PrivilegesController; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Server\Privileges; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; @@ -45,7 +46,12 @@ class PrivilegesControllerTest extends AbstractTestCase ->willReturn($privileges); $response = new ResponseRenderer(); - (new PrivilegesController($response, new Template(), $serverPrivileges, $GLOBALS['dbi']))(); + (new PrivilegesController( + $response, + new Template(), + $serverPrivileges, + $GLOBALS['dbi'] + ))($this->createStub(ServerRequest::class)); $actual = $response->getHTMLResult(); $this->assertStringContainsString($GLOBALS['db'] . '.' . $GLOBALS['table'], $actual); diff --git a/test/classes/Controllers/Table/RecentFavoriteControllerTest.php b/test/classes/Controllers/Table/RecentFavoriteControllerTest.php index faad20c6b3..b5790cae31 100644 --- a/test/classes/Controllers/Table/RecentFavoriteControllerTest.php +++ b/test/classes/Controllers/Table/RecentFavoriteControllerTest.php @@ -7,6 +7,7 @@ namespace PhpMyAdmin\Tests\Controllers\Table; use PhpMyAdmin\Controllers\Sql\SqlController; use PhpMyAdmin\Controllers\Table\RecentFavoriteController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\RecentFavoriteTable; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; @@ -61,7 +62,7 @@ class RecentFavoriteControllerTest extends AbstractTestCase $this->assertSame([['db' => 'test_db', 'table' => 'test_table']], $recent->getTables()); $this->assertSame([['db' => 'test_db', 'table' => 'test_table']], $favorite->getTables()); - (new RecentFavoriteController(new ResponseRenderer(), new Template()))(); + (new RecentFavoriteController(new ResponseRenderer(), new Template()))($this->createStub(ServerRequest::class)); $this->assertSame([['db' => 'test_db', 'table' => 'test_table']], $recent->getTables()); $this->assertSame([['db' => 'test_db', 'table' => 'test_table']], $favorite->getTables()); @@ -96,7 +97,7 @@ class RecentFavoriteControllerTest extends AbstractTestCase $this->assertSame([['db' => 'invalid_db', 'table' => 'invalid_table']], $recent->getTables()); $this->assertSame([['db' => 'invalid_db', 'table' => 'invalid_table']], $favorite->getTables()); - (new RecentFavoriteController(new ResponseRenderer(), new Template()))(); + (new RecentFavoriteController(new ResponseRenderer(), new Template()))($this->createStub(ServerRequest::class)); $this->assertSame([], $recent->getTables()); $this->assertSame([], $favorite->getTables()); diff --git a/test/classes/Controllers/Table/SqlControllerTest.php b/test/classes/Controllers/Table/SqlControllerTest.php index ae4270a3f5..d94d34a2ab 100644 --- a/test/classes/Controllers/Table/SqlControllerTest.php +++ b/test/classes/Controllers/Table/SqlControllerTest.php @@ -8,6 +8,7 @@ use PhpMyAdmin\Config\PageSettings; use PhpMyAdmin\Controllers\Table\SqlController; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\Html\MySQLDocumentation; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\SqlQueryForm; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; @@ -80,7 +81,7 @@ class SqlControllerTest extends AbstractTestCase ]); $response = new ResponseRenderer(); - (new SqlController($response, $template, new SqlQueryForm($template)))(); + (new SqlController($response, $template, new SqlQueryForm($template)))($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 b2cbebc2d2..712566ba97 100644 --- a/test/classes/Controllers/Table/TrackingControllerTest.php +++ b/test/classes/Controllers/Table/TrackingControllerTest.php @@ -7,6 +7,7 @@ namespace PhpMyAdmin\Tests\Controllers\Table; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Controllers\Table\TrackingController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\SqlQueryForm; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; @@ -51,7 +52,7 @@ class TrackingControllerTest extends AbstractTestCase $response, $template, new Tracking(new SqlQueryForm($template), $template, new Relation($this->dbi), $this->dbi) - ))(); + ))($this->createStub(ServerRequest::class)); $main = $template->render('table/tracking/main', [ 'url_params' => [ diff --git a/test/classes/Controllers/Table/TriggersControllerTest.php b/test/classes/Controllers/Table/TriggersControllerTest.php index ac7e3f8aef..37ffd6267d 100644 --- a/test/classes/Controllers/Table/TriggersControllerTest.php +++ b/test/classes/Controllers/Table/TriggersControllerTest.php @@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Controllers\Table; use PhpMyAdmin\Controllers\Table\TriggersController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; @@ -50,7 +51,11 @@ class TriggersControllerTest extends AbstractTestCase ); $template = new Template(); - (new TriggersController(new ResponseRenderer(), $template, $this->dbi))(); + (new TriggersController( + new ResponseRenderer(), + $template, + $this->dbi + ))($this->createStub(ServerRequest::class)); $items = [ [ diff --git a/test/classes/Controllers/Table/ZoomSearchControllerTest.php b/test/classes/Controllers/Table/ZoomSearchControllerTest.php index cb6f076749..790fd05344 100644 --- a/test/classes/Controllers/Table/ZoomSearchControllerTest.php +++ b/test/classes/Controllers/Table/ZoomSearchControllerTest.php @@ -7,6 +7,7 @@ namespace PhpMyAdmin\Tests\Controllers\Table; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Controllers\Table\ZoomSearchController; use PhpMyAdmin\DatabaseInterface; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Table\Search; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; @@ -53,7 +54,7 @@ class ZoomSearchControllerTest extends AbstractTestCase new Relation($this->dbi), $this->dbi ); - $controller(); + $controller($this->createStub(ServerRequest::class)); $expected = $template->render('table/zoom_search/index', [ 'db' => $GLOBALS['db'], diff --git a/test/classes/Controllers/Transformation/OverviewControllerTest.php b/test/classes/Controllers/Transformation/OverviewControllerTest.php index 56b9a60366..ad4774d0e5 100644 --- a/test/classes/Controllers/Transformation/OverviewControllerTest.php +++ b/test/classes/Controllers/Transformation/OverviewControllerTest.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Controllers\Transformation; use PhpMyAdmin\Controllers\Transformation\OverviewController; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; @@ -40,7 +41,7 @@ class OverviewControllerTest extends AbstractTestCase $controller = new OverviewController($response, new Template(), new Transformations()); - $controller(); + $controller($this->createStub(ServerRequest::class)); $actual = $response->getHTMLResult(); $this->assertStringContainsString( diff --git a/test/classes/Controllers/VersionCheckControllerTest.php b/test/classes/Controllers/VersionCheckControllerTest.php index b92eb02448..4d76dff873 100644 --- a/test/classes/Controllers/VersionCheckControllerTest.php +++ b/test/classes/Controllers/VersionCheckControllerTest.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Controllers; use PhpMyAdmin\Controllers\VersionCheckController; +use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Template; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\ResponseRenderer; @@ -49,7 +50,11 @@ class VersionCheckControllerTest extends AbstractTestCase ->with($this->equalTo($versionInfo->releases)) ->willReturn(['version' => '5.1.3', 'date' => '2022-02-11']); - (new VersionCheckController(new ResponseRenderer(), new Template(), $versionInformation))(); + (new VersionCheckController( + new ResponseRenderer(), + new Template(), + $versionInformation + ))($this->createStub(ServerRequest::class)); $output = $this->getActualOutputForAssertion(); $this->assertTrue(isset($_GET['ajax_request'])); @@ -84,7 +89,11 @@ class VersionCheckControllerTest extends AbstractTestCase ->with($this->equalTo($versionInfo->releases)) ->willReturn(null); - (new VersionCheckController(new ResponseRenderer(), new Template(), $versionInformation))(); + (new VersionCheckController( + new ResponseRenderer(), + new Template(), + $versionInformation + ))($this->createStub(ServerRequest::class)); $output = $this->getActualOutputForAssertion(); $this->assertTrue(isset($_GET['ajax_request'])); @@ -99,7 +108,11 @@ class VersionCheckControllerTest extends AbstractTestCase $versionInformation->expects($this->once())->method('getLatestVersion')->willReturn(null); $versionInformation->expects($this->never())->method('getLatestCompatibleVersion'); - (new VersionCheckController(new ResponseRenderer(), new Template(), $versionInformation))(); + (new VersionCheckController( + new ResponseRenderer(), + new Template(), + $versionInformation + ))($this->createStub(ServerRequest::class)); $output = $this->getActualOutputForAssertion(); $this->assertTrue(isset($_GET['ajax_request'])); |