@@ -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 );
@@ -193,6 +215,31 @@ public static function dataIgnoreErrorByPathAndCount(): iterable
193
215
],
194
216
],
195
217
];
218
+
219
+ yield [
220
+ [
221
+ [
222
+ 'rawMessage ' => 'Fail. ' ,
223
+ 'count ' => 3 ,
224
+ 'path ' => __DIR__ . '/data/two-fails.php ' ,
225
+ ],
226
+ ],
227
+ ];
228
+
229
+ yield [
230
+ [
231
+ [
232
+ 'rawMessage ' => 'Fail. ' ,
233
+ 'count ' => 2 ,
234
+ 'path ' => __DIR__ . '/data/two-fails.php ' ,
235
+ ],
236
+ [
237
+ 'rawMessage ' => 'Fail. ' ,
238
+ 'count ' => 1 ,
239
+ 'path ' => __DIR__ . '/data/two-fails.php ' ,
240
+ ],
241
+ ],
242
+ ];
196
243
}
197
244
198
245
/**
@@ -329,6 +376,18 @@ public function testIgnoreErrorByPaths(): void
329
376
$ this ->assertNoErrors ($ result );
330
377
}
331
378
379
+ public function testIgnoreErrorRawByPaths (): void
380
+ {
381
+ $ ignoreErrors = [
382
+ [
383
+ 'rawMessage ' => 'Fail. ' ,
384
+ 'paths ' => [__DIR__ . '/data/bootstrap-error.php ' ],
385
+ ],
386
+ ];
387
+ $ result = $ this ->runAnalyser ($ ignoreErrors , true , __DIR__ . '/data/bootstrap-error.php ' , false );
388
+ $ this ->assertNoErrors ($ result );
389
+ }
390
+
332
391
public function testIgnoreErrorMultiByPaths (): void
333
392
{
334
393
$ ignoreErrors = [
@@ -584,6 +643,18 @@ public function testIgnoreErrorExplicitReportUnmatchedDisable(): void
584
643
$ this ->assertNoErrors ($ result );
585
644
}
586
645
646
+ public function testIgnoreErrorExplicitReportUnmatchedDisableRaw (): void
647
+ {
648
+ $ ignoreErrors = [
649
+ [
650
+ 'rawMessage ' => 'Fail. ' ,
651
+ 'reportUnmatched ' => false ,
652
+ ],
653
+ ];
654
+ $ result = $ this ->runAnalyser ($ ignoreErrors , true , __DIR__ . '/data/bootstrap.php ' , false );
655
+ $ this ->assertNoErrors ($ result );
656
+ }
657
+
587
658
public function testIgnoreErrorExplicitReportUnmatchedDisableMulti (): void
588
659
{
589
660
$ ignoreErrors = [
@@ -609,6 +680,19 @@ public function testIgnoreErrorExplicitReportUnmatchedEnable(): void
609
680
$ this ->assertSame ('Ignored error pattern #Fail# was not matched in reported errors. ' , $ result [0 ]);
610
681
}
611
682
683
+ public function testIgnoreErrorExplicitReportUnmatchedEnableRaw (): void
684
+ {
685
+ $ ignoreErrors = [
686
+ [
687
+ 'rawMessage ' => 'Fail. ' ,
688
+ 'reportUnmatched ' => true ,
689
+ ],
690
+ ];
691
+ $ result = $ this ->runAnalyser ($ ignoreErrors , false , __DIR__ . '/data/bootstrap.php ' , false );
692
+ $ this ->assertCount (1 , $ result );
693
+ $ this ->assertSame ('Ignored error pattern "Fail." was not matched in reported errors. ' , $ result [0 ]);
694
+ }
695
+
612
696
public function testIgnoreErrorExplicitReportUnmatchedEnableMulti (): void
613
697
{
614
698
$ ignoreErrors = [
0 commit comments