Skip to content

Commit

Permalink
Use JUnit XML logfile as expectation instead of test runner output
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Apr 23, 2024
1 parent c722fb2 commit 77dc808
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
27 changes: 11 additions & 16 deletions tests/end-to-end/regression/5771.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,21 @@ 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'][] = tempnam(sys_get_temp_dir(), __FILE__);
$_SERVER['argv'][] = 'php://stdout';

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

(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Runtime: %s

E 1 / 1 (100%)

Time: %s, Memory: %s

There was 1 error:

1) PHPUnit\TestFixture\Issue5771\Issue5771Test::test
Test was run in child process and ended unexpectedly

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
<?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>
2 changes: 1 addition & 1 deletion tests/end-to-end/regression/5771/Issue5771Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
final class Issue5771Test extends TestCase
{
#[RunInSeparateProcess]
public function test(): void
public function testOne(): void
{
exit;
}
Expand Down

0 comments on commit 77dc808

Please sign in to comment.