Skip to content

Commit 1ec05a4

Browse files
joseph-sentrysebastianbergmann
authored andcommitted
add name property to testsuites element in JunitXmlLogger
This commit adds and sets the name property on the testsuites element of the generated JUnit report to 'PHPUnit tests'. This is in line with behaviour in Jest and Vitest where the tools set that property to their respective names.
1 parent 3167dd3 commit 1ec05a4

File tree

10 files changed

+10
-9
lines changed

10 files changed

+10
-9
lines changed

src/Logging/JUnit/JunitXmlLogger.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ private function createDocument(): void
309309
$this->document->formatOutput = true;
310310

311311
$this->root = $this->document->createElement('testsuites');
312+
$this->root->setAttribute('name', 'PHPUnit tests');
312313
$this->document->appendChild($this->root);
313314
}
314315

tests/end-to-end/cli/no-log-no-cc.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ print file_get_contents($logfile);
2222
unlink($logfile);
2323
--EXPECTF--
2424
<?xml version="1.0" encoding="UTF-8"?>
25-
<testsuites>
25+
<testsuites name="PHPUnit tests">
2626
<testsuite name="PHPUnit\TestFixture\NoLogNoCcTest" file="%sNoLogNoCcTest.php" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="%f">
2727
<testcase name="testSuccess" file="%sNoLogNoCcTest.php" line="19" class="PHPUnit\TestFixture\NoLogNoCcTest" classname="PHPUnit.TestFixture.NoLogNoCcTest" assertions="1" time="%f"/>
2828
</testsuite>

tests/end-to-end/data-provider/log-junit-isolation.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ print file_get_contents($logfile);
2121
unlink($logfile);
2222
--EXPECTF--
2323
<?xml version="1.0" encoding="UTF-8"?>
24-
<testsuites>
24+
<testsuites name="PHPUnit tests">
2525
<testsuite name="PHPUnit\TestFixture\DataProviderTest" file="%sDataProviderTest.php" tests="4" assertions="4" errors="0" failures="1" skipped="0" time="%f">
2626
<testsuite name="PHPUnit\TestFixture\DataProviderTest::testAdd" tests="4" assertions="4" errors="0" failures="1" skipped="0" time="%f">
2727
<testcase name="testAdd with data set #0" file="%sDataProviderTest.php" line="%d" class="PHPUnit\TestFixture\DataProviderTest" classname="PHPUnit.TestFixture.DataProviderTest" assertions="1" time="%f"/>

tests/end-to-end/data-provider/log-junit.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ print file_get_contents($logfile);
2323
unlink($logfile);
2424
--EXPECTF--
2525
<?xml version="1.0" encoding="UTF-8"?>
26-
<testsuites>
26+
<testsuites name="PHPUnit tests">
2727
<testsuite name="CLI Arguments" tests="10" assertions="10" errors="0" failures="3" skipped="0" time="%s">
2828
<testsuite name="PHPUnit\TestFixture\DataProviderTest" file="%sDataProviderTest.php" tests="4" assertions="4" errors="0" failures="1" skipped="0" time="%s">
2929
<testsuite name="PHPUnit\TestFixture\DataProviderTest::testAdd" tests="4" assertions="4" errors="0" failures="1" skipped="0" time="%s">

tests/end-to-end/logging/log-junit-to-file.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ print file_get_contents($logfile);
2020
unlink($logfile);
2121
--EXPECTF--
2222
<?xml version="1.0" encoding="UTF-8"?>
23-
<testsuites>
23+
<testsuites name="PHPUnit tests">
2424
<testsuite name="PHPUnit\TestFixture\Basic\StatusTest" file="%sStatusTest.php" tests="13" assertions="4" errors="2" failures="2" skipped="5" time="%f">
2525
<testcase name="testSuccess" file="%sStatusTest.php" line="%d" class="PHPUnit\TestFixture\Basic\StatusTest" classname="PHPUnit.TestFixture.Basic.StatusTest" assertions="1" time="%f"/>
2626
<testcase name="testFailure" file="%sStatusTest.php" line="%d" class="PHPUnit\TestFixture\Basic\StatusTest" classname="PHPUnit.TestFixture.Basic.StatusTest" assertions="1" time="%f">

