77use PHPUnit \Framework \Attributes \DataProvider ;
88use function sprintf ;
99
10- class GitlabFormatterTest extends ErrorFormatterTestCase
10+ class GitlabErrorFormatterTest extends ErrorFormatterTestCase
1111{
1212
1313 public static function dataFormatterOutputProvider (): iterable
@@ -28,6 +28,7 @@ public static function dataFormatterOutputProvider(): iterable
2828 '[
2929 {
3030 "description": "Foo",
31+ "check_name": null,
3132 "fingerprint": "e82b7e1f1d4255352b19ecefa9116a12f129c7edb4351cf2319285eccdb1565e",
3233 "severity": "major",
3334 "location": {
@@ -68,6 +69,7 @@ public static function dataFormatterOutputProvider(): iterable
6869 '[
6970 {
7071 "description": "Bar\nBar2",
72+ "check_name": null,
7173 "fingerprint": "034b4afbfb347494c14e396ed8327692f58be4cd27e8aff5f19f4194934db7c9",
7274 "severity": "major",
7375 "location": {
@@ -79,6 +81,7 @@ public static function dataFormatterOutputProvider(): iterable
7981 },
8082 {
8183 "description": "Foo",
84+ "check_name": null,
8285 "fingerprint": "e82b7e1f1d4255352b19ecefa9116a12f129c7edb4351cf2319285eccdb1565e",
8386 "severity": "major",
8487 "location": {
@@ -90,6 +93,7 @@ public static function dataFormatterOutputProvider(): iterable
9093 },
9194 {
9295 "description": "Foo<Bar>",
96+ "check_name": null,
9397 "fingerprint": "d7002959fc192c81d51fc41b0a3f240617a1aa35361867b5e924ae8d7fec39cb",
9498 "severity": "major",
9599 "location": {
@@ -101,6 +105,7 @@ public static function dataFormatterOutputProvider(): iterable
101105 },
102106 {
103107 "description": "Bar\nBar2",
108+ "check_name": null,
104109 "fingerprint": "829f6c782152fdac840b39208c5b519d18e51bff2c601b6197812fffb8bcd9ed",
105110 "severity": "major",
106111 "location": {
@@ -121,6 +126,7 @@ public static function dataFormatterOutputProvider(): iterable
121126 '[
122127 {
123128 "description": "Bar\nBar2",
129+ "check_name": null,
124130 "fingerprint": "034b4afbfb347494c14e396ed8327692f58be4cd27e8aff5f19f4194934db7c9",
125131 "severity": "major",
126132 "location": {
@@ -132,6 +138,7 @@ public static function dataFormatterOutputProvider(): iterable
132138 },
133139 {
134140 "description": "Foo",
141+ "check_name": null,
135142 "fingerprint": "e82b7e1f1d4255352b19ecefa9116a12f129c7edb4351cf2319285eccdb1565e",
136143 "severity": "major",
137144 "location": {
@@ -143,6 +150,7 @@ public static function dataFormatterOutputProvider(): iterable
143150 },
144151 {
145152 "description": "Bar\nBar2",
153+ "check_name": null,
146154 "fingerprint": "52d22d9e64bd6c6257b7a0d170ed8c99482043aeedd68c52bac081a80da9800a",
147155 "severity": "major",
148156 "location": {
@@ -154,6 +162,7 @@ public static function dataFormatterOutputProvider(): iterable
154162 },
155163 {
156164 "description": "Foo<Bar>",
165+ "check_name": null,
157166 "fingerprint": "d7002959fc192c81d51fc41b0a3f240617a1aa35361867b5e924ae8d7fec39cb",
158167 "severity": "major",
159168 "location": {
@@ -165,6 +174,7 @@ public static function dataFormatterOutputProvider(): iterable
165174 },
166175 {
167176 "description": "Bar\nBar2",
177+ "check_name": null,
168178 "fingerprint": "829f6c782152fdac840b39208c5b519d18e51bff2c601b6197812fffb8bcd9ed",
169179 "severity": "major",
170180 "location": {
@@ -216,6 +226,7 @@ public static function dataFormatterOutputProvider(): iterable
216226 '[
217227 {
218228 "description": "Bar\nBar2",
229+ "check_name": null,
219230 "fingerprint": "034b4afbfb347494c14e396ed8327692f58be4cd27e8aff5f19f4194934db7c9",
220231 "severity": "major",
221232 "location": {
@@ -227,6 +238,7 @@ public static function dataFormatterOutputProvider(): iterable
227238 },
228239 {
229240 "description": "Foo",
241+ "check_name": null,
230242 "fingerprint": "e82b7e1f1d4255352b19ecefa9116a12f129c7edb4351cf2319285eccdb1565e",
231243 "severity": "major",
232244 "location": {
@@ -238,6 +250,7 @@ public static function dataFormatterOutputProvider(): iterable
238250 },
239251 {
240252 "description": "Foo<Bar>",
253+ "check_name": null,
241254 "fingerprint": "d7002959fc192c81d51fc41b0a3f240617a1aa35361867b5e924ae8d7fec39cb",
242255 "severity": "major",
243256 "location": {
@@ -249,6 +262,7 @@ public static function dataFormatterOutputProvider(): iterable
249262 },
250263 {
251264 "description": "Bar\nBar2",
265+ "check_name": null,
252266 "fingerprint": "829f6c782152fdac840b39208c5b519d18e51bff2c601b6197812fffb8bcd9ed",
253267 "severity": "major",
254268 "location": {
@@ -280,15 +294,39 @@ public static function dataFormatterOutputProvider(): iterable
280294 }
281295 }
282296 }
297+ ] ' ,
298+ ];
299+ 300+ yield [
301+ 'File error with identifier ' ,
302+ 1 ,
303+ [5 , 1 ],
304+ 0 ,
305+ '[
306+ {
307+ "description": "Foobar \\\\Buz",
308+ "check_name": "foobar.buz",
309+ "fingerprint": "5543f2fd4c455f26c1500342ec5045b08c99b7827ab35595151dd6e7715c079c",
310+ "severity": "major",
311+ "location": {
312+ "path": "with space/and unicode \ud83d\ude03/project/foo.php",
313+ "lines": {
314+ "begin": 5
315+ }
316+ }
317+ }
283318] ' ,
284319 ];
285320 }
286321
322+ /**
323+ * @param array{int, int}|int $numFileErrors
324+ */
287325 #[DataProvider('dataFormatterOutputProvider ' )]
288326 public function testFormatErrors (
289327 string $ message ,
290328 int $ exitCode ,
291- int $ numFileErrors ,
329+ array | int $ numFileErrors ,
292330 int $ numGenericErrors ,
293331 string $ expected ,
294332 ): void
0 commit comments