1010namespace PHPUnit \Event \Test ;
1111
1212use const PHP_EOL ;
13+ use function implode ;
1314use function sprintf ;
1415use PHPUnit \Event \Code \Test ;
1516use PHPUnit \Event \Event ;
2930 * @var non-empty-string
3031 */
3132 private string $ message ;
33+ private bool $ ignoredByTest ;
3234
3335 /**
3436 * @param non-empty-string $message
3537 */
36- public function __construct (Telemetry \Info $ telemetryInfo , Test $ test , string $ message )
38+ public function __construct (Telemetry \Info $ telemetryInfo , Test $ test , string $ message, bool $ ignoredByTest )
3739 {
3840 $ this ->telemetryInfo = $ telemetryInfo ;
3941 $ this ->test = $ test ;
4042 $ this ->message = $ message ;
43+ $ this ->ignoredByTest = $ ignoredByTest ;
4144 }
4245
4346 public function telemetryInfo (): Telemetry \Info
@@ -58,6 +61,11 @@ public function message(): string
5861 return $ this ->message ;
5962 }
6063
64+ public function ignoredByTest (): bool
65+ {
66+ return $ this ->ignoredByTest ;
67+ }
68+
6169 /**
6270 * @return non-empty-string
6371 */
@@ -69,9 +77,15 @@ public function asString(): string
6977 $ message = PHP_EOL . $ message ;
7078 }
7179
80+ $ details = [$ this ->test ->id ()];
81+
82+ if ($ this ->ignoredByTest ) {
83+ $ details [] = 'ignored by test ' ;
84+ }
85+
7286 return sprintf (
7387 'Test Triggered PHPUnit Warning (%s)%s ' ,
74- $ this -> test -> id ( ),
88+ implode ( ' , ' , $ details ),
7589 $ message ,
7690 );
7791 }
0 commit comments