Skip to content

Commit

Permalink
Enable xdebug coverage mode for php8 in travis
Browse files Browse the repository at this point in the history
For php 8, we need to manually set the new `xdebug.mode` option to
enable coverage mode, but it won't work if we simply do something like
`php -d xdebug.mode=coverage composer infection` because InfectionPHP
spawns new processes that would lose that option.

To provide for this, there's the `--initial-tests-php-options` shell
option to infection that will pass that on when it calls PHP for the
initial test run, which is the only time we need coverage enabled.

Since this is only required in PHP 8 and there are no other parts using
the `PHPUNIT_LEGACY` env variable, we can instead test against php 7.x
to remove the need for PHPUNIT_LEGACY entirely.
  • Loading branch information
dshoreman committed Nov 5, 2020
1 parent bc39de1 commit 2b92cb7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ matrix:
include:
- php: 7.2
dist: bionic
env: PHPUNIT_LEGACY="true"
- php: 7.3
dist: bionic
env: PHPUNIT_LEGACY="true"
- php: 7.4
dist: bionic
- php: nightly
Expand Down Expand Up @@ -43,9 +41,9 @@ script:
- vendor/bin/grumphp run
- composer test

- if [[ -z "$PHPUNIT_LEGACY" ]]; then composer infection; else
vendor/bin/infection --ansi --threads=4 --coverage=tests/test-results
--test-framework-options="-c tests/phpunit.legacy.xml"
- if [[ ${TRAVIS_PHP_VERSION:0:1} == "7" ]]; then composer infection; else
vendor/bin/infection --ansi --threads=4
--initial-tests-php-options="-d xdebug.mode=coverage"
--only-covered --min-msi=100 --min-covered-msi=100
; fi

Expand Down

0 comments on commit 2b92cb7

Please sign in to comment.