From fac492c20f885025c708351f8b75a820bd18a42a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abi=20=D8=A3=D8=A8?= Date: Sun, 19 Nov 2023 14:38:02 +0700 Subject: [PATCH] Add file attribute to junit testcase element --- src/Reports/Junit.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Reports/Junit.php b/src/Reports/Junit.php index 0b59604ae0..b0cf520b7e 100644 --- a/src/Reports/Junit.php +++ b/src/Reports/Junit.php @@ -47,6 +47,7 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false, $out->startElement('testcase'); $out->writeAttribute('name', $report['filename']); + $out->writeAttribute('file', $report['filename']); $out->endElement(); } else { $failures = ($report['errors'] + $report['warnings']); @@ -58,6 +59,7 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false, foreach ($colErrors as $error) { $out->startElement('testcase'); $out->writeAttribute('name', $error['source'].' at '.$report['filename']." ($line:$column)"); + $out->writeAttribute('file', $report['filename']); $error['type'] = strtolower($error['type']); if ($phpcsFile->config->encoding !== 'utf-8') { @@ -72,7 +74,7 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false, $out->endElement(); } } - } + }//end foreach }//end if $out->endElement();