Skip to content

Commit 52b5b55

Browse files
authored
Merge pull request #299 from PHPCSStandards/feature/start-using-phpunit-8-9
Tests: allow for PHPUnit 8/9
2 parents 61391ad + deaad9a commit 52b5b55

File tree

4 files changed

+8
-39
lines changed

4 files changed

+8
-39
lines changed

.github/workflows/basics.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ jobs:
4242

4343
- name: 'Composer: adjust dependencies'
4444
run: |
45-
# The sniff stage doesn't run the unit tests, so no need for PHPUnit.
46-
composer remove --no-update --dev phpunit/phpunit --no-scripts --no-interaction
4745
# Using PHPCS `master` as an early detection system for bugs upstream.
4846
composer require --no-update squizlabs/php_codesniffer:"dev-master" --no-interaction
4947
@@ -107,7 +105,7 @@ jobs:
107105
- name: Install PHP
108106
uses: shivammathur/setup-php@v2
109107
with:
110-
php-version: '7.4'
108+
php-version: 'latest'
111109
coverage: none
112110
tools: phpstan
113111

.github/workflows/quicktest.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,12 @@ jobs:
6161

6262
# Install dependencies and handle caching in one go.
6363
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
64-
- name: Install Composer dependencies - normal
65-
if: matrix.php != 'latest'
64+
- name: Install Composer dependencies
6665
uses: "ramsey/composer-install@v2"
6766
with:
6867
# Bust the cache at least once a month - output format: YYYY-MM.
6968
custom-cache-suffix: $(date -u "+%Y-%m")
7069

71-
# For PHP "latest", we need to install with ignore platform reqs as not all PHPUnit 7.x dependencies allow it.
72-
- name: Install Composer dependencies - with ignore platform
73-
if: matrix.php == 'latest'
74-
uses: "ramsey/composer-install@v2"
75-
with:
76-
composer-options: --ignore-platform-req=php+
77-
custom-cache-suffix: $(date -u "+%Y-%m")
78-
7970
- name: "Composer: set PHPCS/PHPCSUtils version for tests (lowest)"
8071
if: ${{ matrix.phpcs_version == 'lowest' }}
8172
run: >
@@ -86,10 +77,5 @@ jobs:
8677
if: matrix.phpcs_version == 'dev-master'
8778
run: composer lint
8879

89-
- name: Run the unit tests - PHP 5.4 - 8.0
90-
if: matrix.php != 'latest'
80+
- name: Run the unit tests
9181
run: composer test
92-
93-
- name: Run the unit tests - PHP > 8.1
94-
if: matrix.php == 'latest'
95-
run: composer test -- --no-configuration --bootstrap=phpunit-bootstrap.php --dont-report-useless-tests

.github/workflows/test.yml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
# @link https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix
3333
#
3434
# The matrix is set up so as not to duplicate the builds which are run for code coverage.
35-
php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '8.0', '8.1', '8.2', '8.3', '8.4']
35+
php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.4']
3636
phpcs_version: ['lowest', 'dev-master']
3737

3838
name: "Test${{ matrix.phpcs_version == 'dev-master' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"
@@ -67,21 +67,12 @@ jobs:
6767

6868
# Install dependencies and handle caching in one go.
6969
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
70-
- name: Install Composer dependencies - normal
71-
if: ${{ startsWith( matrix.php, '8' ) == false }}
70+
- name: Install Composer dependencies
7271
uses: "ramsey/composer-install@v2"
7372
with:
7473
# Bust the cache at least once a month - output format: YYYY-MM.
7574
custom-cache-suffix: $(date -u "+%Y-%m")
7675

77-
# For the PHP 8/"nightly", we need to install with ignore platform reqs as we're still using PHPUnit 7.
78-
- name: Install Composer dependencies - with ignore platform
79-
if: ${{ startsWith( matrix.php, '8' ) }}
80-
uses: "ramsey/composer-install@v2"
81-
with:
82-
composer-options: --ignore-platform-req=php+
83-
custom-cache-suffix: $(date -u "+%Y-%m")
84-
8576
- name: "Composer: set PHPCS/PHPCSUtils version for tests (lowest)"
8677
if: ${{ matrix.phpcs_version == 'lowest' }}
8778
run: >
@@ -92,14 +83,9 @@ jobs:
9283
if: matrix.phpcs_version == 'dev-master'
9384
run: composer lint
9485

95-
- name: Run the unit tests - PHP 5.4 - 8.0
96-
if: ${{ matrix.php < '8.1' }}
86+
- name: Run the unit tests
9787
run: composer test
9888

99-
- name: Run the unit tests - PHP > 8.1
100-
if: ${{ matrix.php >= '8.1' }}
101-
run: composer test -- --no-configuration --bootstrap=phpunit-bootstrap.php --dont-report-useless-tests
102-
10389
#### CODE COVERAGE STAGE ####
10490
# N.B.: Coverage is only checked on the lowest and highest stable PHP versions
10591
# and a low/high of each major for PHPCS.
@@ -114,8 +100,7 @@ jobs:
114100

115101
strategy:
116102
matrix:
117-
# 7.4 should be updated to 8.2 when higher PHPUnit versions can be supported.
118-
php: ['5.4', '7.4']
103+
php: ['5.4', '8.3']
119104
phpcs_version: ['lowest', 'dev-master']
120105

121106
name: "Coverage${{ matrix.phpcs_version == 'dev-master' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"php-parallel-lint/php-console-highlighter": "^1.0",
3131
"phpcsstandards/phpcsdevcs": "^1.1.6",
3232
"phpcsstandards/phpcsdevtools": "^1.2.1",
33-
"phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0"
33+
"phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0"
3434
},
3535
"extra": {
3636
"branch-alias": {

0 commit comments

Comments
 (0)