r/PHPhelp • • Sep 11 '25

PHPUnit: Code Coverage without phpunit.xml?

Is it possible to using only the command line to run a code coverage using PHPUnit and xdebug without having a phpunit.xml file to determine where the source code files are and where the tests are?

<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true">
    <testsuites>
        <testsuite name="default">
            <directory>tests</directory>
        </testsuite>
    </testsuites>
    <source>
        <include>
            <directory>src</directory>
        </include>
    </source>
</phpunit>
2 Upvotes

5 comments sorted by

View all comments

Show parent comment

1

u/Johto2001 Sep 13 '25

I don't see why you not being a fan of XML is a problem. It's not like you're having to write code to interact with this XML file. It's just a conf file. You can still use a shell script to execute phpunit.