2

Does anyone know the correct command line to generate a code coverage file on a PHP project? I've already installed the XDebug tool.

In the official documentation from PHPUnit, I found the following command line, but it is not working:

phpunit --coverage-text=<file> 

where is the file where output is going to be stored.

I don't have any tests yet, but is there a way to generate a report file, even though there are no tests in the project?

2
  • Hello @GrumpyCrouton! Hope now it is more clear. Commented Apr 18, 2018 at 20:57
  • 1
    It is much better, except you should explain what you mean by "it is not working"; how is it not working? Commented Apr 18, 2018 at 20:59

1 Answer 1

2

You'll need to include the path to your tests, as well as the white list command with the path to the source code to be tested. E.g.

phpunit --coverage-text="coverage.txt" ./path/to/tests --whitelist="./path/to/code"

Where coverage.txt is the file that the output will be stored in. You can generate a report without any tests.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.