Laravel 5: PHPUnit and no code coverage driver available

Solution 1:

It seems like you are missing the Xdebug extension. If you're using homebrew you can install it like:

brew install php70-xdebug

After that, don't forget to edit your php.ini file to enable the extension.

php -i | grep xdebug

After checking that xdebug is enabled you should be able to do code coverage

Solution 2:

Update for anyone else stuck;

pecl install xdebug

Solution 3:

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

Solution 4:

Update for PHP 7.1

xdebug is essential for code lookup and coverage , so xdebug is must to be installed or enabled in test environment. xdebug in production environment is not suggestible, it will affect performance if you turned on

brew install php71-xdebug

Solution 5:

As other developers answered, you need to install PHP Xdebug but I want to add new recommend for the developers who are using homestead by default have Xdebug (but it is off) and you can make it ON or OFF

If you want to make it on use below command in homestead

#for on :
xon

#for off:
xoff

Then check php -v and you will see Xdebug in the detail box