'how do we specify --testdox in phpunit.xml rather than as command line option?
The output you get from phpunit when you specify --testdox is prettier and more informative than the default dots, so I would like to see it that way all the time. But I've not been able to figure out the way to express my wish for testdox output in a phpunit.xml file, unless it's redirected to a file. I want to see it right away on the console.
Any ideas?
Solution 1:[1]
It's not (yet) possible to configure this in phpunit.xml. It should be possible in PHPUnit 8.1.
Solution 2:[2]
Since PHPUnit 8.1 it is now possible.
You need to do this:
composer require --dev phpunit/phpunit:'^8.1'
and then add testdox="true" as an attribute of your <phpunit> tag.
See my implementation: https://github.com/phpexpertsinc/skeleton/commit/0cacc1f4050363a9f15d9e5ba4b788929e7a3a92
Solution 3:[3]
If you still have the PHPUnit version lower (<) than 8.1, then add the line below to your <phpunit ... > node in your phpunit.xml
<phpunit
printerClass="PHPUnit\Util\TestDox\CliTestDoxPrinter"
...
</phpunit>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sebastian Bergmann |
| Solution 2 | |
| Solution 3 | Maksym Ivanov |
