Closed dmillerSHQ closed 2 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@dmillerSHQ Did you manage to solve this?
For anyone who comes across this in the future. In my case, the pcov.directory
value was not being set when passed on the CLI. I had to set this value directly in the php.ini
file. Code coverage is now calculated correctly for Modules.
For anyone who comes across this in the future. In my case, the
pcov.directory
value was not being set when passed on the CLI. I had to set this value directly in thephp.ini
file. Code coverage is now calculated correctly for Modules.
Can confirm this is still working.
If you want to inject the settings in GiHub Action, it would look like:
steps:
- uses: shivammathur/setup-php@refer-to-setup-php's-version-tag
with:
php-version: '8.2'
ini-values: pcov.directory=$GITHUB_WORKSPACE
coverage: pcov
while in CircleCI(with php cimg), it would look like like:
- run:
name: 'Patch PHP runtime config.'
command: |
sudo sh -c "echo 'pcov.directory = /home/circleci/project' >> /usr/local/lib/php.ini"
# run tests with phpunit
- run:
name: 'Run Unit Tests'
command: |
php artisan test --parallel --processes=2 --coverage-clover tests/coverage.xml
I'm running the following to execute unit tests and to also generate code coverage
php -dpcov.enabled=1 \ -dpcov.directory=. \ -dpcov.exclude="~vendor~" \ ./vendor/bin/paratest -c phpunit-codefresh.xml \ --coverage-html=ci/html
my phpunit-codefresh.xml file is: `<?xml version="1.0" encoding="UTF-8"?> <phpunit backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false">
`
The output will show
0.00%
for Modules/Company when it should be more like65.00%
. There are tests there that would show up for a previous way using xdebug to generate coverage reports.Is there something I am missing here for proper coverage to appear in the report?