IntelliJ IDEA 2017.2 Help

Monitoring Code Coverage for PHP Applications

This feature is supported in the Ultimate edition only.

The following is only valid when PHP Plugin is installed and enabled!

Code Coverage for PHPUnit shows you how much of your code is covered with tests and marks covered and uncovered lines visually right in the editor.

In this section:

Prerequisites

  1. The PHPUnit tool is installed on your machine and enabled in IntelliJ IDEA.
  2. A Xdebug or Zend Debugger debugging engine is configured in the current PHP interpreter.

To configure code coverage

  1. Press Ctrl+Alt+S or choose File | Settings (for Windows and Linux) or IntelliJ IDEA | Preferences (for macOS) on the main menu, and then go to Build, Execution, Deployment | Coverage.
  2. Specify coverage options on the Coverage page.

To measure code coverage

  1. Write the tests manually.
  2. Create a run configuration of the type PHPUnit.
  3. On the main toolbar, select the PHPUnit run configuration in the Run/Debug Configurations drop-down list and click the Run with Coverage button runWithCoverage.
  4. Monitor the code coverage in the Coverage tool window.
Last modified: 29 November 2017

See Also