David
David

Reputation: 875

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?

Upvotes: 9

Views: 5356

Answers (4)

ShawnPConroy
ShawnPConroy

Reputation: 239

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"
         >

Upvotes: 0

Maksym Ivanov
Maksym Ivanov

Reputation: 31

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>

Upvotes: 0

Theodore R. Smith
Theodore R. Smith

Reputation: 23231

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

Upvotes: 14

Sebastian Bergmann
Sebastian Bergmann

Reputation: 8326

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

Upvotes: 7

Related Questions