From b360efdf7f9df031b76ec5877c0c10728e4ff83e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Sun, 9 Aug 2020 13:36:37 -0300 Subject: [PATCH] Fix AuthenticationCookieTest PHPStan errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- phpstan-baseline.neon | 10 -- psalm-baseline.xml | 126 ++---------------- .../Plugins/Auth/AuthenticationCookieTest.php | 10 +- 3 files changed, 20 insertions(+), 126 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 19ce2516a7..adf12eadbf 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -3100,16 +3100,6 @@ parameters: count: 4 path: test/classes/Plugins/Auth/AuthenticationConfigTest.php - - - message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, string\\|false given\\.$#" - count: 16 - path: test/classes/Plugins/Auth/AuthenticationCookieTest.php - - - - message: "#^Parameter \\#1 \\$data of method PhpMyAdmin\\\\Plugins\\\\Auth\\\\AuthenticationCookie\\:\\:cookieEncrypt\\(\\) expects string, string\\|false given\\.$#" - count: 1 - path: test/classes/Plugins/Auth/AuthenticationCookieTest.php - - message: "#^Parameter \\#2 \\$haystack of method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, string\\|false given\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 3cb4e57df0..fbd9858231 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + Util::formatByteDown($value, $limes, $comma) @@ -21,9 +21,6 @@ $this->dbi->getError() $this->dbi->getError(DatabaseInterface::CONNECT_CONTROL) - - $table == '' - @@ -31,72 +28,6 @@ - - $name - $variant - $name - $unicode - $name - $name - $name - $name - $name - $name - $unicode - $name - $name - $name - $name - $name - $name - $name - $name - $name - $name - $name - $name - $name - $name - $name - $unknown - $name - $name - $name - $name - $name - $name - $name - $name - $name - $name - $level - $name - $name - $name - $name - $name - $name - $name - $name - $name - $name - $name - $name - $name - $name - $name - $name - $name - $level - $name - $name - $name - $name - $name - $name - $name - $found - $name @@ -473,9 +404,6 @@ $where_clause ?? null - - $biggest_max_file_size > 0 - @@ -610,11 +538,6 @@ is_string($data) - - PMA_USR_BROWSER_AGENT - PMA_USR_BROWSER_AGENT - PMA_USR_BROWSER_VER - @@ -651,8 +574,7 @@ null - - $table + $sortOrder @@ -665,9 +587,6 @@ - - $affected - $routine['item_type_toggle'] $routine['item_returntype'] @@ -905,13 +824,6 @@ $errorNumber - - - PMA_USR_BROWSER_AGENT - PMA_USR_BROWSER_VER - PMA_USR_OS - - $memory_limit @@ -930,10 +842,6 @@ $line $line - - PMA_USR_BROWSER_AGENT - PMA_USR_BROWSER_VER - @@ -1129,9 +1037,6 @@ $current_result - - $dispval - $tmp $insert_id @@ -1209,6 +1114,12 @@ getPresence + + $icons + + + $icons + $table $container->realName @@ -1283,12 +1194,6 @@ $text $text - - $property_class == BoolPropertyItem::class - $property_class == MessageOnlyPropertyItem::class - $property_class == SelectPropertyItem::class - $property_class == TextPropertyItem::class - @@ -1444,6 +1349,11 @@ $mime_map + + + $pos + + OptionsPropertyMainGroup|void @@ -2260,9 +2170,6 @@ $tmp_initial $result['password'] - - $array_initials - $_POST['pred_dbname'] @@ -2553,10 +2460,9 @@ $group[$group_name]['tab' . $sep . 'count'] - + $group[$group_name]['is' . $sep . 'group'] $group[$group_name]['tab' . $sep . 'count'] - $byteUnits[$d] $units[$d] @@ -2599,10 +2505,6 @@ $value $value - - $max_size - $max_unit - $max_size $max_unit diff --git a/test/classes/Plugins/Auth/AuthenticationCookieTest.php b/test/classes/Plugins/Auth/AuthenticationCookieTest.php index 04686b2a00..313081ff57 100644 --- a/test/classes/Plugins/Auth/AuthenticationCookieTest.php +++ b/test/classes/Plugins/Auth/AuthenticationCookieTest.php @@ -202,7 +202,7 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase $this->object->showLoginForm(); $result = ob_get_clean(); - // assertions + $this->assertIsString($result); $this->assertStringContainsString( ' id="imLogo"', @@ -297,7 +297,7 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase $this->object->showLoginForm(); $result = ob_get_clean(); - // assertions + $this->assertIsString($result); $this->assertStringContainsString('id="imLogo"', $result); @@ -377,7 +377,7 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase $this->object->showLoginForm(); $result = ob_get_clean(); - // assertions + $this->assertIsString($result); $this->assertStringContainsString('id="imLogo"', $result); @@ -1150,7 +1150,7 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase $method->setAccessible(true); $encryptedCookie = $this->object->cookieEncrypt( - json_encode($payload), + (string) json_encode($payload), $method->invoke($this->object, null) ); $this->assertEquals( @@ -1269,6 +1269,8 @@ class AuthenticationCookieTest extends AbstractNetworkTestCase $this->object->checkRules(); $result = ob_get_clean(); + $this->assertIsString($result); + if (empty($expected)) { $this->assertEquals($expected, $result); } else {