Category: Laravel, Laravel, PHP, PHP

This is a quick tip on how to get code coverage results when running PHPUnit on Laravel Homestead. This will enable Xdebug first and then run your tests.

When you use the PHP CLI on Laravel Homestead, Xdebug is not enabled by default. So, when you run your PHPUnit tests it will tell you that no code coverage driver was found and no code coverage will be reported.

So, we can run our code coverage in the following way: vagrant@homestead:~/Code/lastfm$ xon vagrant@homestead:~/Code/lastfm$ phpunit PHPUnit 6.2.4 by Sebastian Bergmann and contributors.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners