@@ -197,18 +197,41 @@ jobs:
197197 composer-options : ${{ matrix.php == '8.5' && '--ignore-platform-req=php+' || '' }}
198198 custom-cache-suffix : $(date -u "+%Y-%m")
199199
200+ - name : Grab PHPUnit version
201+ id : phpunit_version
202+ shell : bash
203+ # yamllint disable-line rule:line-length
204+ run : echo "VERSION=$(php "vendor/bin/phpunit" --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
205+
206+ - name : " DEBUG: Show grabbed version"
207+ run : echo ${{ steps.phpunit_version.outputs.VERSION }}
208+
209+ - name : Determine PHPUnit config file to use
210+ id : phpunit_config
211+ shell : bash
212+ run : |
213+ if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
214+ echo 'FILE=phpunit.xml.dist' >> "$GITHUB_OUTPUT"
215+ elif [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}" == "true" ]; then
216+ echo 'FILE=phpunit.xml.dist' >> "$GITHUB_OUTPUT"
217+ else
218+ echo 'FILE=phpunit-lte9.xml.dist' >> "$GITHUB_OUTPUT"
219+ fi
220+
200221 # Note: The code style check is run multiple times against every PHP version
201222 # as it also acts as an integration test.
202223 - name : ' PHPCS: set the path to PHP'
203224 run : php "bin/phpcs" --config-set php_path php
204225
205226 - name : ' PHPUnit: run the full test suite without code coverage'
206227 if : ${{ matrix.skip_tests != true }}
207- run : php "vendor/bin/phpunit" --no-coverage
228+ run : php "vendor/bin/phpunit" -c ${{ steps.phpunit_config.outputs.FILE }} - -no-coverage
208229
209230 - name : ' PHPUnit: run select tests in CBF mode'
210231 if : ${{ matrix.skip_tests != true }}
211- run : php "vendor/bin/phpunit" --group CBF --exclude-group nothing --no-coverage
232+ run : >
233+ php "vendor/bin/phpunit" -c ${{ steps.phpunit_config.outputs.FILE }} --no-coverage
234+ --group CBF --exclude-group nothing
212235 env :
213236 PHP_CODESNIFFER_CBF : ' 1'
214237
@@ -293,6 +316,18 @@ jobs:
293316 - name : " DEBUG: Show grabbed version"
294317 run : echo ${{ steps.phpunit_version.outputs.VERSION }}
295318
319+ - name : Determine PHPUnit config file to use
320+ id : phpunit_config
321+ shell : bash
322+ run : |
323+ if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
324+ echo 'FILE=phpunit.xml.dist' >> "$GITHUB_OUTPUT"
325+ elif [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}" == "true" ]; then
326+ echo 'FILE=phpunit.xml.dist' >> "$GITHUB_OUTPUT"
327+ else
328+ echo 'FILE=phpunit-lte9.xml.dist' >> "$GITHUB_OUTPUT"
329+ fi
330+
296331 - name : ' PHPCS: set the path to PHP'
297332 run : php "bin/phpcs" --config-set php_path php
298333
@@ -302,18 +337,20 @@ jobs:
302337 # Using that option prevents issues with PHP-Parser backfilling PHP tokens during our test runs.
303338 - name : " Warm the PHPUnit cache (PHPUnit 9.3+)"
304339 if : ${{ steps.phpunit_version.outputs.VERSION >= '9.3' }}
305- run : php "vendor/bin/phpunit" --coverage-cache ./build/phpunit-cache --warm-coverage-cache
340+ run : >
341+ php "vendor/bin/phpunit" -c ${{ steps.phpunit_config.outputs.FILE }}
342+ --coverage-cache ./build/phpunit-cache --warm-coverage-cache
306343
307344 - name : " Run the unit tests with code coverage"
308345 if : ${{ matrix.os != 'windows-latest' }}
309346 run : >
310- php "vendor/bin/phpunit"
347+ php "vendor/bin/phpunit" -c ${{ steps.phpunit_config.outputs.FILE }}
311348 ${{ steps.phpunit_version.outputs.VERSION >= '9.3' && '--coverage-cache ./build/phpunit-cache' || '' }}
312349
313350 - name : " Run select tests in CBF mode with code coverage"
314351 if : ${{ matrix.os != 'windows-latest' }}
315352 run : >
316- php "vendor/bin/phpunit"
353+ php "vendor/bin/phpunit" -c ${{ steps.phpunit_config.outputs.FILE }}
317354 ${{ steps.phpunit_version.outputs.VERSION >= '9.3' && '--coverage-cache ./build/phpunit-cache' || '' }}
318355 --group CBF --exclude-group nothing --coverage-clover build/logs/clover-cbf.xml
319356 env :
@@ -322,8 +359,9 @@ jobs:
322359 - name : " Run the unit tests which may have different outcomes on Windows with code coverage"
323360 if : ${{ matrix.os == 'windows-latest' }}
324361 run : >
325- php "vendor/bin/phpunit" --group Windows
362+ php "vendor/bin/phpunit" -c ${{ steps.phpunit_config.outputs.FILE }}
326363 ${{ steps.phpunit_version.outputs.VERSION >= '9.3' && '--coverage-cache ./build/phpunit-cache' || '' }}
364+ --group Windows
327365
328366 - name : " Upload coverage results to Coveralls (normal run)"
329367 if : ${{ success() }}
0 commit comments