...
Totara 13 and above
Replace server/path/to/plugin/to/test
with the directory path for the plugin you want to test. For example, if I were generating a code coverage report for Totara hierarchy, this would be server/totara/hierarchy
.
...
You still need to define a whitelist
As a product we support several different versions of PHP - if you're using php-fpm and have them installed you can configure PHPStorm so that you can choose which version you run tests and coverage on
When looking at a testcase file you can click on the little arrows next to test case classes and test case methods and choose to run specific tests
Common Pitfalls
phpunit.xml
path has not been configured correctly
Ensure the paths you provided in phpunit.xml configuration point to where Totara is installed. You can do this by navigating to your Totara installation and running the command pwd
to print out your current working directory.
Further reading
Unit testing in TotaraExternal: PHPUnit documentation on code coverage analysis
External: XDebug code coverage analysis
External: PHPDBG documentation
External: pcov repository and documentation