PHPUnit tests and code coverage reports

PHPUnit tests and code coverage reports

by Benjamin Ellis -
Number of replies: 2
Picture of Particularly helpful Moodlers

I have been requested to produce PHPUnit coverage reports for my Moodle 3.5 plugin code and so far have only been able to determine that I can only do this by specifying one of the coverage switches e.g --coverage-html –coverage-text and the –whitelist parameter. Anyone know of a ‘nicer’ way to do this? Also I would appreciate any links to information about running coverage reports for Moodle plugins.

Average of ratings: -
In reply to Benjamin Ellis

Re: PHPUnit tests and code coverage reports

by Renaat Debleu -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

In a normal test environment:

vendor/bin/phpunit --coverage-text --configuration enrol/coursecompleted

 

In .travis.yml file

moodle-plugin-ci phpunit --coverage-text --coverage-clover
after_success:
  - moodle-plugin-ci coveralls-upload

The result can be seen in coversall.io (free service).

Average of ratings: Useful (1)