diff --git a/tests/PHPStan/Command/ErrorFormatter/BaselinePhpErrorFormatterTest.php b/tests/PHPStan/Command/ErrorFormatter/BaselinePhpErrorFormatterTest.php new file mode 100644 index 0000000000..d69bfadc36 --- /dev/null +++ b/tests/PHPStan/Command/ErrorFormatter/BaselinePhpErrorFormatterTest.php @@ -0,0 +1,79 @@ + '#^Bar$#', + 'count' => 1, + 'path' => __DIR__ . '/../Foo.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Foo$#', + 'count' => 2, + 'path' => __DIR__ . '/Foo.php', +]; + +return ['parameters' => ['ignoreErrors' => $ignoreErrors]]; + +PHP, + ]; + } + + /** + * @dataProvider dataFormatErrors + * @param list $errors + */ + public function testFormatErrors(array $errors, string $expectedOutput): void + { + $formatter = new BaselinePhpErrorFormatter(new ParentDirectoryRelativePathHelper(__DIR__)); + $formatter->formatErrors( + new AnalysisResult( + $errors, + [], + [], + [], + [], + false, + null, + true, + 0, + ), + $this->getOutput(), + ); + + $this->assertSame($expectedOutput, $this->getOutputContent()); + } + +}