PHPUnit tests: fix deprecation notices on PHPUnit 10 #21
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
pull_request: | |
# Allow manually triggering the workflow. | |
workflow_dispatch: | |
# Cancels all previous workflow runs for the same branch that have not yet completed. | |
concurrency: | |
# The concurrency group contains the workflow name and the branch name. | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] | |
continue-on-error: ${{ matrix.php == '8.4' }} | |
name: "Test: PHP ${{ matrix.php }}" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On | |
coverage: none | |
- name: Run tests | |
run: php ./tests/test.php | |
unittest: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] | |
continue-on-error: ${{ matrix.php == '8.4' }} | |
name: "Unit Test: PHP ${{ matrix.php }}" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On | |
coverage: xdebug | |
# Install dependencies and handle caching in one go. | |
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer | |
- name: Install Composer dependencies - normal | |
if: ${{ matrix.php != '8.4' }} | |
uses: "ramsey/composer-install@v3" | |
with: | |
# Bust the cache at least once a month - output format: YYYY-MM. | |
custom-cache-suffix: $(date -u "+%Y-%m") | |
- name: Install Composer dependencies - ignore PHP restrictions | |
if: ${{ matrix.php == '8.4' }} | |
uses: "ramsey/composer-install@v3" | |
with: | |
composer-options: --ignore-platform-req=php+ | |
# Bust the cache at least once a month - output format: YYYY-MM. | |
custom-cache-suffix: $(date -u "+%Y-%m") | |
# PHPUnit 10 will fail a test run when the "old" configuration format is used. | |
# Luckily, there is a build-in migration tool since PHPUnit 9.3. | |
- name: Migrate PHPUnit configuration for PHPUnit 9.3+ | |
run: vendor/bin/phpunit --migrate-configuration || echo '--migrate-configuration not available' | |
- name: Run the unit tests | |
run: vendor/bin/phpunit |