how do we specify --testdox in phpunit.xml rather than as command line option?
Asked Answered
H

4

8

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?

Hassett answered 11/3, 2019 at 16:49 Comment(3)
It's not (yet) possible to configure this in phpunit.xml.Powerless
I'd say that qualifies as an Answer :-) Thanks.Hassett
I think you inspired him! I've been looking forward to this for 10+ years and it was done less than 36 hours after you asked this question!Cow
P
7

It's not (yet) possible to configure this in phpunit.xml. It should be possible in PHPUnit 8.1.

Powerless answered 11/3, 2019 at 19:49 Comment(3)
It's implemented now: github.com/sebastianbergmann/phpunit/commit/…Powerless
looks like we are still waiting for zendframework/zend-test to support PHPUnit 8, which is what particularly interests me since I am working with ZF3. so for now I am bash-aliasing my phpunit command.Hassett
Hurray! Thank you so much, @SebastianBergmann! I've been waiting for this feature since the PHPUnit 3 days! I've already implemented it in all of my projects. github.com/phpexpertsinc/skeleton/commit/…Cow
C
14

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

Cow answered 11/6, 2019 at 14:43 Comment(2)
The correct attribute name is testdox as opposed to textdox. But yes, this worked on phpunit 8.5Cologarithm
Fixed. Thank you!Cow
P
7

It's not (yet) possible to configure this in phpunit.xml. It should be possible in PHPUnit 8.1.

Powerless answered 11/3, 2019 at 19:49 Comment(3)
It's implemented now: github.com/sebastianbergmann/phpunit/commit/…Powerless
looks like we are still waiting for zendframework/zend-test to support PHPUnit 8, which is what particularly interests me since I am working with ZF3. so for now I am bash-aliasing my phpunit command.Hassett
Hurray! Thank you so much, @SebastianBergmann! I've been waiting for this feature since the PHPUnit 3 days! I've already implemented it in all of my projects. github.com/phpexpertsinc/skeleton/commit/…Cow
L
0

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>
Lumenhour answered 6/4, 2022 at 11:7 Comment(0)
S
0

It is now possible to set testdox in the phpunit.xml:

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/|version|/phpunit.xsd"
         testdox="true"
         >
Subjectify answered 14/7, 2023 at 13:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.