Code Coverage
Warning
This page is primarily targeted at developers. If you are a normal user of this plugin, you can safely skip this section.
Prerequisites
To generate code coverage reports, you need to have:
- your PHPUnit test environment set up.
- the
xdebug
extension installed and enabled in your PHP environment.
Generating Coverage Reports
To generate code coverage reports, follow these steps:
- Run PHPUnit with coverage report:
XDEBUG_MODE=coverage vendor/bin/phpunit --colors --testdox --coverage-html /tmp/coverage --filter quiz_archiver/*
- Copy the generated report to your host system:
docker cp my-moodle-container:/tmp/coverage /tmp/coverage
- Open the report in your browser:
xdg-open /tmp/coverage/index.html
Note
It can be required to purge your local /tmp/covarage
directory between consecutive runs. If you find changes not
being reflected correctly in the report, try to delete the /tmp/coverage
directory and re-run the copy command:
rm -rf /tmp/coverage; docker cp my-moodle-container:/tmp/coverage /tmp/coverage