Code Coverage
[🚧 Under Construction]
Viewing Code Coverage in PhpStorm (in this case)​
To view code coverage in PhpStorm, you need to import a code coverage file. In many projects, these files are generated during the running of unit tests and stored in the Coverage directory.
Importing Coverage Files​
PhpStorm allows you to load lcov.info files via the Coverage Toolbar. Once a file is linked, you will automatically see the code coverage highlighted in your IDE.
To import a coverage file in PhpStorm:
- Go to the Coverage Toolbar.
- Click "Import a report collected in CI from disk".
- Select your
lcov.infofile.
PhpStorm supports lcov.info files well. If the import is successful, you should see a result similar to the screenshot provided in the original documentation.
Viewing Coverage in the IDE​
- By default, the Project Toolbar will display the coverage.
- When files are open, coverage is indicated next to the line numbers:
- Green for covered lines
- Red for uncovered lines
Notes on Coverage File Generation​
The method for generating coverage files and their storage location is project-specific. It is recommended to consult the README of the respective project for detailed instructions.
HTML Coverage Reports​
An lcov-report also generates HTML pages by default, allowing you to browse the coverage using a web browser. These reports can be found in the coverage folder at:
coverage/lcov-report/index.html