In a previous post, i showed us how to set up automated testing for your PHP application. If you are using the
.gitlab-ci.yml configuration i posted, chances are you will get the below notice in your build log.
No code coverage driver is available
The notice is as a result of missing Xdebug PHP extension.
To install and enable Xdebug, add the commands below to the
before_script: section of your project
# Install Xdebug
- pecl install xdebug
# Enable Xdebug
- docker-php-ext-enable xdebug
Having done the above, go to your project settings and open the CI/CD pipelines screen. In the Test coverage parsing input field, add the regex below.
For code coverage data to be captured by GitLab, ensure you set
--colors option to never like so:
phpunit --coverage-text --colors=never
You should now see test coverage data displayed in the build console and build listing page.