How To Generate Code Coverage on Laravel Homestead
TDD is cool right ? PHPUnit implementation in Laravel is so great that it makes TDD even cooler.
When building your application you may wonder : did I test everything ?? And how can I make sure that everything is tested ?
That's where PHPUnit Code Coverage is fantastic.
In Laravel Homestead however it is not that easy to setup. Running phpunit --coverage-html testReport/
will probably give you an error at first. What you need is to install XDebug !
Let's do that :
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install php-xdebug
Now edit Xdebug config file...
sudo nano /etc/php/7.1/fpm/conf.d/20-xdebug.ini
And make sure you have this setup :
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back = 1
xdebug.remote_port = 9000
xdebug.max_nesting_level = 250
Finally, restart and activate !
sudo service php7.0-fpm restart
sudo phpenmod -s cli xdebug
Now everything should be good ;)
I consider myself as an IT Business Artisan. Or Consultant CTO. I'm a self-taught Web Developper, coach and teacher. My main work is helping and guiding digital startups.
more about meBTC
18SY81ejLGFuJ9KMWQu5zPrDGuR5rDiauM
ETH
0x519e0eaa9bc83018bb306880548b79fc0794cd08
XMR
895bSneY4eoZjsr2hN2CAALkUrMExHEV5Pbg8TJb6ejnMLN7js1gLAXQySqbSbfzjWHQpQhQpvFtojbkdZQZmM9qCFz7BXU
2024 © My Dynamic Production SRL All rights Reserved.