Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit ffced94

Browse files
author
__tom__
committed
Add testsuite tests count to fix Bitbucket pipelines ignoring output
Without this tag, Bitbucket pipelines will pick up the file, but it will not visualize it in its interface. Strangely enough, this does work if you also have other test reports in the expected format present, at which point it probably merges it and everything is displayed just fine. In other words, this only broke if there was just one test report present and it was this one.
1 parent 3110a46 commit ffced94

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/JunitErrorFormatter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public function formatErrors(
8989
}
9090

9191
$testsuite->setAttribute('name', 'phpstan');
92+
$testsuite->setAttribute('tests', (string) $totalErrors);
9293
$testsuite->setAttribute('failures', (string) $totalErrors);
9394
}
9495

tests/JunitErrorFormatterTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function dataFormatterOutputProvider(): Generator
3939
0,
4040
'<?xml version="1.0" encoding="UTF-8"?>
4141
<testsuites name="static analysis">
42-
<testsuite failures="1" name="phpstan">
42+
<testsuite failures="1" name="phpstan" tests="1">
4343
<testcase errors="0" failures="1" name="folder with unicode &#x1F603;/file name with &quot;spaces&quot; and unicode &#x1F603;.php:4" tests="1">
4444
<failure message="Foo" type="error" />
4545
</testcase>
@@ -55,7 +55,7 @@ public function dataFormatterOutputProvider(): Generator
5555
1,
5656
'<?xml version="1.0" encoding="UTF-8"?>
5757
<testsuites name="static analysis">
58-
<testsuite failures="1" name="phpstan">
58+
<testsuite failures="1" name="phpstan" tests="1">
5959
<testcase errors="0" failures="1" name="Generic error" tests="1">
6060
<failure message="first generic error" type="error" />
6161
</testcase>
@@ -71,7 +71,7 @@ public function dataFormatterOutputProvider(): Generator
7171
0,
7272
'<?xml version="1.0" encoding="UTF-8"?>
7373
<testsuites name="static analysis">
74-
<testsuite failures="4" name="phpstan">
74+
<testsuite failures="4" name="phpstan" tests="4">
7575
<testcase errors="0" failures="1" name="folder with unicode &#x1F603;/file name with &quot;spaces&quot; and unicode &#x1F603;.php:2" tests="1">
7676
<failure message="Bar" type="error" />
7777
</testcase>
@@ -96,7 +96,7 @@ public function dataFormatterOutputProvider(): Generator
9696
2,
9797
'<?xml version="1.0" encoding="UTF-8"?>
9898
<testsuites name="static analysis">
99-
<testsuite failures="2" name="phpstan">
99+
<testsuite failures="2" name="phpstan" tests="2">
100100
<testcase errors="0" failures="1" name="Generic error" tests="1">
101101
<failure message="first generic error" type="error" />
102102
</testcase>
@@ -115,7 +115,7 @@ public function dataFormatterOutputProvider(): Generator
115115
2,
116116
'<?xml version="1.0" encoding="UTF-8"?>
117117
<testsuites name="static analysis">
118-
<testsuite failures="6" name="phpstan">
118+
<testsuite failures="6" name="phpstan" tests="6">
119119
<testcase errors="0" failures="1" name="folder with unicode &#x1F603;/file name with &quot;spaces&quot; and unicode &#x1F603;.php:2" tests="1">
120120
<failure message="Bar" type="error" />
121121
</testcase>

0 commit comments

Comments
 (0)