tests/end-to-end/logging/log-junit-to-stdout.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require_once __DIR__ . '/../../bootstrap.php';
1414
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
1515
--EXPECTF--
1616
<?xml version="1.0" encoding="UTF-8"?>
17-
<testsuites>
17+
<testsuites name="PHPUnit tests">
1818
<testsuite name="PHPUnit\TestFixture\Basic\StatusTest" file="%sStatusTest.php" tests="13" assertions="4" errors="2" failures="2" skipped="5" time="%f">
1919
<testcase name="testSuccess" file="%sStatusTest.php" line="%d" class="PHPUnit\TestFixture\Basic\StatusTest" classname="PHPUnit.TestFixture.Basic.StatusTest" assertions="1" time="%f"/>
2020
<testcase name="testFailure" file="%sStatusTest.php" line="%d" class="PHPUnit\TestFixture\Basic\StatusTest" classname="PHPUnit.TestFixture.Basic.StatusTest" assertions="1" time="%f">

tests/end-to-end/logging/log-junit-with-progress-with-errors.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ TypeError: Cannot assign DateTime to property PHPUnit\TestFixture\TypeErrorTest:
4242
ERRORS!
4343
Tests: 1, Assertions: 0, Errors: 1.
4444
<?xml version="1.0" encoding="UTF-8"?>
45-
<testsuites>
45+
<testsuites name="PHPUnit tests">
4646
<testsuite name="PHPUnit\TestFixture\TypeErrorTest" file="%sTypeErrorTest.php" tests="1" assertions="0" errors="1" failures="0" skipped="0" time="%f">
4747
<testcase name="testMe" file="%sTypeErrorTest.php" line="%d" class="PHPUnit\TestFixture\TypeErrorTest" classname="PHPUnit.TestFixture.TypeErrorTest" assertions="0" time="%f">
4848
<error type="TypeError">PHPUnit\TestFixture\TypeErrorTest::testMe

tests/end-to-end/regression/5258.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Time: %s, Memory: %s MB
2929
OK, but some tests were skipped!
3030
Tests: 2, Assertions: 1, Skipped: 1.
3131
<?xml version="1.0" encoding="UTF-8"?>
32-
<testsuites>
32+
<testsuites name="PHPUnit tests">
3333
<testsuite name="PHPUnit\TestFixture\Issue5258\Issue5258Test" file="%sIssue5258Test.php" tests="2" assertions="1" errors="0" failures="0" skipped="1" time="%f">
3434
<testcase name="testOne" file="%sIssue5258Test.php" line="%d" class="PHPUnit\TestFixture\Issue5258\Issue5258Test" classname="PHPUnit.TestFixture.Issue5258.Issue5258Test" assertions="1" time="%f"/>
3535
<testcase name="testTwo" file="%sIssue5258Test.php" line="%d" class="PHPUnit\TestFixture\Issue5258\Issue5258Test" classname="PHPUnit.TestFixture.Issue5258.Issue5258Test" assertions="0" time="0.000000">

tests/end-to-end/regression/5561.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require_once __DIR__ . '/../../bootstrap.php';
1414
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
1515
--EXPECTF--
1616
<?xml version="1.0" encoding="UTF-8"?>
17-
<testsuites>
17+
<testsuites name="PHPUnit tests">
1818
<testsuite name="PHPUnit\TestFixture\Issue5561\Issue5561Test" file="%sIssue5561Test.php" tests="1" assertions="0" errors="0" failures="1" skipped="0" time="%s">
1919
<testcase name="testOne" file="%sIssue5561Test.php" line="21" class="PHPUnit\TestFixture\Issue5561\Issue5561Test" classname="PHPUnit.TestFixture.Issue5561.Issue5561Test" assertions="0" time="%s">
2020
<failure type="PHPUnit\Framework\ExpectationFailedException">PHPUnit\TestFixture\Issue5561\Issue5561Test::testOne%A

tests/end-to-end/regression/5771.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require_once __DIR__ . '/../../bootstrap.php';
1313
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
1414
--EXPECTF--
1515
<?xml version="1.0" encoding="UTF-8"?>
16-
<testsuites>
16+
<testsuites name="PHPUnit tests">
1717
<testsuite name="PHPUnit\TestFixture\Issue5771\Issue5771Test" file="%sIssue5771Test.php" tests="1" assertions="0" errors="1" failures="0" skipped="0" time="%s">
1818
<testcase name="testOne" file="%sIssue5771Test.php" line="18" class="PHPUnit\TestFixture\Issue5771\Issue5771Test" classname="PHPUnit.TestFixture.Issue5771.Issue5771Test" assertions="0" time="%s">
1919
<error type="PHPUnit\Framework\AssertionFailedError">PHPUnit\TestFixture\Issue5771\Issue5771Test::testOne%A

0 commit comments

Comments
 (0)