From 72a69471e853b4bc9caae211b818deadd797f900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Mon, 11 Jul 2022 16:38:37 -0300 Subject: [PATCH] Remove the AbstractTestCase::assertAllSelectsConsumed method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Uses the DummyDbi method instead. Signed-off-by: MaurĂ­cio Meneghini Fauth --- test/classes/AbstractTestCase.php | 10 ---------- test/classes/BookmarkTest.php | 6 +++--- .../Controllers/Import/ImportControllerTest.php | 2 +- .../Controllers/NormalizationControllerTest.php | 4 ++-- .../Controllers/Server/BinlogControllerTest.php | 2 +- .../Controllers/Server/CollationsControllerTest.php | 2 +- .../Controllers/Server/DatabasesControllerTest.php | 4 ++-- .../Controllers/Server/EnginesControllerTest.php | 2 +- .../Controllers/Server/PluginsControllerTest.php | 2 +- .../Controllers/Server/ShowEngineControllerTest.php | 2 +- .../Server/Status/Monitor/GeneralLogControllerTest.php | 2 +- .../Server/Status/Monitor/LogVarsControllerTest.php | 2 +- .../Server/Status/Monitor/SlowLogControllerTest.php | 2 +- .../Server/Status/MonitorControllerTest.php | 2 +- .../Server/Status/ProcessesControllerTest.php | 6 +++--- .../Server/Status/QueriesControllerTest.php | 2 +- .../Controllers/Server/Status/StatusControllerTest.php | 2 +- .../Server/Status/VariablesControllerTest.php | 2 +- .../Controllers/Table/ReplaceControllerTest.php | 4 ++-- test/classes/Import/SimulateDmlTest.php | 2 +- test/classes/Plugins/Export/ExportHtmlwordTest.php | 4 ++-- test/classes/Plugins/Export/ExportOdtTest.php | 8 ++++---- test/classes/Plugins/Export/ExportTexytextTest.php | 8 ++++---- test/classes/StorageEngineTest.php | 2 +- test/classes/TwoFactorTest.php | 2 +- 25 files changed, 38 insertions(+), 48 deletions(-) diff --git a/test/classes/AbstractTestCase.php b/test/classes/AbstractTestCase.php index a40f312f41..cf07295c60 100644 --- a/test/classes/AbstractTestCase.php +++ b/test/classes/AbstractTestCase.php @@ -102,16 +102,6 @@ abstract class AbstractTestCase extends TestCase Cache::purge(); } - protected function assertAllSelectsConsumed(): void - { - $unUsedSelects = $this->dummyDbi->getUnUsedDatabaseSelects(); - $this->assertSame( - [], - $unUsedSelects, - 'Some database selects where not used !' - ); - } - protected function loadContainerBuilder(): void { $GLOBALS['containerBuilder'] = Core::getContainerBuilder(); diff --git a/test/classes/BookmarkTest.php b/test/classes/BookmarkTest.php index 588c77c956..24cd7ad5f1 100644 --- a/test/classes/BookmarkTest.php +++ b/test/classes/BookmarkTest.php @@ -47,7 +47,7 @@ class BookmarkTest extends AbstractTestCase 'sakila' ); $this->assertContainsOnlyInstancesOf(Bookmark::class, $actual); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); } /** @@ -64,7 +64,7 @@ class BookmarkTest extends AbstractTestCase '1' ) ); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); } /** @@ -83,6 +83,6 @@ class BookmarkTest extends AbstractTestCase $this->assertNotFalse($bookmark); $this->dummyDbi->addSelectDb('phpmyadmin'); $this->assertFalse($bookmark->save()); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); } } diff --git a/test/classes/Controllers/Import/ImportControllerTest.php b/test/classes/Controllers/Import/ImportControllerTest.php index 16a0ffa675..a7cbee1b59 100644 --- a/test/classes/Controllers/Import/ImportControllerTest.php +++ b/test/classes/Controllers/Import/ImportControllerTest.php @@ -58,7 +58,7 @@ class ImportControllerTest extends AbstractTestCase $this->dummyDbi->addSelectDb('pma_test'); $this->dummyDbi->addSelectDb('pma_test'); $importController(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $this->assertResponseWasSuccessfull(); $this->assertStringContainsString( diff --git a/test/classes/Controllers/NormalizationControllerTest.php b/test/classes/Controllers/NormalizationControllerTest.php index e13d076ba1..b5155210f9 100644 --- a/test/classes/Controllers/NormalizationControllerTest.php +++ b/test/classes/Controllers/NormalizationControllerTest.php @@ -141,7 +141,7 @@ class NormalizationControllerTest extends AbstractTestCase $normalizationController = $GLOBALS['containerBuilder']->get(NormalizationController::class); $this->dummyDbi->addSelectDb('my_db'); $normalizationController(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $this->assertResponseWasSuccessfull(); @@ -179,7 +179,7 @@ class NormalizationControllerTest extends AbstractTestCase $normalizationController = $GLOBALS['containerBuilder']->get(NormalizationController::class); $this->dummyDbi->addSelectDb('my_db'); $normalizationController(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $this->assertResponseWasSuccessfull(); diff --git a/test/classes/Controllers/Server/BinlogControllerTest.php b/test/classes/Controllers/Server/BinlogControllerTest.php index e87e429def..6499422712 100644 --- a/test/classes/Controllers/Server/BinlogControllerTest.php +++ b/test/classes/Controllers/Server/BinlogControllerTest.php @@ -48,7 +48,7 @@ class BinlogControllerTest extends AbstractTestCase $_POST['pos'] = '3'; $this->dummyDbi->addSelectDb('mysql'); $controller(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $actual = $response->getHTMLResult(); $this->assertStringContainsString('Select binary log to view', $actual); diff --git a/test/classes/Controllers/Server/CollationsControllerTest.php b/test/classes/Controllers/Server/CollationsControllerTest.php index 7b872d85ec..2784e01443 100644 --- a/test/classes/Controllers/Server/CollationsControllerTest.php +++ b/test/classes/Controllers/Server/CollationsControllerTest.php @@ -39,7 +39,7 @@ class CollationsControllerTest extends AbstractTestCase $this->dummyDbi->addSelectDb('mysql'); $controller(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $actual = $response->getHTMLResult(); $this->assertStringContainsString('
latin1
', $actual); diff --git a/test/classes/Controllers/Server/DatabasesControllerTest.php b/test/classes/Controllers/Server/DatabasesControllerTest.php index 1a2dfa0abe..fb040ee0e9 100644 --- a/test/classes/Controllers/Server/DatabasesControllerTest.php +++ b/test/classes/Controllers/Server/DatabasesControllerTest.php @@ -61,7 +61,7 @@ class DatabasesControllerTest extends AbstractTestCase $this->dummyDbi->addSelectDb('mysql'); $controller(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $actual = $response->getHTMLResult(); $this->assertStringContainsString('data-filter-row="SAKILA"', $actual); @@ -98,7 +98,7 @@ class DatabasesControllerTest extends AbstractTestCase $this->dummyDbi->addSelectDb('mysql'); $controller(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $actual = $response->getHTMLResult(); $this->assertStringNotContainsString(__('Enable statistics'), $actual); diff --git a/test/classes/Controllers/Server/EnginesControllerTest.php b/test/classes/Controllers/Server/EnginesControllerTest.php index 808c56b773..46a1d900d5 100644 --- a/test/classes/Controllers/Server/EnginesControllerTest.php +++ b/test/classes/Controllers/Server/EnginesControllerTest.php @@ -39,7 +39,7 @@ class EnginesControllerTest extends AbstractTestCase $this->dummyDbi->addSelectDb('mysql'); $controller->__invoke(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $actual = $response->getHTMLResult(); diff --git a/test/classes/Controllers/Server/PluginsControllerTest.php b/test/classes/Controllers/Server/PluginsControllerTest.php index a14480558c..1ea14cb65a 100644 --- a/test/classes/Controllers/Server/PluginsControllerTest.php +++ b/test/classes/Controllers/Server/PluginsControllerTest.php @@ -69,7 +69,7 @@ class PluginsControllerTest extends AbstractTestCase $controller = new PluginsController($response, new Template(), new Plugins($dbi), $GLOBALS['dbi']); $this->dummyDbi->addSelectDb('mysql'); $controller(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $actual = $response->getHTMLResult(); //validate 1:Items diff --git a/test/classes/Controllers/Server/ShowEngineControllerTest.php b/test/classes/Controllers/Server/ShowEngineControllerTest.php index 37dd3b7c9c..6da1e97071 100644 --- a/test/classes/Controllers/Server/ShowEngineControllerTest.php +++ b/test/classes/Controllers/Server/ShowEngineControllerTest.php @@ -42,7 +42,7 @@ class ShowEngineControllerTest extends AbstractTestCase 'page' => 'page', ]); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $actual = $response->getHTMLResult(); $enginePlugin = StorageEngine::getEngine('Pbxt'); diff --git a/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php index f1394a3021..772258e7b2 100644 --- a/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php +++ b/test/classes/Controllers/Server/Status/Monitor/GeneralLogControllerTest.php @@ -67,7 +67,7 @@ class GeneralLogControllerTest extends AbstractTestCase $this->dummyDbi->addSelectDb('mysql'); $controller(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $ret = $response->getJSONResult(); $resultRows = [ diff --git a/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php index 13c217d78c..cec8744a61 100644 --- a/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php +++ b/test/classes/Controllers/Server/Status/Monitor/LogVarsControllerTest.php @@ -60,7 +60,7 @@ class LogVarsControllerTest extends AbstractTestCase $this->dummyDbi->addSelectDb('mysql'); $controller(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $ret = $response->getJSONResult(); $this->assertEquals($value, $ret['message']); diff --git a/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php b/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php index 9ac2380439..d98a449787 100644 --- a/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php +++ b/test/classes/Controllers/Server/Status/Monitor/SlowLogControllerTest.php @@ -54,7 +54,7 @@ class SlowLogControllerTest extends AbstractTestCase $this->dummyDbi->addSelectDb('mysql'); $controller(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $ret = $response->getJSONResult(); $resultRows = [ diff --git a/test/classes/Controllers/Server/Status/MonitorControllerTest.php b/test/classes/Controllers/Server/Status/MonitorControllerTest.php index f6dbf39dd7..2b4861e846 100644 --- a/test/classes/Controllers/Server/Status/MonitorControllerTest.php +++ b/test/classes/Controllers/Server/Status/MonitorControllerTest.php @@ -50,7 +50,7 @@ class MonitorControllerTest extends AbstractTestCase $this->dummyDbi->addSelectDb('mysql'); $controller(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $html = $response->getHTMLResult(); $this->assertStringContainsString('