Skip to content

Commit

Permalink
GH Actions: improve fix to run the tests on PHP 8.1
Browse files Browse the repository at this point in the history
There is no need to remove the config file and have all settings on the command-line as PHPUnit offers a `--no-configuration` option to ignore the config file.

Enabling that simplifies the action steps a little and isolates the customization for PHP 8.1 to PHP 8.1.
  • Loading branch information
jrfnl committed Feb 28, 2021
1 parent 6dc06c0 commit cc678d1
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,16 @@ jobs:
- name: 'PHPCS: set the path to PHP'
run: php bin/phpcs --config-set php_path php

# We need to remove the config file so that PHPUnit doesn't try to read it.
# This causes an error on PHP 8.1+ with PHPunit 7, but it's not needed here anyway as the
# phpunit command (below) specifies all required settings.
- name: 'PHPUnit: remove config file'
run: rm phpunit.xml.dist

# Useless tests were not reported for before PHPUnit 6, so it doesn't
# understand the CLI argument.
- name: 'PHPUnit: run the tests'
if: ${{ matrix.php < 7.0 }}
run: vendor/bin/phpunit tests/AllTests.php --bootstrap=tests/bootstrap.php

- name: 'PHPUnit: run the tests, dont report useless'
if: ${{ matrix.php >= 7.0 }}
run: vendor/bin/phpunit tests/AllTests.php --bootstrap=tests/bootstrap.php --dont-report-useless-tests
if: ${{ matrix.php != 8.1 }}
run: vendor/bin/phpunit tests/AllTests.php

# We need to ignore the config file so that PHPUnit doesn't try to read it.
# The config file causes an error on PHP 8.1+ with PHPunit 7, but it's not needed here anyway
# as we can pass all required settings in the phpunit command.
- name: 'PHPUnit: run the tests on PHP nightly'
if: ${{ matrix.php == 8.1 }}
run: vendor/bin/phpunit tests/AllTests.php --no-configuration --bootstrap=tests/bootstrap.php --dont-report-useless-tests

- name: 'PHPCS: check code style without cache, no parallel'
if: ${{ matrix.custom_ini == false }}
Expand Down

0 comments on commit cc678d1

Please sign in to comment.