Skip to content

Commit ca5b7cc

Browse files
committed
build: add support for PHPUnit 10
1 parent 45be91d commit ca5b7cc

File tree

4 files changed

+42
-11
lines changed

4 files changed

+42
-11
lines changed

.github/workflows/tests.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ jobs:
2121
php: '7.4'
2222
- laravel: '10.*'
2323
php: '8.0'
24+
include:
25+
- php: 7.4
26+
phpunit: ^9.5
27+
- php: '8.0'
28+
phpunit: ^9.5
29+
- php: 8.1
30+
phpunit: ^10.5
31+
- php: 8.2
32+
phpunit: ^10.5
2433

2534
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }}
2635

@@ -52,10 +61,11 @@ jobs:
5261
- name: Install dependencies
5362
run: |
5463
composer require "illuminate/contracts:${{ matrix.laravel }}" --no-interaction --no-update
64+
composer require "phpunit/phpunit:${{ matrix.phpunit }}" --dev --no-interaction --no-update
5565
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
5666
5767
- name: Execute tests
58-
run: XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
68+
run: XDEBUG_MODE=coverage vendor/bin/phpunit --configuration=${{ matrix.phpunit == '^9.5' && 'phpunit-9.xml' || 'phpunit.xml' }} --coverage-text --coverage-clover=coverage.clover
5969

6070
- name: Upload Scrutinizer coverage
6171
uses: sudo-bot/action-scrutinizer@latest

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"guzzlehttp/guzzle": "^7.3",
1313
"guzzlehttp/psr7": "^2.1",
1414
"orchestra/testbench": "^6.15|^7.0|^8.0",
15-
"phpunit/phpunit": "^9.5"
15+
"phpunit/phpunit": "^9.5|^10.5"
1616
},
1717
"autoload": {
1818
"psr-4": {

phpunit-9.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.2/phpunit.xsd"
4+
backupGlobals="false"
5+
backupStaticAttributes="false"
6+
colors="true"
7+
bootstrap="vendor/autoload.php"
8+
convertErrorsToExceptions="true"
9+
convertNoticesToExceptions="true"
10+
convertWarningsToExceptions="true"
11+
processIsolation="false"
12+
stopOnFailure="false">
13+
<testsuites>
14+
<testsuite name="tests">
15+
<directory suffix="Test.php">./tests</directory>
16+
</testsuite>
17+
</testsuites>
18+
<filter>
19+
<whitelist processUncoveredFilesFromWhitelist="true">
20+
<directory suffix=".php">./src</directory>
21+
</whitelist>
22+
</filter>
23+
</phpunit>

phpunit.xml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.2/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
44
backupGlobals="false"
5-
backupStaticAttributes="false"
5+
backupStaticProperties="false"
66
colors="true"
77
bootstrap="vendor/autoload.php"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
8+
cacheDirectory=".phpunit.cache"
119
processIsolation="false"
1210
stopOnFailure="false">
1311
<testsuites>
1412
<testsuite name="tests">
1513
<directory suffix="Test.php">./tests</directory>
1614
</testsuite>
1715
</testsuites>
18-
<filter>
19-
<whitelist processUncoveredFilesFromWhitelist="true">
16+
<source>
17+
<include>
2018
<directory suffix=".php">./src</directory>
21-
</whitelist>
22-
</filter>
19+
</include>
20+
</source>
2321
</phpunit>

0 commit comments

Comments
 (0)