Code Coverage 0.0% on a Laravel project having PHPUnit to do testing

One thing you need to be careful about are the paths in the clover.xml. I had the same issue when I send clover generated by PHPUnit (on WordPress project, but that shouldn’t matter).
The clover.xml that is generated will create file name attribute that is absolute on your system - since I generated my tests locally, the name attribute was something like

/Users/denis/vagrant-local/www/project/public_html/wp-content/plugins/...

So I usually do a search-replace on my clover file so that only wp-content/plugins/... part is left (I delete the first part). Once I send this to SQ in my Jenkins pipeline, the coverage will be shown - not the same as in PHPUnit report, but it will be shown (my guess is that SQ can then generate the coverage internally somehow).

Hope this helps in some way :slight_smile:

1 Like