I’m currently using PHPUnit 11.4.3. In previous versions (9? 8?), it used to output the result of a test as it was run. Now, as it is running, I just get something like:
Runtime: PHP 8.2.12
Configuration: testsphpunit.xml
.................................................
Then after it completes, it shows all the test results.
Is there a way to have PHPUnit (v11) output the test results as it runs?
I execute the test from the command line:
vendorbinphpunit -c testsphpunit.xml
PHPUnit 11.4.3 by Sebastian Bergmann and contributors.
Runtime: PHP 8.2.12
Configuration: testsphpunit.xml
Here is my config file:
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"
backupGlobals="true"
backupStaticProperties="false"
cacheDirectory=".phpunit.cache"
cacheResult="false"
colors="true"
displayDetailsOnTestsThatTriggerWarnings="true"
processIsolation="false"
requireCoverageMetadata="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
stopOnRisky="false"
testdox="true"
timeoutForSmallTests="1"
timeoutForMediumTests="10"
timeoutForLargeTests="60"
>
<coverage/>
<php>
<ini
name="display_errors"
value="true"/>
</php>
<source/>
<testsuites>
<testsuite name="all">
<file>PageTests.php</file>
<file>UnitTests.php</file>
</testsuite>
</testsuites>
</phpunit>
2
Answers
Edit the configuration file and update the phpunit.xml file to disable testdox mode
There was a breaking change and now TestDox mode is no longer used during report execution, it’s only used for final report. This change is intentional and is not going to be reverted:
Issue #5883 – Testdox no longer outputs in real-time
Your only option at this moment is to write or find a PHPUnit extension that does this. I’m personally using ScriptFUSION/Pip.