Tests: allow for recording code coverage + add @covers
tags
#2225
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tests: allow for recording code coverage + add
@covers
tags... to all unit test files, as well as enable strict coverage recording.
Includes:
By default, when there is a code coverage configuration and Xdebug is enabled, code coverage will be generated.
Note: generating code coverage is slow.
build
directory as created by PHPUnit to store the log files (as set up in the config file).run-tests
, no code coverage will be created.coverage
script has been added.When running PHPUnit locally, I'd recommend copying the
phpunit.xml.dist
file tophpunit.xml
and replacing theclover
logging with the following to allow for locally using the HTML report:Note: this commit does not set up code coverage checking for PRs via an external service like Coveralls or CodeCov, though I imagine we could set this up in the future as the WP organisation already has a CodeCov account (we'd need to check if we can or need permission).
Tests: add
@covers
tags for HelpersAs the
Helpers
in WPCS do not have dedicated tests, but are tested via the sniffs using them, I'm adding@covers
tags for these to select sniffs.At a later point in time, we can revisit whether or not to add dedicated tests for the Helpers.
Tests: add
@covers
tags for abstract base sniff classesAs the abstract sniff base classes in WPCS do not have dedicated tests, but are tested via the sniffs using them, I'm adding
@covers
tags for these to select sniffs.As the majority of these will at some point in the future be replaced by (fully tested) abstracts from PHPCSUtils, I'm not concerned with adding dedicated tests for these, so this will do until they are deprecated/removed.