Skip to content

Commit 71c5477

Browse files
Add support for PHPUnit 9 and migrate to Github Actions
1 parent 917da61 commit 71c5477

File tree

3 files changed

+73
-9
lines changed

3 files changed

+73
-9
lines changed

.github/workflows/php.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Unit tests
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
strategy:
8+
matrix:
9+
php: ['7.2', '7.3', '7.4']
10+
phpunit: ['8.0', '9.0']
11+
exclude:
12+
- php: '7.2'
13+
phpunit: '9.0'
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v1
18+
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v1
21+
with:
22+
php-version: ${{ matrix.php }}
23+
extensions: mbstring, intl, json
24+
coverage: pcov
25+
26+
- name: Validate composer.json and composer.lock
27+
run: composer validate
28+
29+
- name: Declare required PHPUnit version
30+
run: |
31+
composer require --no-update --dev phpunit/phpunit ~${{ matrix.phpunit }}
32+
33+
- name: Install dependencies
34+
run: composer install --prefer-dist --no-progress --no-suggest
35+
36+
#- name: Run type checker
37+
# run: ./vendor/bin/psalm
38+
39+
- name: Run unit tests
40+
run: ./vendor/bin/phpunit --testdox
41+
42+
coverage:
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- uses: actions/checkout@v1
47+
48+
- name: Setup PHP
49+
uses: shivammathur/setup-php@v1
50+
with:
51+
php-version: 7.4
52+
extensions: mbstring, intl, json
53+
coverage: pcov
54+
55+
- name: Install dependencies
56+
run: composer install --prefer-dist --no-progress --no-suggest
57+
58+
- name: Test & publish code coverage
59+
uses: paambaati/codeclimate-action@v2.3.0
60+
env:
61+
CC_TEST_REPORTER_ID: ${{ secrets.codeClimateReporterID }}
62+
with:
63+
coverageCommand: ./vendor/bin/phpunit --coverage-clover=clover.xml
64+
debug: true

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ There are several release branches of this library, each of these being compatib
2424
with different releases of PHPUnit and PHP. The following table should give an
2525
easy overview:
2626

27-
| PSR-7 assertion version | PHPUnit 4 | PHPUnit 5 | PHPUnit 6 | PHPUnit 7 | PHPUnit 8 |
28-
| ----------------------- | --------- | --------- | --------- | --------- | --------- |
29-
| v1 (branch `v1`), **unsupported** | :white_check_mark: | :white_check_mark: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: |
30-
| v2 (branch `v2`), **unsupported** | :no_entry_sign: | :no_entry_sign: | :white_check_mark: | :no_entry_sign: | :no_entry_sign: |
31-
| v3 (branch `v3`) | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :white_check_mark: | :no_entry_sign: |
32-
| v4 (branch `master`) | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :white_check_mark: |
27+
| PSR-7 assertion version | PHPUnit 4 | PHPUnit 5 | PHPUnit 6 | PHPUnit 7 | PHPUnit 8 | PHPUnit 9 |
28+
| ----------------------- | --------- | --------- | --------- | --------- | --------- | --------- |
29+
| v1 (branch `v1`), **unsupported** | :white_check_mark: | :white_check_mark: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: |
30+
| v2 (branch `v2`), **unsupported** | :no_entry_sign: | :no_entry_sign: | :white_check_mark: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: |
31+
| v3 (branch `v3`) | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :white_check_mark: | :no_entry_sign: | :no_entry_sign: |
32+
| v4 (branch `master`) | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :no_entry_sign: | :white_check_mark: | :white_check_mark: |
3333

3434
When you are using `composer require` and have already declared a dependency to
3535
`phpunit/phpunit` in your `composer.json` file, Composer should pick latest

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
},
1616
"require-dev": {
1717
"guzzlehttp/psr7": "^1.2",
18-
"phpunit/phpunit": "^8.0"
18+
"phpunit/phpunit": "^8.0 || ^9.0"
1919
},
2020
"conflict": {
21-
"phpunit/phpunit": "<8.0 || >= 9.0"
21+
"phpunit/phpunit": "<8.0 || >= 10.0"
2222
},
2323
"autoload": {
2424
"psr-4": {
@@ -35,4 +35,4 @@
3535
"config": {
3636
"sort-packages": true
3737
}
38-
}
38+
}

0 commit comments

Comments
 (0)