@@ -78,6 +78,12 @@ public function testFileWithAnIgnoredErrorMessage(): void
7878 $ this ->assertEmpty ($ result );
7979 }
8080
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+
8187 public function testFileWithAnIgnoredErrorMessageAndWrongIdentifier (): void
8288 {
8389 $ result = $ this ->runAnalyser ([['message ' => '#Fail\.# ' , 'identifier ' => 'wrong.identifier ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
@@ -88,6 +94,16 @@ public function testFileWithAnIgnoredErrorMessageAndWrongIdentifier(): void
8894 $ this ->assertSame ('Ignored error pattern #Fail\.# (wrong.identifier) was not matched in reported errors. ' , $ result [1 ]);
8995 }
9096
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+
91107 public function testFileWithAnIgnoredWrongIdentifier (): void
92108 {
93109 $ result = $ this ->runAnalyser ([['identifier ' => 'wrong.identifier ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
@@ -104,6 +120,12 @@ public function testFileWithAnIgnoredErrorMessageAndCorrectIdentifier(): void
104120 $ this ->assertEmpty ($ result );
105121 }
106122
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+
107129 public function testFileWithAnIgnoredErrorIdentifier (): void
108130 {
109131 $ result = $ this ->runAnalyser ([['identifier ' => 'tests.alwaysFail ' ]], true , __DIR__ . '/data/bootstrap-error.php ' , false );
@@ -193,6 +215,31 @@ public static function dataIgnoreErrorByPathAndCount(): iterable
193215 ],
194216 ],
195217 ];
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+ ];
196243 }
197244
198245 /**
@@ -329,6 +376,18 @@ public function testIgnoreErrorByPaths(): void
329376 $ this ->assertNoErrors ($ result );
330377 }
331378
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+
332391 public function testIgnoreErrorMultiByPaths (): void
333392 {
334393 $ ignoreErrors = [
@@ -584,6 +643,18 @@ public function testIgnoreErrorExplicitReportUnmatchedDisable(): void
584643 $ this ->assertNoErrors ($ result );
585644 }
586645
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+
587658 public function testIgnoreErrorExplicitReportUnmatchedDisableMulti (): void
588659 {
589660 $ ignoreErrors = [
@@ -609,6 +680,19 @@ public function testIgnoreErrorExplicitReportUnmatchedEnable(): void
609680 $ this ->assertSame ('Ignored error pattern #Fail# was not matched in reported errors. ' , $ result [0 ]);
610681 }
611682
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+
612696 public function testIgnoreErrorExplicitReportUnmatchedEnableMulti (): void
613697 {
614698 $ ignoreErrors = [
0 commit comments