From 7fc96d6621ccd817c114aef197c1784b1ba6e2a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Sat, 12 Oct 2024 14:26:03 -0300 Subject: [PATCH 1/2] Call PHPUnit static methods using static calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backports #18907 to QA_5_2. This makes merging QA_5_2 into master easier. Changes done using Rector. - #18907 Signed-off-by: Maurício Meneghini Fauth --- phpstan-baseline.neon | 42 +- psalm-baseline.xml | 3 +- test/classes/AbstractTestCase.php | 14 +- test/classes/AdvisorTest.php | 12 +- test/classes/BookmarkTest.php | 20 +- test/classes/BrowseForeignersTest.php | 144 +- test/classes/CacheTest.php | 62 +- test/classes/Charsets/CharsetTest.php | 10 +- test/classes/Charsets/CollationTest.php | 20 +- test/classes/CharsetsTest.php | 22 +- test/classes/CheckUserPrivilegesTest.php | 54 +- .../classes/Command/SetVersionCommandTest.php | 5 +- test/classes/Command/TwigLintCommandTest.php | 14 +- .../Command/WriteGitRevisionCommandTest.php | 17 +- test/classes/CommonTest.php | 26 +- test/classes/Config/ConfigFileTest.php | 267 +--- test/classes/Config/DescriptionTest.php | 16 +- .../Config/FormDisplayTemplateTest.php | 76 +- test/classes/Config/FormDisplayTest.php | 185 +-- test/classes/Config/FormTest.php | 93 +- test/classes/Config/Forms/FormListTest.php | 18 +- test/classes/Config/PageSettingsTest.php | 30 +- .../classes/Config/ServerConfigChecksTest.php | 80 +- test/classes/Config/Settings/ConsoleTest.php | 2 +- test/classes/Config/Settings/DebugTest.php | 2 +- test/classes/Config/Settings/ExportTest.php | 2 +- test/classes/Config/Settings/ImportTest.php | 2 +- test/classes/Config/Settings/SchemaTest.php | 2 +- test/classes/Config/Settings/ServerTest.php | 2 +- .../Config/Settings/SqlQueryBoxTest.php | 2 +- .../Config/Settings/TransformationsTest.php | 2 +- test/classes/Config/SettingsTest.php | 42 +- .../ConfigStorage/RelationParametersTest.php | 119 +- test/classes/ConfigStorage/RelationTest.php | 204 ++- test/classes/ConfigStorage/UserGroupsTest.php | 49 +- test/classes/ConfigTest.php | 209 ++- test/classes/ConsoleTest.php | 8 +- .../CheckRelationsControllerTest.php | 6 +- .../Database/EventsControllerTest.php | 4 +- .../MultiTableQuery/TablesControllerTest.php | 19 +- .../Database/PrivilegesControllerTest.php | 47 +- .../Database/RoutinesControllerTest.php | 4 +- .../Structure/FavoriteTableControllerTest.php | 4 +- .../Structure/RealRowCountControllerTest.php | 4 +- .../Database/StructureControllerTest.php | 155 +- .../Database/TriggersControllerTest.php | 4 +- .../Export/ExportControllerTest.php | 4 +- .../Export/Template/CreateControllerTest.php | 4 +- .../Export/Template/DeleteControllerTest.php | 2 +- .../Export/Template/LoadControllerTest.php | 4 +- .../Export/Template/UpdateControllerTest.php | 2 +- .../GisDataEditorControllerTest.php | 2 +- .../Import/ImportControllerTest.php | 4 +- .../Import/SimulateDmlControllerTest.php | 6 +- .../JavaScriptMessagesControllerTest.php | 12 +- .../Controllers/NavigationControllerTest.php | 200 ++- .../NormalizationControllerTest.php | 30 +- .../Server/BinlogControllerTest.php | 38 +- .../Server/CollationsControllerTest.php | 22 +- .../Server/Databases/CreateControllerTest.php | 13 +- .../Databases/DestroyControllerTest.php | 6 +- .../Server/DatabasesControllerTest.php | 52 +- .../Server/EnginesControllerTest.php | 16 +- .../Server/PluginsControllerTest.php | 20 +- .../Privileges/AccountLockControllerTest.php | 24 +- .../AccountUnlockControllerTest.php | 24 +- .../Server/ShowEngineControllerTest.php | 29 +- .../Server/Status/AdvisorControllerTest.php | 10 +- .../Monitor/GeneralLogControllerTest.php | 6 +- .../Status/Monitor/LogVarsControllerTest.php | 2 +- .../Monitor/QueryAnalyzerControllerTest.php | 12 +- .../Status/Monitor/SlowLogControllerTest.php | 6 +- .../Server/Status/MonitorControllerTest.php | 53 +- .../Processes/RefreshControllerTest.php | 37 +- .../Server/Status/ProcessesControllerTest.php | 39 +- .../Server/Status/QueriesControllerTest.php | 63 +- .../Server/Status/StatusControllerTest.php | 30 +- .../Server/Status/VariablesControllerTest.php | 42 +- .../Server/VariablesControllerTest.php | 59 +- .../Sql/EnumValuesControllerTest.php | 36 +- .../Sql/SetValuesControllerTest.php | 28 +- .../Table/FindReplaceControllerTest.php | 4 +- .../Table/IndexesControllerTest.php | 33 +- .../Table/OperationsControllerTest.php | 2 +- .../Table/PrivilegesControllerTest.php | 55 +- .../Table/RelationControllerTest.php | 14 +- .../Table/ReplaceControllerTest.php | 23 +- .../Table/SearchControllerTest.php | 4 +- .../Table/Structure/ChangeControllerTest.php | 21 +- .../Structure/MoveColumnsControllerTest.php | 2 +- .../Table/Structure/SaveControllerTest.php | 4 +- .../Transformation/OverviewControllerTest.php | 22 +- test/classes/CoreTest.php | 223 +-- test/classes/CreateAddFieldTest.php | 8 +- test/classes/Crypto/CryptoTest.php | 26 +- test/classes/Database/CentralColumnsTest.php | 199 +-- test/classes/Database/Designer/CommonTest.php | 20 +- test/classes/Database/DesignerTest.php | 61 +- test/classes/Database/EventsTest.php | 21 +- test/classes/Database/QbeTest.php | 467 +++--- test/classes/Database/RoutinesTest.php | 48 +- test/classes/Database/SearchTest.php | 59 +- test/classes/Database/TriggersTest.php | 21 +- test/classes/DatabaseInterfaceTest.php | 99 +- test/classes/Dbal/DatabaseNameTest.php | 4 +- test/classes/Dbal/DbiDummyTest.php | 27 +- test/classes/Dbal/DbiMysqliTest.php | 16 +- test/classes/Dbal/MysqliResultTest.php | 10 +- test/classes/Dbal/TableNameTest.php | 4 +- test/classes/Dbal/WarningTest.php | 8 +- test/classes/Display/ResultsTest.php | 286 ++-- test/classes/EncodingTest.php | 101 +- test/classes/Engines/BdbTest.php | 51 +- test/classes/Engines/BinlogTest.php | 5 +- test/classes/Engines/InnodbTest.php | 311 ++-- test/classes/Engines/MemoryTest.php | 9 +- test/classes/Engines/MrgMyisamTest.php | 5 +- test/classes/Engines/MyisamTest.php | 113 +- test/classes/Engines/NdbclusterTest.php | 19 +- test/classes/Engines/PbxtTest.php | 255 ++-- .../classes/Engines/PerformanceSchemaTest.php | 5 +- test/classes/EnvironmentTest.php | 5 +- test/classes/ErrorHandlerTest.php | 140 +- test/classes/ErrorReportTest.php | 31 +- test/classes/ErrorTest.php | 23 +- test/classes/Export/OptionsTest.php | 4 +- test/classes/ExportTest.php | 8 +- test/classes/FieldMetadataTest.php | 152 +- test/classes/FileListingTest.php | 36 +- test/classes/FileTest.php | 6 +- test/classes/FlashMessagesTest.php | 29 +- test/classes/FontTest.php | 216 +-- test/classes/FooterTest.php | 37 +- test/classes/Gis/GisFactoryTest.php | 2 +- test/classes/Gis/GisGeomTestCase.php | 15 +- .../classes/Gis/GisGeometryCollectionTest.php | 38 +- test/classes/Gis/GisGeometryTest.php | 101 +- test/classes/Gis/GisLineStringTest.php | 27 +- test/classes/Gis/GisMultiLineStringTest.php | 29 +- test/classes/Gis/GisMultiPointTest.php | 32 +- test/classes/Gis/GisMultiPolygonTest.php | 29 +- test/classes/Gis/GisPointTest.php | 42 +- test/classes/Gis/GisPolygonTest.php | 40 +- test/classes/Gis/GisVisualizationTest.php | 85 +- test/classes/GitTest.php | 188 ++- test/classes/HeaderTest.php | 48 +- test/classes/Html/GeneratorTest.php | 175 +-- test/classes/Html/MySQLDocumentationTest.php | 2 +- test/classes/Html/SecurityTest.php | 75 +- .../Http/Factory/ServerRequestFactoryTest.php | 81 +- test/classes/Import/AjaxTest.php | 2 +- test/classes/ImportTest.php | 133 +- test/classes/IndexColumnTest.php | 47 +- test/classes/IndexTest.php | 85 +- test/classes/InsertEditTest.php | 1308 +++++++---------- test/classes/InternalRelationsTest.php | 44 +- test/classes/IpAllowDenyTest.php | 81 +- test/classes/LanguageTest.php | 47 +- test/classes/LinterTest.php | 52 +- test/classes/ListDatabaseTest.php | 51 +- test/classes/LoggingTest.php | 4 +- test/classes/MenuTest.php | 20 +- test/classes/MessageTest.php | 247 ++-- test/classes/MimeTest.php | 5 +- test/classes/Navigation/NavigationTest.php | 4 +- .../classes/Navigation/NavigationTreeTest.php | 18 +- test/classes/Navigation/NodeFactoryTest.php | 18 +- .../Nodes/NodeColumnContainerTest.php | 15 +- .../Navigation/Nodes/NodeColumnTest.php | 25 +- .../Nodes/NodeDatabaseChildTest.php | 13 +- .../Navigation/Nodes/NodeDatabaseTest.php | 65 +- .../Nodes/NodeEventContainerTest.php | 15 +- .../Navigation/Nodes/NodeEventTest.php | 23 +- .../Nodes/NodeFunctionContainerTest.php | 15 +- .../Navigation/Nodes/NodeFunctionTest.php | 23 +- .../Nodes/NodeIndexContainerTest.php | 15 +- .../Navigation/Nodes/NodeIndexTest.php | 13 +- .../Nodes/NodeProcedureContainerTest.php | 15 +- .../Navigation/Nodes/NodeProcedureTest.php | 23 +- .../Nodes/NodeTableContainerTest.php | 17 +- .../Navigation/Nodes/NodeTableTest.php | 23 +- test/classes/Navigation/Nodes/NodeTest.php | 115 +- .../Nodes/NodeTriggerContainerTest.php | 15 +- .../Navigation/Nodes/NodeTriggerTest.php | 23 +- .../Nodes/NodeViewContainerTest.php | 17 +- .../classes/Navigation/Nodes/NodeViewTest.php | 19 +- test/classes/NormalizationTest.php | 252 ++-- test/classes/OpenDocumentTest.php | 16 +- test/classes/OperationsTest.php | 2 +- test/classes/Partitioning/PartitionTest.php | 4 +- .../classes/Partitioning/SubPartitionTest.php | 16 +- .../TablePartitionDefinitionTest.php | 16 +- test/classes/PdfTest.php | 6 +- .../Plugins/Auth/AuthenticationConfigTest.php | 43 +- .../Plugins/Auth/AuthenticationCookieTest.php | 210 ++- .../Plugins/Auth/AuthenticationHttpTest.php | 67 +- .../Plugins/Auth/AuthenticationSignonTest.php | 89 +- .../Plugins/Export/ExportCodegenTest.php | 274 ++-- test/classes/Plugins/Export/ExportCsvTest.php | 255 +--- .../Plugins/Export/ExportExcelTest.php | 104 +- .../Plugins/Export/ExportHtmlwordTest.php | 397 ++--- .../classes/Plugins/Export/ExportJsonTest.php | 95 +- .../Plugins/Export/ExportLatexTest.php | 509 +++---- .../Plugins/Export/ExportMediawikiTest.php | 259 ++-- test/classes/Plugins/Export/ExportOdsTest.php | 199 +-- test/classes/Plugins/Export/ExportOdtTest.php | 697 ++++----- test/classes/Plugins/Export/ExportPdfTest.php | 120 +- .../Plugins/Export/ExportPhparrayTest.php | 130 +- test/classes/Plugins/Export/ExportSqlTest.php | 603 +++----- .../Plugins/Export/ExportTexytextTest.php | 280 ++-- test/classes/Plugins/Export/ExportXmlTest.php | 213 +-- .../classes/Plugins/Export/ExportYamlTest.php | 128 +- .../Export/Helpers/TablePropertyTest.php | 79 +- test/classes/Plugins/Import/ImportCsvTest.php | 64 +- test/classes/Plugins/Import/ImportLdiTest.php | 40 +- .../Plugins/Import/ImportMediawikiTest.php | 46 +- test/classes/Plugins/Import/ImportOdsTest.php | 152 +- test/classes/Plugins/Import/ImportShpTest.php | 67 +- test/classes/Plugins/Import/ImportSqlTest.php | 8 +- test/classes/Plugins/Import/ImportXmlTest.php | 34 +- .../Plugins/Schema/DiaRelationSchemaTest.php | 10 +- .../Plugins/Schema/EpsRelationSchemaTest.php | 14 +- .../Schema/ExportRelationSchemaTest.php | 57 +- .../Plugins/Schema/PdfRelationSchemaTest.php | 16 +- .../Plugins/Schema/SvgRelationSchemaTest.php | 10 +- .../TransformationPluginsTest.php | 20 +- test/classes/Plugins/TwoFactor/KeyTest.php | 2 +- .../Plugins/TwoFactor/WebAuthnTest.php | 85 +- test/classes/PluginsTest.php | 26 +- test/classes/ProfilingTest.php | 4 +- .../Groups/OptionsPropertyMainGroupTest.php | 5 +- .../Groups/OptionsPropertyRootGroupTest.php | 7 +- .../Groups/OptionsPropertySubgroupTest.php | 10 +- .../Options/Items/PropertyItemsTest.php | 55 +- .../Options/OptionsPropertyGroupTest.php | 51 +- .../Options/OptionsPropertyItemTest.php | 20 +- .../Options/OptionsPropertyOneItemTest.php | 31 +- .../Plugins/ExportPluginPropertiesTest.php | 9 +- .../Plugins/ImportPluginPropertiesTest.php | 15 +- .../Plugins/PluginPropertyItemTest.php | 5 +- test/classes/Properties/PropertyItemTest.php | 5 +- test/classes/Query/CompatibilityTest.php | 4 +- test/classes/Query/GeneratorTest.php | 129 +- test/classes/ReplicationGuiTest.php | 58 +- test/classes/ResponseRendererTest.php | 20 +- test/classes/RoutingTest.php | 16 +- test/classes/SanitizeTest.php | 58 +- test/classes/ScriptsTest.php | 36 +- test/classes/Server/PluginTest.php | 33 +- test/classes/Server/PluginsTest.php | 39 +- test/classes/Server/PrivilegesTest.php | 811 ++++------ test/classes/Server/SelectTest.php | 31 +- test/classes/Server/SysInfo/SysInfoTest.php | 9 +- test/classes/Setup/ConfigGeneratorTest.php | 181 +-- test/classes/Setup/FormProcessingTest.php | 10 +- test/classes/Setup/IndexTest.php | 64 +- test/classes/SqlQueryFormTest.php | 53 +- test/classes/SqlTest.php | 178 +-- test/classes/StorageEngineTest.php | 146 +- test/classes/SystemDatabaseTest.php | 4 +- test/classes/Table/ColumnsDefinitionTest.php | 2 +- test/classes/Table/IndexesTest.php | 8 +- .../classes/Table/Maintenance/MessageTest.php | 8 +- test/classes/Table/SearchTest.php | 68 +- test/classes/TableTest.php | 265 ++-- test/classes/TemplateTest.php | 27 +- test/classes/ThemeManagerTest.php | 22 +- test/classes/ThemeTest.php | 80 +- test/classes/TrackerTest.php | 108 +- test/classes/TrackingTest.php | 290 +--- test/classes/TransformationsTest.php | 224 ++- test/classes/TwoFactorTest.php | 103 +- test/classes/TypesByDatabaseVersionTest.php | 14 +- test/classes/TypesTest.php | 620 ++++---- test/classes/UrlTest.php | 81 +- test/classes/UserPasswordTest.php | 2 +- test/classes/UserPreferencesTest.php | 120 +- test/classes/UtilTest.php | 263 ++-- test/classes/Utils/ForeignKeyTest.php | 21 +- test/classes/Utils/FormatConverterTest.php | 8 +- test/classes/Utils/GisTest.php | 18 +- test/classes/Utils/HttpRequestTest.php | 10 +- test/classes/Utils/SessionCacheTest.php | 48 +- test/classes/VersionInformationTest.php | 45 +- test/classes/VersionTest.php | 28 +- test/classes/WebAuthn/CBORDecoderTest.php | 10 +- test/classes/ZipExtensionTest.php | 82 +- test/selenium/ChangePasswordTest.php | 17 +- test/selenium/CreateDropDatabaseTest.php | 8 +- test/selenium/CreateRemoveUserTest.php | 13 +- test/selenium/Database/EventsTest.php | 26 +- test/selenium/Database/OperationsTest.php | 22 +- test/selenium/Database/ProceduresTest.php | 21 +- test/selenium/Database/QueryByExampleTest.php | 52 +- test/selenium/Database/StructureTest.php | 18 +- test/selenium/Database/TriggersTest.php | 24 +- test/selenium/ExportTest.php | 6 +- test/selenium/ImportTest.php | 14 +- test/selenium/LoginTest.php | 4 +- test/selenium/NormalizationTest.php | 85 +- test/selenium/ServerSettingsTest.php | 32 +- test/selenium/SqlQueryTest.php | 65 +- test/selenium/Table/BrowseTest.php | 151 +- test/selenium/Table/CreateTest.php | 60 +- test/selenium/Table/InsertTest.php | 49 +- test/selenium/Table/OperationsTest.php | 25 +- test/selenium/Table/StructureTest.php | 27 +- test/selenium/TrackingTest.php | 76 +- test/selenium/XssTest.php | 2 +- 309 files changed, 8234 insertions(+), 13026 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index f8d6dffb0a..5799cfb3a3 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -9176,17 +9176,17 @@ parameters: path: test/classes/AdvisorTest.php - - message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" count: 3 path: test/classes/BrowseForeignersTest.php - - message: "#^Parameter \\#2 \\$string of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringEndsWith\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$string of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringEndsWith\\(\\) expects string, mixed given\\.$#" count: 1 path: test/classes/BrowseForeignersTest.php - - message: "#^Parameter \\#2 \\$string of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringStartsWith\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$string of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringStartsWith\\(\\) expects string, mixed given\\.$#" count: 1 path: test/classes/BrowseForeignersTest.php @@ -9226,17 +9226,17 @@ parameters: path: test/classes/Command/TwigLintCommandTest.php - - message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertFalse\\(\\) with true will always evaluate to false\\.$#" + message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertFalse\\(\\) with true will always evaluate to false\\.$#" count: 1 path: test/classes/CommonTest.php - - message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\) with \\*NEVER\\* will always evaluate to false\\.$#" + message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\) with \\*NEVER\\* will always evaluate to false\\.$#" count: 1 path: test/classes/CommonTest.php - - message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\) with false will always evaluate to false\\.$#" + message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\) with false will always evaluate to false\\.$#" count: 1 path: test/classes/CommonTest.php @@ -9251,7 +9251,7 @@ parameters: path: test/classes/Config/DescriptionTest.php - - message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\) with null will always evaluate to false\\.$#" + message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\) with null will always evaluate to false\\.$#" count: 1 path: test/classes/Config/FormDisplayTest.php @@ -9376,7 +9376,7 @@ parameters: path: test/classes/Controllers/Database/Structure/FavoriteTableControllerTest.php - - message: "#^Parameter \\#2 \\$array of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertArrayHasKey\\(\\) expects array\\|ArrayAccess, mixed given\\.$#" + message: "#^Parameter \\#2 \\$array of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertArrayHasKey\\(\\) expects array\\|ArrayAccess, mixed given\\.$#" count: 1 path: test/classes/Controllers/Database/Structure/FavoriteTableControllerTest.php @@ -9411,17 +9411,17 @@ parameters: path: test/classes/Controllers/Database/StructureControllerTest.php - - message: "#^Parameter \\#2 \\$array of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertArrayNotHasKey\\(\\) expects array\\|ArrayAccess, mixed given\\.$#" + message: "#^Parameter \\#2 \\$array of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertArrayNotHasKey\\(\\) expects array\\|ArrayAccess, mixed given\\.$#" count: 1 path: test/classes/Controllers/Database/StructureControllerTest.php - - message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" count: 4 path: test/classes/Controllers/Database/StructureControllerTest.php - - message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringNotContainsString\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringNotContainsString\\(\\) expects string, mixed given\\.$#" count: 1 path: test/classes/Controllers/Database/StructureControllerTest.php @@ -9511,7 +9511,7 @@ parameters: path: test/classes/Database/CentralColumnsTest.php - - message: "#^Parameter \\#1 \\$needle of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$needle of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" count: 1 path: test/classes/Database/CentralColumnsTest.php @@ -9571,12 +9571,12 @@ parameters: path: test/classes/Database/EventsTest.php - - message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" count: 7 path: test/classes/Database/QbeTest.php - - message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringNotContainsString\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringNotContainsString\\(\\) expects string, mixed given\\.$#" count: 1 path: test/classes/Database/QbeTest.php @@ -9941,7 +9941,7 @@ parameters: path: test/classes/Display/ResultsTest.php - - message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" count: 9 path: test/classes/Display/ResultsTest.php @@ -10711,7 +10711,7 @@ parameters: path: test/classes/Partitioning/TablePartitionDefinitionTest.php - - message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with 32 and 0 will always evaluate to false\\.$#" + message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with 32 and 0 will always evaluate to false\\.$#" count: 1 path: test/classes/Plugins/Auth/AuthenticationCookieTest.php @@ -10741,17 +10741,17 @@ parameters: path: test/classes/Plugins/Auth/AuthenticationHttpTest.php - - message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" count: 1 path: test/classes/Plugins/Export/ExportHtmlwordTest.php - - message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" count: 5 path: test/classes/Plugins/Export/ExportOdtTest.php - - message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" count: 2 path: test/classes/Plugins/Export/ExportSqlTest.php @@ -11231,12 +11231,12 @@ parameters: path: test/classes/Utils/HttpRequestTest.php - - message: "#^Parameter \\#1 \\$needle of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$needle of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" count: 1 path: test/classes/Utils/HttpRequestTest.php - - message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, mixed given\\.$#" count: 1 path: test/classes/Utils/HttpRequestTest.php diff --git a/psalm-baseline.xml b/psalm-baseline.xml index fa4e5af576..b88a07c766 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -16093,9 +16093,10 @@ - + $import_notice $sql_query + $sql_query assertFalse diff --git a/test/classes/AbstractTestCase.php b/test/classes/AbstractTestCase.php index ef7047b3b7..e273025dcf 100644 --- a/test/classes/AbstractTestCase.php +++ b/test/classes/AbstractTestCase.php @@ -104,23 +104,19 @@ abstract class AbstractTestCase extends TestCase protected function assertAllQueriesConsumed(): void { $unUsedQueries = $this->dummyDbi->getUnUsedQueries(); - $this->assertSame([], $unUsedQueries, 'Some queries where not used !'); + self::assertSame([], $unUsedQueries, 'Some queries where not used !'); } protected function assertAllSelectsConsumed(): void { $unUsedSelects = $this->dummyDbi->getUnUsedDatabaseSelects(); - $this->assertSame( - [], - $unUsedSelects, - 'Some database selects where not used !' - ); + self::assertSame([], $unUsedSelects, 'Some database selects where not used !'); } protected function assertAllErrorCodesConsumed(): void { if ($this->dummyDbi->hasUnUsedErrors() === false) { - $this->assertTrue(true);// increment the assertion count + self::assertTrue(true);// increment the assertion count return; } @@ -205,7 +201,7 @@ abstract class AbstractTestCase extends TestCase /** @var ResponseRenderer $response */ $response = $containerBuilder->get(ResponseRenderer::class); - $this->assertFalse($response->hasSuccessState(), 'expected the request to fail'); + self::assertFalse($response->hasSuccessState(), 'expected the request to fail'); } protected function assertResponseWasSuccessfull(): void @@ -214,7 +210,7 @@ abstract class AbstractTestCase extends TestCase /** @var ResponseRenderer $response */ $response = $containerBuilder->get(ResponseRenderer::class); - $this->assertTrue($response->hasSuccessState(), 'expected the request not to fail'); + self::assertTrue($response->hasSuccessState(), 'expected the request not to fail'); } protected function setGlobalDbi(): void diff --git a/test/classes/AdvisorTest.php b/test/classes/AdvisorTest.php index 35b3171bc0..7048044b8f 100644 --- a/test/classes/AdvisorTest.php +++ b/test/classes/AdvisorTest.php @@ -30,7 +30,7 @@ class AdvisorTest extends AbstractTestCase public function testAdvisorBytime(float $time, string $expected): void { $result = Advisor::byTime($time, 2); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } public static function advisorTimes(): array @@ -73,21 +73,21 @@ class AdvisorTest extends AbstractTestCase parent::setLanguage(); $advisor = new Advisor($GLOBALS['dbi'], new ExpressionLanguage()); $parseResult = include ROOT_PATH . 'libraries/advisory_rules_generic.php'; - $this->assertIsArray($parseResult); - $this->assertArrayHasKey(0, $parseResult); - $this->assertIsArray($parseResult[0]); + self::assertIsArray($parseResult); + self::assertArrayHasKey(0, $parseResult); + self::assertIsArray($parseResult[0]); $advisor->setVariable('value', 0); $advisor->addRule('fired', $rule); $runResult = $advisor->getRunResult(); if (isset($runResult['errors']) || $error !== null) { - $this->assertEquals([$error], $runResult['errors']); + self::assertEquals([$error], $runResult['errors']); } if (! isset($runResult['fired']) && $expected == []) { return; } - $this->assertEquals([$expected], $runResult['fired']); + self::assertEquals([$expected], $runResult['fired']); } public static function rulesProvider(): array diff --git a/test/classes/BookmarkTest.php b/test/classes/BookmarkTest.php index 588c77c956..4cb3291b2f 100644 --- a/test/classes/BookmarkTest.php +++ b/test/classes/BookmarkTest.php @@ -46,7 +46,7 @@ class BookmarkTest extends AbstractTestCase $GLOBALS['cfg']['Server']['user'], 'sakila' ); - $this->assertContainsOnlyInstancesOf(Bookmark::class, $actual); + self::assertContainsOnlyInstancesOf(Bookmark::class, $actual); $this->assertAllSelectsConsumed(); } @@ -56,14 +56,12 @@ class BookmarkTest extends AbstractTestCase public function testGet(): void { $this->dummyDbi->addSelectDb('phpmyadmin'); - $this->assertNull( - Bookmark::get( - $GLOBALS['dbi'], - $GLOBALS['cfg']['Server']['user'], - 'phpmyadmin', - '1' - ) - ); + self::assertNull(Bookmark::get( + $GLOBALS['dbi'], + $GLOBALS['cfg']['Server']['user'], + 'phpmyadmin', + '1' + )); $this->assertAllSelectsConsumed(); } @@ -80,9 +78,9 @@ class BookmarkTest extends AbstractTestCase ]; $bookmark = Bookmark::createBookmark($GLOBALS['dbi'], $bookmarkData); - $this->assertNotFalse($bookmark); + self::assertNotFalse($bookmark); $this->dummyDbi->addSelectDb('phpmyadmin'); - $this->assertFalse($bookmark->save()); + self::assertFalse($bookmark->save()); $this->assertAllSelectsConsumed(); } } diff --git a/test/classes/BrowseForeignersTest.php b/test/classes/BrowseForeignersTest.php index e60f7352ae..c9d20cb97c 100644 --- a/test/classes/BrowseForeignersTest.php +++ b/test/classes/BrowseForeignersTest.php @@ -34,34 +34,20 @@ class BrowseForeignersTest extends AbstractTestCase */ public function testGetForeignLimit(): void { - $this->assertNull( - $this->browseForeigners->getForeignLimit('Show all') - ); + self::assertNull($this->browseForeigners->getForeignLimit('Show all')); - $this->assertEquals( - 'LIMIT 0, 25 ', - $this->browseForeigners->getForeignLimit(null) - ); + self::assertEquals('LIMIT 0, 25 ', $this->browseForeigners->getForeignLimit(null)); $_POST['pos'] = 10; - $this->assertEquals( - 'LIMIT 10, 25 ', - $this->browseForeigners->getForeignLimit(null) - ); + self::assertEquals('LIMIT 10, 25 ', $this->browseForeigners->getForeignLimit(null)); $GLOBALS['cfg']['MaxRows'] = 50; $browseForeigners = new BrowseForeigners(new Template()); - $this->assertEquals( - 'LIMIT 10, 50 ', - $browseForeigners->getForeignLimit(null) - ); + self::assertEquals('LIMIT 10, 50 ', $browseForeigners->getForeignLimit(null)); - $this->assertEquals( - 'LIMIT 10, 50 ', - $browseForeigners->getForeignLimit('xyz') - ); + self::assertEquals('LIMIT 10, 50 ', $browseForeigners->getForeignLimit('xyz')); } /** @@ -69,30 +55,24 @@ class BrowseForeignersTest extends AbstractTestCase */ public function testGetHtmlForGotoPage(): void { - $this->assertEquals( - '', - $this->callFunction( - $this->browseForeigners, - BrowseForeigners::class, - 'getHtmlForGotoPage', - [null] - ) - ); + self::assertEquals('', $this->callFunction( + $this->browseForeigners, + BrowseForeigners::class, + 'getHtmlForGotoPage', + [null] + )); $_POST['pos'] = 15; $foreignData = []; $foreignData['disp_row'] = []; $foreignData['the_total'] = 5; - $this->assertEquals( - '', - $this->callFunction( - $this->browseForeigners, - BrowseForeigners::class, - 'getHtmlForGotoPage', - [$foreignData] - ) - ); + self::assertEquals('', $this->callFunction( + $this->browseForeigners, + BrowseForeigners::class, + 'getHtmlForGotoPage', + [$foreignData] + )); $foreignData['the_total'] = 30; $result = $this->callFunction( @@ -102,15 +82,15 @@ class BrowseForeignersTest extends AbstractTestCase [$foreignData] ); - $this->assertStringStartsWith('Page number:', $result); + self::assertStringStartsWith('Page number:', $result); - $this->assertStringEndsWith('', $result); + self::assertStringEndsWith('', $result); - $this->assertStringContainsString('', $result); + self::assertStringContainsString('', $result); - $this->assertStringContainsString('', $result); + self::assertStringContainsString('', $result); - $this->assertStringContainsString('', $result); + self::assertStringContainsString('', $result); - $this->assertStringContainsString('
', $result); - $this->assertStringContainsString('