Laravel 5: PHPUnit and no code coverage driver available

前端 未结 8 675
深忆病人
深忆病人 2020-12-25 09:49

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

8条回答
  •  孤城傲影
    2020-12-25 10:15

    To Reproduce, kindly follow the solution(s) below;

    1. Steps to reproduce the behavior if you don't have Xdebug activated already:

      • Inside your project root directory open your CMD terminal and type php -i
      • A list of important information concerning your php will be listed in the CMD terminal
      • Copy and paste the output here https://xdebug.org/wizard
      • After you paste the output, click on the button Analyse my phpinfo() output to proceed
      • Follow the instructions to the latter after your redirect to the Summary page
      • After you are done with the installation, type php -v to confirm that Xdebug is activated successfully.
    2. If you already have Xdebug activated, follow these steps get test coverage running;

      • Type ./vendor/bin/phpunit --coverage-html tests/coverage into the CMD terminal to generate the test coverage
      • After it is done with running the tests successfully, the coverage report of the tests will be in the project_dir/tests/coverage directory
      • Inside the project_dir/tests/coverage directory, click on the index.html file to open and view the general report of the project's phpunit test coverage

    NB: I worked in Laravel ^6.0
    Tested in Windows 10 environment but can be replicated in other environments

提交回复
热议问题