...
Add the following whitelist configuration to your phpunit.xml
file directly after the closing </php>
tag. Adjust the paths to match your project’s structure. Only directories and files included in the whitelist will appear in the coverage report.
...
File: test/phpunit/phpunit.xml
Code Block | ||
---|---|---|
| ||
</php>
...
<source>
<include>
<directory suffix=".php">/var/www/totara/src/SITENAME/server/totara/core/classes/local</directory>
<directory suffix=".php">/var/www/totara/src/SITENAME/server/totara/core/classes/task</directory>
<file>/var/www/totara/src/SITENAME/server/totara/core/classes/visibility_adviser.php</file>
</include>
</source> |
...
On your local machine: add your new “coverage_report site” in the hosts file, so that we can access it via the browser. Replace
XX
with the PHP version you are currently using. For example if you’re using PHP 8.3, this will be 83. Once this step has been run, you should not need to repeat this step.
Code Block | ||
---|---|---|
| ||
sudo -- sh -c "echo \"127.0.0.1 coverage_report.totaraXX\" >> /etc/hosts " |
Now you should be able to access your coverage report via the web browser by navigating to
http://coverage_report.totaraXX
, where XX is the PHP version you used in step 2.
...