From 1ec05a4d6d957ddc4f260ac5c30e535756fec8e9 Mon Sep 17 00:00:00 2001 From: joseph-sentry Date: Fri, 23 Aug 2024 15:37:37 -0400 Subject: [PATCH] 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. --- src/Logging/JUnit/JunitXmlLogger.php | 1 + tests/end-to-end/cli/no-log-no-cc.phpt | 2 +- tests/end-to-end/data-provider/log-junit-isolation.phpt | 2 +- tests/end-to-end/data-provider/log-junit.phpt | 2 +- tests/end-to-end/logging/log-junit-to-file.phpt | 2 +- tests/end-to-end/logging/log-junit-to-stdout.phpt | 2 +- .../end-to-end/logging/log-junit-with-progress-with-errors.phpt | 2 +- tests/end-to-end/regression/5258.phpt | 2 +- tests/end-to-end/regression/5561.phpt | 2 +- tests/end-to-end/regression/5771.phpt | 2 +- 10 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Logging/JUnit/JunitXmlLogger.php b/src/Logging/JUnit/JunitXmlLogger.php index f68bdc99a67..75d547866b4 100644 --- a/src/Logging/JUnit/JunitXmlLogger.php +++ b/src/Logging/JUnit/JunitXmlLogger.php @@ -309,6 +309,7 @@ private function createDocument(): void $this->document->formatOutput = true; $this->root = $this->document->createElement('testsuites'); + $this->root->setAttribute('name', 'PHPUnit tests'); $this->document->appendChild($this->root); } diff --git a/tests/end-to-end/cli/no-log-no-cc.phpt b/tests/end-to-end/cli/no-log-no-cc.phpt index adfacb3e392..41130e0f7a0 100644 --- a/tests/end-to-end/cli/no-log-no-cc.phpt +++ b/tests/end-to-end/cli/no-log-no-cc.phpt @@ -22,7 +22,7 @@ print file_get_contents($logfile); unlink($logfile); --EXPECTF-- - + diff --git a/tests/end-to-end/data-provider/log-junit-isolation.phpt b/tests/end-to-end/data-provider/log-junit-isolation.phpt index 3156f6d6cf8..201b934e4b8 100644 --- a/tests/end-to-end/data-provider/log-junit-isolation.phpt +++ b/tests/end-to-end/data-provider/log-junit-isolation.phpt @@ -21,7 +21,7 @@ print file_get_contents($logfile); unlink($logfile); --EXPECTF-- - + diff --git a/tests/end-to-end/data-provider/log-junit.phpt b/tests/end-to-end/data-provider/log-junit.phpt index f38cfb07ad7..68a0b779153 100644 --- a/tests/end-to-end/data-provider/log-junit.phpt +++ b/tests/end-to-end/data-provider/log-junit.phpt @@ -23,7 +23,7 @@ print file_get_contents($logfile); unlink($logfile); --EXPECTF-- - + diff --git a/tests/end-to-end/logging/log-junit-to-file.phpt b/tests/end-to-end/logging/log-junit-to-file.phpt index 9d5657bbdaf..52e6b8d1c6b 100644 --- a/tests/end-to-end/logging/log-junit-to-file.phpt +++ b/tests/end-to-end/logging/log-junit-to-file.phpt @@ -20,7 +20,7 @@ print file_get_contents($logfile); unlink($logfile); --EXPECTF-- - + diff --git a/tests/end-to-end/logging/log-junit-to-stdout.phpt b/tests/end-to-end/logging/log-junit-to-stdout.phpt index f481658b6e7..79d75ba65ae 100644 --- a/tests/end-to-end/logging/log-junit-to-stdout.phpt +++ b/tests/end-to-end/logging/log-junit-to-stdout.phpt @@ -14,7 +14,7 @@ require_once __DIR__ . '/../../bootstrap.php'; (new PHPUnit\TextUI\Application)->run($_SERVER['argv']); --EXPECTF-- - + diff --git a/tests/end-to-end/logging/log-junit-with-progress-with-errors.phpt b/tests/end-to-end/logging/log-junit-with-progress-with-errors.phpt index 56b74113b7e..aa006684ada 100644 --- a/tests/end-to-end/logging/log-junit-with-progress-with-errors.phpt +++ b/tests/end-to-end/logging/log-junit-with-progress-with-errors.phpt @@ -42,7 +42,7 @@ TypeError: Cannot assign DateTime to property PHPUnit\TestFixture\TypeErrorTest: ERRORS! Tests: 1, Assertions: 0, Errors: 1. - + PHPUnit\TestFixture\TypeErrorTest::testMe diff --git a/tests/end-to-end/regression/5258.phpt b/tests/end-to-end/regression/5258.phpt index 4d45223594a..330b6e873d6 100644 --- a/tests/end-to-end/regression/5258.phpt +++ b/tests/end-to-end/regression/5258.phpt @@ -29,7 +29,7 @@ Time: %s, Memory: %s MB OK, but some tests were skipped! Tests: 2, Assertions: 1, Skipped: 1. - + diff --git a/tests/end-to-end/regression/5561.phpt b/tests/end-to-end/regression/5561.phpt index 5c033944a5e..b66a3cb5c02 100644 --- a/tests/end-to-end/regression/5561.phpt +++ b/tests/end-to-end/regression/5561.phpt @@ -14,7 +14,7 @@ require_once __DIR__ . '/../../bootstrap.php'; (new PHPUnit\TextUI\Application)->run($_SERVER['argv']); --EXPECTF-- - + PHPUnit\TestFixture\Issue5561\Issue5561Test::testOne%A diff --git a/tests/end-to-end/regression/5771.phpt b/tests/end-to-end/regression/5771.phpt index 440430b7bfe..af2b870d1fa 100644 --- a/tests/end-to-end/regression/5771.phpt +++ b/tests/end-to-end/regression/5771.phpt @@ -13,7 +13,7 @@ require_once __DIR__ . '/../../bootstrap.php'; (new PHPUnit\TextUI\Application)->run($_SERVER['argv']); --EXPECTF-- - + PHPUnit\TestFixture\Issue5771\Issue5771Test::testOne%A