diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-07-11 22:38:37 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-07-11 22:38:37 +0300 |
commit | 72a69471e853b4bc9caae211b818deadd797f900 (patch) | |
tree | 7999f119e10ff4bc077a3c1107cb84818b26d156 /test | |
parent | 4930c7a119f8a41685b2838dda91848a5f7903c5 (diff) |
Remove the AbstractTestCase::assertAllSelectsConsumed method
Uses the DummyDbi method instead.
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'test')
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('<div><strong>latin1</strong></div>', $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('<div class="tabLinks row">', $html); diff --git a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php index 2102ba3bce..226e5c5812 100644 --- a/test/classes/Controllers/Server/Status/ProcessesControllerTest.php +++ b/test/classes/Controllers/Server/Status/ProcessesControllerTest.php @@ -50,7 +50,7 @@ class ProcessesControllerTest extends AbstractTestCase $this->dummyDbi->addSelectDb('mysql'); $controller(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $html = $response->getHTMLResult(); $this->assertStringContainsString( @@ -82,7 +82,7 @@ class ProcessesControllerTest extends AbstractTestCase $this->dummyDbi->addSelectDb('mysql'); $controller(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $html = $response->getHTMLResult(); $this->assertStringContainsString('Truncate shown queries', $html); @@ -95,7 +95,7 @@ class ProcessesControllerTest extends AbstractTestCase $this->dummyDbi->addSelectDb('mysql'); $controller(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $html = $response->getHTMLResult(); $this->assertStringContainsString('Host', $html); diff --git a/test/classes/Controllers/Server/Status/QueriesControllerTest.php b/test/classes/Controllers/Server/Status/QueriesControllerTest.php index 72631228b1..e174d344b2 100644 --- a/test/classes/Controllers/Server/Status/QueriesControllerTest.php +++ b/test/classes/Controllers/Server/Status/QueriesControllerTest.php @@ -57,7 +57,7 @@ class QueriesControllerTest extends AbstractTestCase $this->dummyDbi->addSelectDb('mysql'); $controller(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $html = $response->getHTMLResult(); $hourFactor = 3600 / $this->data->status['Uptime']; diff --git a/test/classes/Controllers/Server/Status/StatusControllerTest.php b/test/classes/Controllers/Server/Status/StatusControllerTest.php index 07812a4c75..24398f790c 100644 --- a/test/classes/Controllers/Server/Status/StatusControllerTest.php +++ b/test/classes/Controllers/Server/Status/StatusControllerTest.php @@ -65,7 +65,7 @@ class StatusControllerTest extends AbstractTestCase $this->dummyDbi->addSelectDb('mysql'); $controller(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $html = $response->getHTMLResult(); $traffic = $bytesReceived + $bytesSent; diff --git a/test/classes/Controllers/Server/Status/VariablesControllerTest.php b/test/classes/Controllers/Server/Status/VariablesControllerTest.php index 3c6a9271f6..e020664c1a 100644 --- a/test/classes/Controllers/Server/Status/VariablesControllerTest.php +++ b/test/classes/Controllers/Server/Status/VariablesControllerTest.php @@ -43,7 +43,7 @@ class VariablesControllerTest extends AbstractTestCase $this->dummyDbi->addSelectDb('mysql'); $controller(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $html = $response->getHTMLResult(); $this->assertStringContainsString('<div class="card mb-3" id="tableFilter">', $html); diff --git a/test/classes/Controllers/Table/ReplaceControllerTest.php b/test/classes/Controllers/Table/ReplaceControllerTest.php index 3b656a4456..a856fb282d 100644 --- a/test/classes/Controllers/Table/ReplaceControllerTest.php +++ b/test/classes/Controllers/Table/ReplaceControllerTest.php @@ -133,7 +133,7 @@ class ReplaceControllerTest extends AbstractTestCase $dummyDbi->addSelectDb('my_db'); $replaceController($request); $output = $response->getHTMLResult(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $this->assertStringContainsString( 'class="icon ic_s_success"> Showing rows 0 - 1 (2 total, Query took', $output @@ -181,7 +181,7 @@ class ReplaceControllerTest extends AbstractTestCase $replaceController($request); $output = $response->getHTMLResult(); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $this->assertEquals(5, $GLOBALS['cfg']['InsertRows']); $this->assertStringContainsString( '<form id="continueForm" method="post" ' diff --git a/test/classes/Import/SimulateDmlTest.php b/test/classes/Import/SimulateDmlTest.php index c19a167810..f17ee3c440 100644 --- a/test/classes/Import/SimulateDmlTest.php +++ b/test/classes/Import/SimulateDmlTest.php @@ -37,7 +37,7 @@ class SimulateDmlTest extends AbstractTestCase 'sql_signature' => Core::signSqlQuery($simulatedQuery), ]); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $this->assertEquals([ 'sql_query' => Generator::formatSql($sqlQuery), 'matched_rows' => 2, diff --git a/test/classes/Plugins/Export/ExportHtmlwordTest.php b/test/classes/Plugins/Export/ExportHtmlwordTest.php index 575f1a3c98..f9b911514c 100644 --- a/test/classes/Plugins/Export/ExportHtmlwordTest.php +++ b/test/classes/Plugins/Export/ExportHtmlwordTest.php @@ -633,7 +633,7 @@ class ExportHtmlwordTest extends AbstractTestCase 'test' ) ); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $result = ob_get_clean(); $this->assertEquals( @@ -685,7 +685,7 @@ class ExportHtmlwordTest extends AbstractTestCase 'test' ) ); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $result = ob_get_clean(); $this->assertEquals( diff --git a/test/classes/Plugins/Export/ExportOdtTest.php b/test/classes/Plugins/Export/ExportOdtTest.php index b133cbb32c..db7bbe1ea8 100644 --- a/test/classes/Plugins/Export/ExportOdtTest.php +++ b/test/classes/Plugins/Export/ExportOdtTest.php @@ -542,7 +542,7 @@ class ExportOdtTest extends AbstractTestCase $this->object->getTableDefStandIn('test_db', 'test_table', "\n"), '' ); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $this->assertEquals( '<table:table table:name="test_table_data">' @@ -796,7 +796,7 @@ class ExportOdtTest extends AbstractTestCase 'test' ) ); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $this->assertEquals( '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' @@ -870,7 +870,7 @@ class ExportOdtTest extends AbstractTestCase 'test' ) ); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $this->assertEquals( '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' @@ -912,7 +912,7 @@ class ExportOdtTest extends AbstractTestCase 'test' ) ); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $this->assertEquals( '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' diff --git a/test/classes/Plugins/Export/ExportTexytextTest.php b/test/classes/Plugins/Export/ExportTexytextTest.php index 3168a4187d..44cc59ce5b 100644 --- a/test/classes/Plugins/Export/ExportTexytextTest.php +++ b/test/classes/Plugins/Export/ExportTexytextTest.php @@ -228,7 +228,7 @@ class ExportTexytextTest extends AbstractTestCase { $this->dummyDbi->addSelectDb('test_db'); $result = $this->object->getTableDefStandIn('test_db', 'test_table', "\n"); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $this->assertEquals( '|------' . "\n" @@ -373,7 +373,7 @@ class ExportTexytextTest extends AbstractTestCase 'test' ) ); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $result = ob_get_clean(); $this->assertIsString($result); @@ -424,7 +424,7 @@ class ExportTexytextTest extends AbstractTestCase 'test' ) ); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $result = ob_get_clean(); $this->assertEquals( @@ -451,7 +451,7 @@ class ExportTexytextTest extends AbstractTestCase 'test' ) ); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $result = ob_get_clean(); $this->assertEquals( diff --git a/test/classes/StorageEngineTest.php b/test/classes/StorageEngineTest.php index 5bb24191ef..819890ec89 100644 --- a/test/classes/StorageEngineTest.php +++ b/test/classes/StorageEngineTest.php @@ -703,7 +703,7 @@ class StorageEngineTest extends AbstractTestCase $this->dummyDbi->addSelectDb('my_db'); $lengths = StorageEngine::getMroongaLengths('my_db', 'idx_correo'); - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); $this->assertSame([4521984, 578126], $lengths); $this->dummyDbi->assertAllQueriesConsumed(); diff --git a/test/classes/TwoFactorTest.php b/test/classes/TwoFactorTest.php index 45cae8343a..19c6bb1a3b 100644 --- a/test/classes/TwoFactorTest.php +++ b/test/classes/TwoFactorTest.php @@ -40,7 +40,7 @@ class TwoFactorTest extends AbstractTestCase protected function tearDown(): void { - $this->assertAllSelectsConsumed(); + $this->dummyDbi->assertAllSelectsConsumed(); } private function initStorageConfigAndData(): void |