Skip to content

Commit cead4a6

Browse files
committed
Enable xdebug coverage mode for php8 in travis
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.
1 parent 958cfff commit cead4a6

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

.travis.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ matrix:
44
include:
55
- php: 7.2
66
dist: bionic
7-
env: PHPUNIT_LEGACY="true"
87
- php: 7.3
98
dist: bionic
10-
env: PHPUNIT_LEGACY="true"
119
- php: 7.4
1210
dist: bionic
1311
- php: nightly
@@ -40,9 +38,9 @@ script:
4038
- vendor/bin/grumphp run
4139
- composer test
4240

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

0 commit comments

Comments
 (0)