Fix failing tests

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2022-01-26 10:02:26 -03:00
parent 48b4ff8247
commit feda222da9
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
4 changed files with 63 additions and 37 deletions

View File

@ -288,6 +288,10 @@ class DatabaseInterface implements DbalInterface
*/
public function getTables(string $database, $link = self::CONNECT_USER): array
{
if ($database === '') {
return [];
}
$tables = $this->fetchResult(
'SHOW TABLES FROM ' . Util::backquote($database) . ';',
null,
@ -1170,9 +1174,7 @@ class DatabaseInterface implements DbalInterface
{
$storageDbName = $GLOBALS['cfg']['Server']['pmadb'] ?? '';
// Use "phpmyadmin" as a default database name to check to keep the behavior consistent
$storageDbName = $storageDbName !== null && is_string($storageDbName) && $storageDbName !== ''
? $storageDbName
: 'phpmyadmin';
$storageDbName = is_string($storageDbName) && $storageDbName !== '' ? $storageDbName : 'phpmyadmin';
// This will make users not having explicitly listed databases
// have config values filled by the default phpMyAdmin storage table name values

View File

@ -12,7 +12,6 @@ use PhpMyAdmin\Plugins\UploadInterface;
use function array_key_exists;
use function function_exists;
use function trim;
use function uploadprogress_get_info;
/**
* Implementation for upload progress
@ -65,7 +64,8 @@ class UploadProgress implements UploadInterface
$status = null;
// @see https://pecl.php.net/package/uploadprogress
if (function_exists('uploadprogress_get_info')) {
$status = uploadprogress_get_info($id);
// phpcs:ignore SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName
$status = \uploadprogress_get_info($id);
}
if ($status) {

View File

@ -1,5 +1,15 @@
parameters:
ignoreErrors:
-
message: "#^Static property PhpMyAdmin\\\\Charsets\\:\\:\\$charsets \\(array\\<string, PhpMyAdmin\\\\Charsets\\\\Charset\\>\\) does not accept array\\<int\\|string, PhpMyAdmin\\\\Charsets\\\\Charset\\>\\.$#"
count: 1
path: libraries/classes/Charsets.php
-
message: "#^Static property PhpMyAdmin\\\\Charsets\\:\\:\\$collations \\(array\\<string, array\\<string, PhpMyAdmin\\\\Charsets\\\\Collation\\>\\>\\) does not accept array\\<int\\|string, array\\<int\\|string, PhpMyAdmin\\\\Charsets\\\\Collation\\>\\>\\.$#"
count: 1
path: libraries/classes/Charsets.php
-
message: "#^Strict comparison using \\=\\=\\= between non\\-empty\\-array\\<int, string\\> and false will always evaluate to false\\.$#"
count: 1
@ -316,7 +326,7 @@ parameters:
path: libraries/classes/Controllers/Table/StructureController.php
-
message: "#^Method PhpMyAdmin\\\\Controllers\\\\Table\\\\StructureController\\:\\:extractPartitionDetails\\(\\) should return array\\<array\\>\\|null but returns array\\<string, array\\<int, array\\<string, mixed\\>\\>\\|bool\\|int\\|string\\>\\.$#"
message: "#^Method PhpMyAdmin\\\\Controllers\\\\Table\\\\StructureController\\:\\:extractPartitionDetails\\(\\) should return array\\<array\\>\\|null but returns array\\<string, array\\<int\\<0, max\\>, array\\<string, mixed\\>\\>\\|bool\\|int\\|string\\>\\.$#"
count: 1
path: libraries/classes/Controllers/Table/StructureController.php
@ -361,7 +371,7 @@ parameters:
path: libraries/classes/Core.php
-
message: "#^Offset 'pass'\\|'port'\\|'user' does not exist on array\\{scheme\\?\\: string, host\\: string, port\\?\\: int, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\.$#"
message: "#^Offset 'pass'\\|'port'\\|'user' does not exist on array\\{host\\: non\\-empty\\-string, scheme\\?\\: string, port\\?\\: int, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\.$#"
count: 1
path: libraries/classes/Core.php
@ -371,22 +381,22 @@ parameters:
path: libraries/classes/Database/CentralColumns.php
-
message: "#^Offset 'DCN' does not exist on array\\{C_NAME\\: array\\<int, string\\>, DCN\\?\\: non\\-empty\\-array\\<int, string\\>, DTN\\?\\: non\\-empty\\-array\\<int, non\\-empty\\-string\\>, SCN\\?\\: non\\-empty\\-array\\<int, string\\>, STN\\?\\: non\\-empty\\-array\\<int, non\\-empty\\-string\\>\\}\\.$#"
message: "#^Offset 'DCN' does not exist on array\\{C_NAME\\: array\\<int\\<0, max\\>, string\\>, DCN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, DTN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-empty\\-string\\>, SCN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, STN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-empty\\-string\\>\\}\\.$#"
count: 1
path: libraries/classes/Database/Designer/Common.php
-
message: "#^Offset 'DTN' does not exist on array\\{C_NAME\\: array\\<int, string\\>, DCN\\?\\: non\\-empty\\-array\\<int, string\\>, DTN\\?\\: non\\-empty\\-array\\<int, non\\-empty\\-string\\>, SCN\\?\\: non\\-empty\\-array\\<int, string\\>, STN\\?\\: non\\-empty\\-array\\<int, non\\-empty\\-string\\>\\}\\.$#"
message: "#^Offset 'DTN' does not exist on array\\{C_NAME\\: array\\<int\\<0, max\\>, string\\>, DCN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, DTN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-empty\\-string\\>, SCN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, STN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-empty\\-string\\>\\}\\.$#"
count: 1
path: libraries/classes/Database/Designer/Common.php
-
message: "#^Offset 'SCN' does not exist on array\\{C_NAME\\: array\\<int, string\\>, DCN\\?\\: non\\-empty\\-array\\<int, string\\>, DTN\\?\\: non\\-empty\\-array\\<int, non\\-empty\\-string\\>, SCN\\?\\: non\\-empty\\-array\\<int, string\\>, STN\\?\\: non\\-empty\\-array\\<int, non\\-empty\\-string\\>\\}\\.$#"
message: "#^Offset 'SCN' does not exist on array\\{C_NAME\\: array\\<int\\<0, max\\>, string\\>, DCN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, DTN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-empty\\-string\\>, SCN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, STN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-empty\\-string\\>\\}\\.$#"
count: 1
path: libraries/classes/Database/Designer/Common.php
-
message: "#^Offset 'STN' does not exist on array\\{C_NAME\\: array\\<int, string\\>, DCN\\?\\: non\\-empty\\-array\\<int, string\\>, DTN\\?\\: non\\-empty\\-array\\<int, non\\-empty\\-string\\>, SCN\\?\\: non\\-empty\\-array\\<int, string\\>, STN\\?\\: non\\-empty\\-array\\<int, non\\-empty\\-string\\>\\}\\.$#"
message: "#^Offset 'STN' does not exist on array\\{C_NAME\\: array\\<int\\<0, max\\>, string\\>, DCN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, DTN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-empty\\-string\\>, SCN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, string\\>, STN\\?\\: non\\-empty\\-array\\<int\\<0, max\\>, non\\-empty\\-string\\>\\}\\.$#"
count: 2
path: libraries/classes/Database/Designer/Common.php
@ -545,6 +555,11 @@ parameters:
count: 1
path: libraries/classes/Display/Results.php
-
message: "#^Negated boolean expression is always false\\.$#"
count: 1
path: libraries/classes/Display/Results.php
-
message: "#^Offset 0 does not exist on array\\|null\\.$#"
count: 1
@ -571,37 +586,37 @@ parameters:
path: libraries/classes/Display/Results.php
-
message: "#^Parameter \\#5 \\$default_function of method PhpMyAdmin\\\\Display\\\\Results\\:\\:handleNonPrintableContents\\(\\) expects string, array\\<int, class\\-string\\|string\\> given\\.$#"
message: "#^Parameter \\#5 \\$default_function of method PhpMyAdmin\\\\Display\\\\Results\\:\\:handleNonPrintableContents\\(\\) expects string, array\\<int, string\\> given\\.$#"
count: 2
path: libraries/classes/Display/Results.php
-
message: "#^Parameter \\#7 \\$transformation_plugin of method PhpMyAdmin\\\\Display\\\\Results\\:\\:getDataCellForGeometryColumns\\(\\) expects PhpMyAdmin\\\\Plugins\\\\TransformationsPlugin, array\\<int, class\\-string\\|string\\>\\|object given\\.$#"
message: "#^Parameter \\#7 \\$transformation_plugin of method PhpMyAdmin\\\\Display\\\\Results\\:\\:getDataCellForGeometryColumns\\(\\) expects PhpMyAdmin\\\\Plugins\\\\TransformationsPlugin, array\\<int, string\\>\\|object given\\.$#"
count: 1
path: libraries/classes/Display/Results.php
-
message: "#^Parameter \\#7 \\$transformation_plugin of method PhpMyAdmin\\\\Display\\\\Results\\:\\:getDataCellForNonNumericColumns\\(\\) expects PhpMyAdmin\\\\Plugins\\\\TransformationsPlugin, array\\<int, class\\-string\\|string\\>\\|object given\\.$#"
message: "#^Parameter \\#7 \\$transformation_plugin of method PhpMyAdmin\\\\Display\\\\Results\\:\\:getDataCellForNonNumericColumns\\(\\) expects PhpMyAdmin\\\\Plugins\\\\TransformationsPlugin, array\\<int, string\\>\\|object given\\.$#"
count: 1
path: libraries/classes/Display/Results.php
-
message: "#^Parameter \\#8 \\$default_function of method PhpMyAdmin\\\\Display\\\\Results\\:\\:getDataCellForGeometryColumns\\(\\) expects string, array\\<int, class\\-string\\|string\\> given\\.$#"
message: "#^Parameter \\#8 \\$default_function of method PhpMyAdmin\\\\Display\\\\Results\\:\\:getDataCellForGeometryColumns\\(\\) expects string, array\\<int, string\\> given\\.$#"
count: 1
path: libraries/classes/Display/Results.php
-
message: "#^Parameter \\#8 \\$default_function of method PhpMyAdmin\\\\Display\\\\Results\\:\\:getDataCellForNonNumericColumns\\(\\) expects string, array\\<int, class\\-string\\|string\\> given\\.$#"
message: "#^Parameter \\#8 \\$default_function of method PhpMyAdmin\\\\Display\\\\Results\\:\\:getDataCellForNonNumericColumns\\(\\) expects string, array\\<int, string\\> given\\.$#"
count: 1
path: libraries/classes/Display/Results.php
-
message: "#^Parameter \\#8 \\$transformation_plugin of method PhpMyAdmin\\\\Display\\\\Results\\:\\:getDataCellForNumericColumns\\(\\) expects PhpMyAdmin\\\\Plugins\\\\TransformationsPlugin, array\\<int, class\\-string\\|string\\>\\|object given\\.$#"
message: "#^Parameter \\#8 \\$transformation_plugin of method PhpMyAdmin\\\\Display\\\\Results\\:\\:getDataCellForNumericColumns\\(\\) expects PhpMyAdmin\\\\Plugins\\\\TransformationsPlugin, array\\<int, string\\>\\|object given\\.$#"
count: 1
path: libraries/classes/Display/Results.php
-
message: "#^Parameter \\#9 \\$default_function of method PhpMyAdmin\\\\Display\\\\Results\\:\\:getDataCellForNumericColumns\\(\\) expects string, array\\<int, class\\-string\\|string\\> given\\.$#"
message: "#^Parameter \\#9 \\$default_function of method PhpMyAdmin\\\\Display\\\\Results\\:\\:getDataCellForNumericColumns\\(\\) expects string, array\\<int, string\\> given\\.$#"
count: 1
path: libraries/classes/Display/Results.php
@ -831,7 +846,7 @@ parameters:
path: libraries/classes/Gis/GisGeometryCollection.php
-
message: "#^Parameter \\#1 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getBoundsForOl\\(\\) expects string, int given\\.$#"
message: "#^Parameter \\#1 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getBoundsForOl\\(\\) expects string, int\\<min, \\-1\\>\\|int\\<1, max\\> given\\.$#"
count: 1
path: libraries/classes/Gis/GisLineString.php
@ -841,7 +856,7 @@ parameters:
path: libraries/classes/Gis/GisLineString.php
-
message: "#^Parameter \\#2 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getLineForOpenLayers\\(\\) expects string, int given\\.$#"
message: "#^Parameter \\#2 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getLineForOpenLayers\\(\\) expects string, int\\<min, \\-1\\>\\|int\\<1, max\\> given\\.$#"
count: 1
path: libraries/classes/Gis/GisLineString.php
@ -871,7 +886,7 @@ parameters:
path: libraries/classes/Gis/GisLineString.php
-
message: "#^Parameter \\#1 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getBoundsForOl\\(\\) expects string, int given\\.$#"
message: "#^Parameter \\#1 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getBoundsForOl\\(\\) expects string, int\\<min, \\-1\\>\\|int\\<1, max\\> given\\.$#"
count: 1
path: libraries/classes/Gis/GisMultiLineString.php
@ -881,7 +896,7 @@ parameters:
path: libraries/classes/Gis/GisMultiLineString.php
-
message: "#^Parameter \\#2 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getLineArrayForOpenLayers\\(\\) expects string, int given\\.$#"
message: "#^Parameter \\#2 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getLineArrayForOpenLayers\\(\\) expects string, int\\<min, \\-1\\>\\|int\\<1, max\\> given\\.$#"
count: 1
path: libraries/classes/Gis/GisMultiLineString.php
@ -911,7 +926,7 @@ parameters:
path: libraries/classes/Gis/GisMultiLineString.php
-
message: "#^Parameter \\#1 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getBoundsForOl\\(\\) expects string, int given\\.$#"
message: "#^Parameter \\#1 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getBoundsForOl\\(\\) expects string, int\\<min, \\-1\\>\\|int\\<1, max\\> given\\.$#"
count: 1
path: libraries/classes/Gis/GisMultiPoint.php
@ -921,7 +936,7 @@ parameters:
path: libraries/classes/Gis/GisMultiPoint.php
-
message: "#^Parameter \\#2 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisMultiPoint\\:\\:getPointsArrayForOpenLayers\\(\\) expects string, int given\\.$#"
message: "#^Parameter \\#2 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisMultiPoint\\:\\:getPointsArrayForOpenLayers\\(\\) expects string, int\\<min, \\-1\\>\\|int\\<1, max\\> given\\.$#"
count: 1
path: libraries/classes/Gis/GisMultiPoint.php
@ -951,7 +966,7 @@ parameters:
path: libraries/classes/Gis/GisMultiPoint.php
-
message: "#^Parameter \\#1 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getBoundsForOl\\(\\) expects string, int given\\.$#"
message: "#^Parameter \\#1 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getBoundsForOl\\(\\) expects string, int\\<min, \\-1\\>\\|int\\<1, max\\> given\\.$#"
count: 1
path: libraries/classes/Gis/GisMultiPolygon.php
@ -961,7 +976,7 @@ parameters:
path: libraries/classes/Gis/GisMultiPolygon.php
-
message: "#^Parameter \\#2 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getPolygonArrayForOpenLayers\\(\\) expects string, int given\\.$#"
message: "#^Parameter \\#2 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getPolygonArrayForOpenLayers\\(\\) expects string, int\\<min, \\-1\\>\\|int\\<1, max\\> given\\.$#"
count: 1
path: libraries/classes/Gis/GisMultiPolygon.php
@ -996,7 +1011,7 @@ parameters:
path: libraries/classes/Gis/GisMultiPolygon.php
-
message: "#^Parameter \\#1 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getBoundsForOl\\(\\) expects string, int given\\.$#"
message: "#^Parameter \\#1 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getBoundsForOl\\(\\) expects string, int\\<min, \\-1\\>\\|int\\<1, max\\> given\\.$#"
count: 1
path: libraries/classes/Gis/GisPoint.php
@ -1006,7 +1021,7 @@ parameters:
path: libraries/classes/Gis/GisPoint.php
-
message: "#^Parameter \\#2 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getPointForOpenLayers\\(\\) expects string, int given\\.$#"
message: "#^Parameter \\#2 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getPointForOpenLayers\\(\\) expects string, int\\<min, \\-1\\>\\|int\\<1, max\\> given\\.$#"
count: 1
path: libraries/classes/Gis/GisPoint.php
@ -1036,7 +1051,7 @@ parameters:
path: libraries/classes/Gis/GisPoint.php
-
message: "#^Parameter \\#1 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getBoundsForOl\\(\\) expects string, int given\\.$#"
message: "#^Parameter \\#1 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getBoundsForOl\\(\\) expects string, int\\<min, \\-1\\>\\|int\\<1, max\\> given\\.$#"
count: 1
path: libraries/classes/Gis/GisPolygon.php
@ -1046,7 +1061,7 @@ parameters:
path: libraries/classes/Gis/GisPolygon.php
-
message: "#^Parameter \\#2 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getPolygonForOpenLayers\\(\\) expects string, int given\\.$#"
message: "#^Parameter \\#2 \\$srid of method PhpMyAdmin\\\\Gis\\\\GisGeometry\\:\\:getPolygonForOpenLayers\\(\\) expects string, int\\<min, \\-1\\>\\|int\\<1, max\\> given\\.$#"
count: 1
path: libraries/classes/Gis/GisPolygon.php
@ -1122,7 +1137,12 @@ parameters:
-
message: "#^Cannot access offset int on array\\|false\\.$#"
count: 2
count: 1
path: libraries/classes/Git.php
-
message: "#^Cannot access offset int\\<min, \\-1\\>\\|int\\<1, max\\> on array\\|false\\.$#"
count: 1
path: libraries/classes/Git.php
-
@ -1131,7 +1151,7 @@ parameters:
path: libraries/classes/Git.php
-
message: "#^Offset int does not exist on array\\|null\\.$#"
message: "#^Offset int\\<0, max\\> does not exist on array\\|null\\.$#"
count: 2
path: libraries/classes/Import.php
@ -1565,11 +1585,6 @@ parameters:
count: 2
path: libraries/classes/Plugins/Import/ImportXml.php
-
message: "#^Used function uploadprogress_get_info not found\\.$#"
count: 1
path: libraries/classes/Plugins/Import/Upload/UploadProgress.php
-
message: "#^Method PhpMyAdmin\\\\Plugins\\\\Import\\\\Upload\\\\UploadSession\\:\\:getIdKey\\(\\) should return string but returns string\\|false\\.$#"
count: 1

View File

@ -1211,6 +1211,7 @@ class ConfigTest extends AbstractTestCase
'host' => '',
'controluser' => 'u2',
'controlpass' => 'p2',
'hide_connection_errors' => false,
];
$cfg_ssl = [
'user' => 'u',
@ -1219,6 +1220,7 @@ class ConfigTest extends AbstractTestCase
'ssl' => true,
'controluser' => 'u2',
'controlpass' => 'p2',
'hide_connection_errors' => false,
];
$cfg_control_ssl = [
'user' => 'u',
@ -1227,6 +1229,7 @@ class ConfigTest extends AbstractTestCase
'control_ssl' => true,
'controluser' => 'u2',
'controlpass' => 'p2',
'hide_connection_errors' => false,
];
return [
@ -1247,6 +1250,7 @@ class ConfigTest extends AbstractTestCase
'compress' => false,
'controluser' => 'u2',
'controlpass' => 'p2',
'hide_connection_errors' => false,
],
],
],
@ -1263,6 +1267,7 @@ class ConfigTest extends AbstractTestCase
'port' => 0,
'ssl' => false,
'compress' => false,
'hide_connection_errors' => false,
],
],
],
@ -1283,6 +1288,7 @@ class ConfigTest extends AbstractTestCase
'compress' => false,
'controluser' => 'u2',
'controlpass' => 'p2',
'hide_connection_errors' => false,
],
],
],
@ -1299,6 +1305,7 @@ class ConfigTest extends AbstractTestCase
'port' => 0,
'ssl' => true,
'compress' => false,
'hide_connection_errors' => false,
],
],
],
@ -1320,6 +1327,7 @@ class ConfigTest extends AbstractTestCase
'controluser' => 'u2',
'controlpass' => 'p2',
'control_ssl' => true,
'hide_connection_errors' => false,
],
],
],
@ -1336,6 +1344,7 @@ class ConfigTest extends AbstractTestCase
'port' => 0,
'ssl' => true,
'compress' => false,
'hide_connection_errors' => false,
],
],
],