I would like to use PHPUnit to create code coverage reports. I have tried a lot of installation setups found on the web. But nothing seems to work out.
I use the lat
For windows users:
1) Download xdebug
2) Rename the file to _php_xdebug.dll_ and copy the file to the ext folder in your php installation e.g C:\Program Files (x86)\php\ext
3) Open your php.ini file. For me it’s available at C:\Program Files (x86)\php\php.ini.
4) Paste the below code at the bottom of the file.
zend_extension = php_xdebug.dll
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.remote_autostart = 1
xdebug.remote_port = 9000
xdebug.show_local_vars = 1
To Reproduce, kindly follow the solution(s) below;
Steps to reproduce the behavior if you don't have Xdebug activated already:
php -i
php -v
to confirm that Xdebug is activated successfully.If you already have Xdebug activated, follow these steps get test coverage running;
./vendor/bin/phpunit --coverage-html tests/coverage
into the CMD terminal to generate the test coverageNB: I worked in Laravel ^6.0
Tested in Windows 10 environment but can be replicated in other environments