@@ -79,6 +79,12 @@ public function testFileWithAnIgnoredErrorMessage(): void
79
79
$ this ->assertEmpty ($ result );
80
80
}
81
81
82
+ public function testFileWithAnIgnoredErrorRawMessage (): void
83
+ {
84
+ $ result = $ this ->runAnalyser ([['rawMessage ' => 'Fail. ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
85
+ $ this ->assertEmpty ($ result );
86
+ }
87
+
82
88
public function testFileWithAnIgnoredErrorMessageAndWrongIdentifier (): void
83
89
{
84
90
$ result = $ this ->runAnalyser ([['message ' => '#Fail\.# ' , 'identifier ' => 'wrong.identifier ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
@@ -89,6 +95,16 @@ public function testFileWithAnIgnoredErrorMessageAndWrongIdentifier(): void
89
95
$ this ->assertSame ('Ignored error pattern #Fail\.# (wrong.identifier) was not matched in reported errors. ' , $ result [1 ]);
90
96
}
91
97
98
+ public function testFileWithAnIgnoredErrorRawMessageAndWrongIdentifier (): void
99
+ {
100
+ $ result = $ this ->runAnalyser ([['rawMessage ' => 'Fail. ' , 'identifier ' => 'wrong.identifier ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
101
+ $ this ->assertCount (2 , $ result );
102
+ assert ($ result [0 ] instanceof Error);
103
+ $ this ->assertSame ('Fail. ' , $ result [0 ]->getMessage ());
104
+ assert (is_string ($ result [1 ]));
105
+ $ this ->assertSame ('Ignored error pattern "Fail." (wrong.identifier) was not matched in reported errors. ' , $ result [1 ]);
106
+ }
107
+
92
108
public function testFileWithAnIgnoredWrongIdentifier (): void
93
109
{
94
110
$ result = $ this ->runAnalyser ([['identifier ' => 'wrong.identifier ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
@@ -105,6 +121,12 @@ public function testFileWithAnIgnoredErrorMessageAndCorrectIdentifier(): void
105
121
$ this ->assertEmpty ($ result );
106
122
}
107
123
124
+ public function testFileWithAnIgnoredErrorRawMessageAndCorrectIdentifier (): void
125
+ {
126
+ $ result = $ this ->runAnalyser ([['rawMessage ' => 'Fail. ' , 'identifier ' => 'tests.alwaysFail ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
127
+ $ this ->assertEmpty ($ result );
128
+ }
129
+
108
130
public function testFileWithAnIgnoredErrorIdentifier (): void
109
131
{
110
132
$ result = $ this ->runAnalyser ([['identifier ' => 'tests.alwaysFail ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
@@ -216,6 +238,31 @@ public static function dataIgnoreErrorByPathAndCount(): iterable
216
238
],
217
239
],
218
240
];
241
+
242
+ yield [
243
+ [
244
+ [
245
+ 'rawMessage ' => 'Fail. ' ,
246
+ 'count ' => 3 ,
247
+ 'path ' => __DIR__ . '/data/two-fails.php ' ,
248
+ ],
249
+ ],
250
+ ];
251
+
252
+ yield [
253
+ [
254
+ [
255
+ 'rawMessage ' => 'Fail. ' ,
256
+ 'count ' => 2 ,
257
+ 'path ' => __DIR__ . '/data/two-fails.php ' ,
258
+ ],
259
+ [
260
+ 'rawMessage ' => 'Fail. ' ,
261
+ 'count ' => 1 ,
262
+ 'path ' => __DIR__ . '/data/two-fails.php ' ,
263
+ ],
264
+ ],
265
+ ];
219
266
}
220
267
221
268
/**
@@ -352,6 +399,18 @@ public function testIgnoreErrorByPaths(): void
352
399
$ this ->assertNoErrors ($ result );
353
400
}
354
401
402
+ public function testIgnoreErrorRawByPaths (): void
403
+ {
404
+ $ ignoreErrors = [
405
+ [
406
+ 'rawMessage ' => 'Fail. ' ,
407
+ 'paths ' => [__DIR__ . '/data/bootstrap-error.php ' ],
408
+ ],
409
+ ];
410
+ $ result = $ this ->runAnalyser ($ ignoreErrors , true , __DIR__ . '/data/bootstrap-error.php ' , false );
411
+ $ this ->assertNoErrors ($ result );
412
+ }
413
+
355
414
public function testIgnoreErrorMultiByPaths (): void
356
415
{
357
416
$ ignoreErrors = [
@@ -622,6 +681,18 @@ public function testIgnoreErrorExplicitReportUnmatchedDisable(): void
622
681
$ this ->assertNoErrors ($ result );
623
682
}
624
683
684
+ public function testIgnoreErrorExplicitReportUnmatchedDisableRaw (): void
685
+ {
686
+ $ ignoreErrors = [
687
+ [
688
+ 'rawMessage ' => 'Fail. ' ,
689
+ 'reportUnmatched ' => false ,
690
+ ],
691
+ ];
692
+ $ result = $ this ->runAnalyser ($ ignoreErrors , true , __DIR__ . '/data/bootstrap.php ' , false );
693
+ $ this ->assertNoErrors ($ result );
694
+ }
695
+
625
696
public function testIgnoreErrorExplicitReportUnmatchedDisableMulti (): void
626
697
{
627
698
$ ignoreErrors = [
@@ -647,6 +718,19 @@ public function testIgnoreErrorExplicitReportUnmatchedEnable(): void
647
718
$ this ->assertSame ('Ignored error pattern #Fail# was not matched in reported errors. ' , $ result [0 ]);
648
719
}
649
720
721
+ public function testIgnoreErrorExplicitReportUnmatchedEnableRaw (): void
722
+ {
723
+ $ ignoreErrors = [
724
+ [
725
+ 'rawMessage ' => 'Fail. ' ,
726
+ 'reportUnmatched ' => true ,
727
+ ],
728
+ ];
729
+ $ result = $ this ->runAnalyser ($ ignoreErrors , false , __DIR__ . '/data/bootstrap.php ' , false );
730
+ $ this ->assertCount (1 , $ result );
731
+ $ this ->assertSame ('Ignored error pattern "Fail." was not matched in reported errors. ' , $ result [0 ]);
732
+ }
733
+
650
734
public function testIgnoreErrorExplicitReportUnmatchedEnableMulti (): void
651
735
{
652
736
$ ignoreErrors = [
0 commit comments