@@ -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 );
@@ -215,6 +237,31 @@ public static function dataIgnoreErrorByPathAndCount(): iterable
215237 ],
216238 ],
217239 ];
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+ ];
218265 }
219266
220267 /**
@@ -351,6 +398,18 @@ public function testIgnoreErrorByPaths(): void
351398 $ this ->assertNoErrors ($ result );
352399 }
353400
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+
354413 public function testIgnoreErrorMultiByPaths (): void
355414 {
356415 $ ignoreErrors = [
@@ -606,6 +665,18 @@ public function testIgnoreErrorExplicitReportUnmatchedDisable(): void
606665 $ this ->assertNoErrors ($ result );
607666 }
608667
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+
609680 public function testIgnoreErrorExplicitReportUnmatchedDisableMulti (): void
610681 {
611682 $ ignoreErrors = [
@@ -631,6 +702,19 @@ public function testIgnoreErrorExplicitReportUnmatchedEnable(): void
631702 $ this ->assertSame ('Ignored error pattern #Fail# was not matched in reported errors. ' , $ result [0 ]);
632703 }
633704
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+
634718 public function testIgnoreErrorExplicitReportUnmatchedEnableMulti (): void
635719 {
636720 $ ignoreErrors = [
0 commit comments