Skip to content

Commit 86019e2

Browse files
Merge branch '11.1'
2 parents 877f44b + d02eef1 commit 86019e2

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

src/Logging/JUnit/JunitXmlLogger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function testPrepared(): void
202202
*/
203203
public function testFinished(Finished $event): void
204204
{
205-
if ($this->preparationFailed) {
205+
if (!$this->prepared || $this->preparationFailed) {
206206
return;
207207
}
208208

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
https://github.com/sebastianbergmann/phpunit/issues/5771
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--no-configuration';
6+
$_SERVER['argv'][] = '--no-output';
7+
$_SERVER['argv'][] = __DIR__ . '/5771/Issue5771Test.php';
8+
$_SERVER['argv'][] = '--log-junit';
9+
$_SERVER['argv'][] = 'php://stdout';
10+
11+
require_once __DIR__ . '/../../bootstrap.php';
12+
13+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
14+
--EXPECTF--
15+
<?xml version="1.0" encoding="UTF-8"?>
16+
<testsuites>
17+
<testsuite name="PHPUnit\TestFixture\Issue5771\Issue5771Test" file="%sIssue5771Test.php" tests="1" assertions="0" errors="1" failures="0" skipped="0" time="%s">
18+
<testcase name="testOne" file="%sIssue5771Test.php" line="18" class="PHPUnit\TestFixture\Issue5771\Issue5771Test" classname="PHPUnit.TestFixture.Issue5771.Issue5771Test" assertions="0" time="%s">
19+
<error type="PHPUnit\Framework\AssertionFailedError">PHPUnit\TestFixture\Issue5771\Issue5771Test::testOne
20+
Test was run in child process and ended unexpectedly</error>
21+
</testcase>
22+
</testsuite>
23+
</testsuites>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace PHPUnit\TestFixture\Issue5771;
11+
12+
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
13+
use PHPUnit\Framework\TestCase;
14+
15+
final class Issue5771Test extends TestCase
16+
{
17+
#[RunInSeparateProcess]
18+
public function testOne(): void
19+
{
20+
exit;
21+
}
22+
}

0 commit comments

Comments
 (0)