@@ -79,6 +79,12 @@ public function testFileWithAnIgnoredErrorMessage(): void
7979 $ this ->assertEmpty ($ result );
8080 }
8181
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+
8288 public function testFileWithAnIgnoredErrorMessageAndWrongIdentifier (): void
8389 {
8490 $ result = $ this ->runAnalyser ([['message ' => '#Fail\.# ' , 'identifier ' => 'wrong.identifier ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
@@ -89,6 +95,16 @@ public function testFileWithAnIgnoredErrorMessageAndWrongIdentifier(): void
8995 $ this ->assertSame ('Ignored error pattern #Fail\.# (wrong.identifier) was not matched in reported errors. ' , $ result [1 ]);
9096 }
9197
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+
92108 public function testFileWithAnIgnoredWrongIdentifier (): void
93109 {
94110 $ result = $ this ->runAnalyser ([['identifier ' => 'wrong.identifier ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
@@ -105,6 +121,12 @@ public function testFileWithAnIgnoredErrorMessageAndCorrectIdentifier(): void
105121 $ this ->assertEmpty ($ result );
106122 }
107123
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+
108130 public function testFileWithAnIgnoredErrorIdentifier (): void
109131 {
110132 $ result = $ this ->runAnalyser ([['identifier ' => 'tests.alwaysFail ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
@@ -216,6 +238,31 @@ public static function dataIgnoreErrorByPathAndCount(): iterable
216238 ],
217239 ],
218240 ];
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+ ];
219266 }
220267
221268 /**
@@ -352,6 +399,18 @@ public function testIgnoreErrorByPaths(): void
352399 $ this ->assertNoErrors ($ result );
353400 }
354401
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+
355414 public function testIgnoreErrorMultiByPaths (): void
356415 {
357416 $ ignoreErrors = [
@@ -622,6 +681,18 @@ public function testIgnoreErrorExplicitReportUnmatchedDisable(): void
622681 $ this ->assertNoErrors ($ result );
623682 }
624683
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+
625696 public function testIgnoreErrorExplicitReportUnmatchedDisableMulti (): void
626697 {
627698 $ ignoreErrors = [
@@ -647,6 +718,19 @@ public function testIgnoreErrorExplicitReportUnmatchedEnable(): void
647718 $ this ->assertSame ('Ignored error pattern #Fail# was not matched in reported errors. ' , $ result [0 ]);
648719 }
649720
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+
650734 public function testIgnoreErrorExplicitReportUnmatchedEnableMulti (): void
651735 {
652736 $ ignoreErrors = [
0 commit comments