Commit 7c0390b8154 for php.net
commit 7c0390b81548ec71ce7f481505be82443d1f12d9
Author: Levi Morrison <levi.morrison@datadoghq.com>
Date: Mon Aug 24 10:21:29 2026 -0600
Fix JUnit timing aggregation for long-running tests (#23438)
diff --git a/run-tests.php b/run-tests.php
index e4a4563f93f..dfb07a465bd 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -3386,6 +3386,7 @@ public function markTestAs(
$time = $time ?? $this->getTimer($file_name);
$this->record($suite, 'execution_time', $time);
+ $formatted_time = number_format($time, 4, '.', '');
$escaped_details = htmlspecialchars($details, ENT_QUOTES, 'UTF-8');
$escaped_details = preg_replace_callback('/[\0-\x08\x0B\x0C\x0E-\x1F]/', function ($c) {
@@ -3394,7 +3395,7 @@ public function markTestAs(
$escaped_message = htmlspecialchars($message, ENT_QUOTES, 'UTF-8');
$escaped_test_name = htmlspecialchars($file_name . ' (' . $test_name . ')', ENT_QUOTES);
- $this->rootSuite['files'][$file_name]['xml'] = "<testcase name='$escaped_test_name' time='$time'>\n";
+ $this->rootSuite['files'][$file_name]['xml'] = "<testcase name='$escaped_test_name' time='$formatted_time'>\n";
if (is_array($type)) {
$output_type = $type[0] . 'ED';
@@ -3439,7 +3440,7 @@ private function getTimer(string $file_name)
}
if (isset($this->rootSuite['files'][$file_name]['total'])) {
- return number_format($this->rootSuite['files'][$file_name]['total'], 4);
+ return $this->rootSuite['files'][$file_name]['total'];
}
return 0;