Skip to content

Commit

Permalink
Merge branch '11.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Apr 23, 2024
2 parents 877f44b + d02eef1 commit 86019e2
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Logging/JUnit/JunitXmlLogger.php
Expand Up @@ -202,7 +202,7 @@ public function testPrepared(): void
*/
public function testFinished(Finished $event): void
{
if ($this->preparationFailed) {
if (!$this->prepared || $this->preparationFailed) {
return;
}

Expand Down
23 changes: 23 additions & 0 deletions tests/end-to-end/regression/5771.phpt
@@ -0,0 +1,23 @@
--TEST--
https://github.com/sebastianbergmann/phpunit/issues/5771
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--no-output';
$_SERVER['argv'][] = __DIR__ . '/5771/Issue5771Test.php';
$_SERVER['argv'][] = '--log-junit';
$_SERVER['argv'][] = 'php://stdout';

require_once __DIR__ . '/../../bootstrap.php';

(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
--EXPECTF--
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="PHPUnit\TestFixture\Issue5771\Issue5771Test" file="%sIssue5771Test.php" tests="1" assertions="0" errors="1" failures="0" skipped="0" time="%s">
<testcase name="testOne" file="%sIssue5771Test.php" line="18" class="PHPUnit\TestFixture\Issue5771\Issue5771Test" classname="PHPUnit.TestFixture.Issue5771.Issue5771Test" assertions="0" time="%s">
<error type="PHPUnit\Framework\AssertionFailedError">PHPUnit\TestFixture\Issue5771\Issue5771Test::testOne
Test was run in child process and ended unexpectedly</error>
</testcase>
</testsuite>
</testsuites>
22 changes: 22 additions & 0 deletions tests/end-to-end/regression/5771/Issue5771Test.php
@@ -0,0 +1,22 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\TestFixture\Issue5771;

use PHPUnit\Framework\Attributes\RunInSeparateProcess;
use PHPUnit\Framework\TestCase;

final class Issue5771Test extends TestCase
{
#[RunInSeparateProcess]
public function testOne(): void
{
exit;
}
}

0 comments on commit 86019e2

Please sign in to comment.