database
database copied to clipboard
Feat: Adds the start of code coverage.
Beginnings of adding code coverage to projects using PHPUnit. This uses PCOV as the driver and updates the phpunit.xml to include filters for coverage.
required PCOV:
$ pecl install pcov
Then run:
$ phpunit --coverage-text=tests/coverage/report.txt
Adapters, in tests, are updated to allow for environment variables for connections, as well as the original as fallback.
Is there a reason we are using a dependency for generating a coverage report ? How would it be different from simply using the coverage report that
phpunitprovides out of the box ?IMO it would be much cleaner to use
vendor/bin/phpunit --coverage-clover coverage.xmland use the Codecov service that will take care of generating dynamic code coverage README badges and even provides some other features.cc: @eldadfux
Not sure I understand? That is the Code coverage that PHP offers out of the box 😄
You need some kind of driver that can actually check what code is covered or not => https://phpunit.readthedocs.io/en/9.5/code-coverage-analysis.html
Even the official code cov example does not work because there is no driver for this installed:

Why their example works?
Travis is using XDebug by default in their PHP envs, we are running in Docker - so we have to install something anyway 👍🏻
I think the dependency should be fine and as far as I can recall is required.