From ea852b5b7b4ba4473fe79b2dda54ea16602987ae Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 16 Mar 2024 20:33:13 +0100 Subject: [PATCH] OutputTest: fix risky test The `OutputTest::testGitLabOutput()` was being marked as risky for the first test case (no errors) as no assertions were being run. This commit adds an extra assertion to prevent this, but also to make the test more thorough as the test will now also fail if the number of errors expected versus received does not match. --- tests/Unit/Outputs/OutputTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Unit/Outputs/OutputTest.php b/tests/Unit/Outputs/OutputTest.php index 31cad47..79b5b8e 100644 --- a/tests/Unit/Outputs/OutputTest.php +++ b/tests/Unit/Outputs/OutputTest.php @@ -26,6 +26,8 @@ public function testGitLabOutput($errors) $result = (array) json_decode($writer->getLogs()); + $this->assertSame(count($errors), count($result)); + for ($i = 0; $i < count($result) && $i < count($errors); $i++) { $message = $errors[$i]->getMessage(); $filePath = $errors[$i]->getFilePath();