25

I'm running tests PHPUnit from command line, but can't work out how to make it show the code coverage results in the terminal.

There are various command line options here in their documentation but they all involve outputting the results to a file in one of various formats.

Am I missing an obvious solution? Or would I need to write a batch file that executes:

  1. executes the PHPUnit command and flags that output code coverage to a file
  2. outputs the contents of the file to stdio so it appears in the terminal

1 Answer 1

61

File is not mandatory for --coverage-text option, you can run just

./phpunit.phar --coverage-text

and get results in the terminal.

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

2 Comments

Is there a way of gaining greater insight from --coverage-text? Eg what numbers?
@JohnHunt you can use --coverage-html=coverage to dump a fancy coverage report with line-by-line information.

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.