...
Install pcov:
Code Block pecl install pcov
Note the generated path to
pcov.so
, e.g./usr/local/lib/php/extensions/no-debug-non-zts-20230831/pcov.so
.Update
php.ini
. Note here also that we update thememory_limit
to 8G:Code Block language ini memory_limit=8G [pcov] extension="path/to/pcov.so" pcov.enabled=1 pcov.exclude='~(vendor|tests|node_modules|.git|client|.scannerwork)~' pcov.initial.memory=1073741824 pcov.initial.files=30000
The php.ini
may be found here: /usr/local/etc/php/php.ini
Generate the report:
Code Block phpunit --coverage-html /var/www/html/coverage_report /path/to/plugin/to/test
Viewing the reportusing Totara docker developer environment
...