php -dxdebug.mode=coverage ./artisan test -p --coverage
It runs the tests, and after passing I see warnings
WARN No code coverage driver is available.
WARN Unable to get coverage using Xdebug. Did you set Xdebug's coverage mode?
It only works when I set environment variable XDEBUG_MODE=coverage. I am OK with this approach, but want to learn why it didn't work with the first approach given here XDEBUG_MODE does same thing as setting via php -dxdebug.mode=coverage?
The <source> determines which folders to be covered in the coverage and which folders to be excluded.
Regarding x-debug, excluding the debug mode is not good if you or your editor use it, but you can stack the options like xdebug.mode=debug,coverage at the end of php.ini.