From 4c39978115f3a24901f323d9c11977e707218392 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Fri, 15 Mar 2024 21:59:50 +0100 Subject: [PATCH] Remove curl_close from TestBase Signed-off-by: Kamil Tekiela --- phpstan-baseline.neon | 10 +++++----- tests/end-to-end/TestBase.php | 13 ++++++------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 758e72bdd0..fddcd16339 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -15200,6 +15200,11 @@ parameters: count: 2 path: tests/end-to-end/TestBase.php + - + message: "#^Only booleans are allowed in a negated boolean, int given\\.$#" + count: 2 + path: tests/end-to-end/TestBase.php + - message: "#^Only booleans are allowed in a negated boolean, int\\|false given\\.$#" count: 1 @@ -15215,11 +15220,6 @@ parameters: count: 1 path: tests/end-to-end/TestBase.php - - - message: "#^Only booleans are allowed in an if condition, int given\\.$#" - count: 2 - path: tests/end-to-end/TestBase.php - - message: "#^Only booleans are allowed in an if condition, string\\|false given\\.$#" count: 2 diff --git a/tests/end-to-end/TestBase.php b/tests/end-to-end/TestBase.php index fcd6821b53..66cf3d0e87 100644 --- a/tests/end-to-end/TestBase.php +++ b/tests/end-to-end/TestBase.php @@ -22,7 +22,6 @@ use PHPUnit\Framework\TestCase; use Throwable; use function bin2hex; -use function curl_close; use function curl_errno; use function curl_error; use function curl_exec; @@ -1139,11 +1138,11 @@ JS; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_exec($ch); - if (curl_errno($ch)) { - echo 'Error: ' . curl_error($ch) . "\n"; + if (! curl_errno($ch)) { + return; } - curl_close($ch); + echo 'Error: ' . curl_error($ch) . "\n"; } private function getErrorVideoUrl(): void @@ -1173,11 +1172,11 @@ JS; echo 'Test failed, get more information here: ' . $proj->automation_session->public_url . "\n"; } - if (curl_errno($ch)) { - echo 'Error: ' . curl_error($ch) . "\n"; + if (! curl_errno($ch)) { + return; } - curl_close($ch); + echo 'Error: ' . curl_error($ch) . "\n"; } /**