@@ -78,6 +78,12 @@ public function testFileWithAnIgnoredErrorMessage(): void
78
78
$ this ->assertEmpty ($ result );
79
79
}
80
80
81
+ public function testFileWithAnIgnoredErrorRawMessage (): void
82
+ {
83
+ $ result = $ this ->runAnalyser ([['rawMessage ' => 'Fail. ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
84
+ $ this ->assertEmpty ($ result );
85
+ }
86
+
81
87
public function testFileWithAnIgnoredErrorMessageAndWrongIdentifier (): void
82
88
{
83
89
$ result = $ this ->runAnalyser ([['message ' => '#Fail\.# ' , 'identifier ' => 'wrong.identifier ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
@@ -88,6 +94,16 @@ public function testFileWithAnIgnoredErrorMessageAndWrongIdentifier(): void
88
94
$ this ->assertSame ('Ignored error pattern #Fail\.# (wrong.identifier) was not matched in reported errors. ' , $ result [1 ]);
89
95
}
90
96
97
+ public function testFileWithAnIgnoredErrorRawMessageAndWrongIdentifier (): void
98
+ {
99
+ $ result = $ this ->runAnalyser ([['rawMessage ' => 'Fail. ' , 'identifier ' => 'wrong.identifier ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
100
+ $ this ->assertCount (2 , $ result );
101
+ assert ($ result [0 ] instanceof Error);
102
+ $ this ->assertSame ('Fail. ' , $ result [0 ]->getMessage ());
103
+ assert (is_string ($ result [1 ]));
104
+ $ this ->assertSame ('Ignored error pattern "Fail." (wrong.identifier) was not matched in reported errors. ' , $ result [1 ]);
105
+ }
106
+
91
107
public function testFileWithAnIgnoredWrongIdentifier (): void
92
108
{
93
109
$ result = $ this ->runAnalyser ([['identifier ' => 'wrong.identifier ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
@@ -104,6 +120,12 @@ public function testFileWithAnIgnoredErrorMessageAndCorrectIdentifier(): void
104
120
$ this ->assertEmpty ($ result );
105
121
}
106
122
123
+ public function testFileWithAnIgnoredErrorRawMessageAndCorrectIdentifier (): void
124
+ {
125
+ $ result = $ this ->runAnalyser ([['rawMessage ' => 'Fail. ' , 'identifier ' => 'tests.alwaysFail ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
126
+ $ this ->assertEmpty ($ result );
127
+ }
128
+
107
129
public function testFileWithAnIgnoredErrorIdentifier (): void
108
130
{
109
131
$ result = $ this ->runAnalyser ([['identifier ' => 'tests.alwaysFail ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
@@ -215,6 +237,31 @@ public static function dataIgnoreErrorByPathAndCount(): iterable
215
237
],
216
238
],
217
239
];
240
+
241
+ yield [
242
+ [
243
+ [
244
+ 'rawMessage ' => 'Fail. ' ,
245
+ 'count ' => 3 ,
246
+ 'path ' => __DIR__ . '/data/two-fails.php ' ,
247
+ ],
248
+ ],
249
+ ];
250
+
251
+ yield [
252
+ [
253
+ [
254
+ 'rawMessage ' => 'Fail. ' ,
255
+ 'count ' => 2 ,
256
+ 'path ' => __DIR__ . '/data/two-fails.php ' ,
257
+ ],
258
+ [
259
+ 'rawMessage ' => 'Fail. ' ,
260
+ 'count ' => 1 ,
261
+ 'path ' => __DIR__ . '/data/two-fails.php ' ,
262
+ ],
263
+ ],
264
+ ];
218
265
}
219
266
220
267
/**
@@ -351,6 +398,18 @@ public function testIgnoreErrorByPaths(): void
351
398
$ this ->assertNoErrors ($ result );
352
399
}
353
400
401
+ public function testIgnoreErrorRawByPaths (): void
402
+ {
403
+ $ ignoreErrors = [
404
+ [
405
+ 'rawMessage ' => 'Fail. ' ,
406
+ 'paths ' => [__DIR__ . '/data/bootstrap-error.php ' ],
407
+ ],
408
+ ];
409
+ $ result = $ this ->runAnalyser ($ ignoreErrors , true , __DIR__ . '/data/bootstrap-error.php ' , false );
410
+ $ this ->assertNoErrors ($ result );
411
+ }
412
+
354
413
public function testIgnoreErrorMultiByPaths (): void
355
414
{
356
415
$ ignoreErrors = [
@@ -606,6 +665,18 @@ public function testIgnoreErrorExplicitReportUnmatchedDisable(): void
606
665
$ this ->assertNoErrors ($ result );
607
666
}
608
667
668
+ public function testIgnoreErrorExplicitReportUnmatchedDisableRaw (): void
669
+ {
670
+ $ ignoreErrors = [
671
+ [
672
+ 'rawMessage ' => 'Fail. ' ,
673
+ 'reportUnmatched ' => false ,
674
+ ],
675
+ ];
676
+ $ result = $ this ->runAnalyser ($ ignoreErrors , true , __DIR__ . '/data/bootstrap.php ' , false );
677
+ $ this ->assertNoErrors ($ result );
678
+ }
679
+
609
680
public function testIgnoreErrorExplicitReportUnmatchedDisableMulti (): void
610
681
{
611
682
$ ignoreErrors = [
@@ -631,6 +702,19 @@ public function testIgnoreErrorExplicitReportUnmatchedEnable(): void
631
702
$ this ->assertSame ('Ignored error pattern #Fail# was not matched in reported errors. ' , $ result [0 ]);
632
703
}
633
704
705
+ public function testIgnoreErrorExplicitReportUnmatchedEnableRaw (): void
706
+ {
707
+ $ ignoreErrors = [
708
+ [
709
+ 'rawMessage ' => 'Fail. ' ,
710
+ 'reportUnmatched ' => true ,
711
+ ],
712
+ ];
713
+ $ result = $ this ->runAnalyser ($ ignoreErrors , false , __DIR__ . '/data/bootstrap.php ' , false );
714
+ $ this ->assertCount (1 , $ result );
715
+ $ this ->assertSame ('Ignored error pattern "Fail." was not matched in reported errors. ' , $ result [0 ]);
716
+ }
717
+
634
718
public function testIgnoreErrorExplicitReportUnmatchedEnableMulti (): void
635
719
{
636
720
$ ignoreErrors = [
0 commit comments