Skip to content

Commit 3681bac

Browse files
Add test for JSON output with no errors in CheckCommand
This test ensures that the JSON output format properly handles and displays an empty result when no errors are present. It validates the success of the command and confirms the output is in valid JSON format with the expected structure.
1 parent 28b28d1 commit 3681bac

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Diff for: tests/E2E/Cli/CheckCommandTest.php

+16
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,22 @@ public function test_json_format_output(): void
179179
$this->assertJson($display);
180180
}
181181

182+
public function test_json_format_output_no_errors(): void
183+
{
184+
$configFilePath = __DIR__.'/../_fixtures/configMvcWithoutErrors.php';
185+
186+
$cmdTester = $this->runCheck($configFilePath, null, null, false, false, false, 'json');
187+
188+
$this->assertCheckHasSuccess($cmdTester);
189+
190+
$display = $cmdTester->getDisplay();
191+
192+
$this->assertJson($display);
193+
194+
$json = json_decode($display, true);
195+
$this->assertCount(0, $json);
196+
}
197+
182198
protected function runCheck(
183199
$configFilePath = null,
184200
?bool $stopOnFailure = null,

0 commit comments

Comments
 (0)