Skip to content

Commit 7cccd8e

Browse files
authored
Update to PHPUnit 10 (#46)
* update to phpunit 10 * fix phpunit workflow * update deptrac workflow * rector workflow update
1 parent bcca098 commit 7cccd8e

File tree

7 files changed

+37
-100
lines changed

7 files changed

+37
-100
lines changed

.github/workflows/deptrac.yml

+2-53
Original file line numberDiff line numberDiff line change
@@ -19,56 +19,5 @@ on:
1919
- '.github/workflows/deptrac.yml'
2020

2121
jobs:
22-
build:
23-
name: Dependency Tracing
24-
runs-on: ubuntu-latest
25-
if: "!contains(github.event.head_commit.message, '[ci skip]')"
26-
27-
steps:
28-
- name: Checkout
29-
uses: actions/checkout@v4
30-
31-
- name: Set up PHP
32-
uses: shivammathur/setup-php@v2
33-
with:
34-
php-version: '8.1'
35-
tools: phive
36-
extensions: intl, json, mbstring, xml
37-
coverage: none
38-
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
41-
- name: Get composer cache directory
42-
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
43-
44-
- name: Cache composer dependencies
45-
uses: actions/cache@v4
46-
with:
47-
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
48-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
49-
restore-keys: ${{ runner.os }}-composer-
50-
51-
- name: Create Deptrac cache directory
52-
run: mkdir -p build/
53-
54-
- name: Cache Deptrac results
55-
uses: actions/cache@v4
56-
with:
57-
path: build
58-
key: ${{ runner.os }}-deptrac-${{ github.sha }}
59-
restore-keys: ${{ runner.os }}-deptrac-
60-
61-
- name: Install dependencies
62-
run: |
63-
if [ -f composer.lock ]; then
64-
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
65-
else
66-
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
67-
fi
68-
69-
- name: Trace dependencies
70-
run: |
71-
sudo phive --no-progress install --global --trust-gpg-keys B8F640134AB1782E,A98E898BB53EB748 qossmic/deptrac
72-
deptrac analyze --cache-file=build/deptrac.cache
73-
env:
74-
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
deptrac:
23+
uses: codeigniter4/.github/.github/workflows/deptrac.yml@main

.github/workflows/phpunit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
fi
7373
7474
- name: Test with PHPUnit
75-
run: vendor/bin/phpunit --verbose --coverage-text
75+
run: vendor/bin/phpunit --coverage-text
7676
env:
7777
TERM: xterm-256color
7878
TACHYCARDIA_MONITOR_GA: enabled

.github/workflows/rector.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,22 @@ on:
1818
- 'rector.php'
1919
- '.github/workflows/rector.yml'
2020

21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
23+
cancel-in-progress: true
24+
25+
permissions:
26+
contents: read
27+
2128
jobs:
2229
build:
2330
name: PHP ${{ matrix.php-versions }} Rector Analysis
2431
runs-on: ubuntu-latest
25-
if: "!contains(github.event.head_commit.message, '[ci skip]')"
32+
if: (! contains(github.event.head_commit.message, '[ci skip]'))
2633
strategy:
2734
fail-fast: false
2835
matrix:
29-
php-versions: ['8.1', '8.2']
36+
php-versions: ['8.1', '8.3']
3037

3138
steps:
3239
- name: Checkout
@@ -61,6 +68,4 @@ jobs:
6168
fi
6269
6370
- name: Analyze for refactoring
64-
run: |
65-
composer global require --dev rector/rector:^0.19.5
66-
rector process --dry-run --no-progress-bar
71+
run: vendor/bin/rector process --dry-run --no-progress-bar

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,5 @@ nb-configuration.xml
126126
/results/
127127
/phpunit*.xml
128128
/.phpunit.*.cache
129-
129+
/.phpunit.cache
130130
/.php-cs-fixer.php

composer.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
"autoload": {
2727
"psr-4": {
2828
"CodeIgniter\\Queue\\": "src"
29-
}
29+
},
30+
"exclude-from-classmap": [
31+
"**/Database/Migrations/**"
32+
]
3033
},
3134
"autoload-dev": {
3235
"psr-4": {

phpunit.xml.dist

+19-37
Original file line numberDiff line numberDiff line change
@@ -1,33 +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/9.5/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
44
bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php"
55
backupGlobals="false"
6-
beStrictAboutCoversAnnotation="true"
76
beStrictAboutOutputDuringTests="true"
8-
beStrictAboutTodoAnnotatedTests="true"
97
colors="true"
10-
convertErrorsToExceptions="true"
11-
convertNoticesToExceptions="true"
12-
convertWarningsToExceptions="true"
138
executionOrder="random"
149
failOnRisky="true"
1510
failOnWarning="true"
1611
stopOnError="false"
1712
stopOnFailure="false"
1813
stopOnIncomplete="false"
1914
stopOnSkipped="false"
20-
verbose="true">
15+
cacheDirectory=".phpunit.cache"
16+
beStrictAboutCoverageMetadata="true">
2117

22-
<coverage includeUncoveredFiles="true" processUncoveredFiles="true">
23-
<include>
24-
<directory suffix=".php">./src/</directory>
25-
</include>
26-
<exclude>
27-
<directory suffix=".php">./src/Commands/Generators</directory>
28-
<directory suffix=".php">./src/Commands/Utils</directory>
29-
<directory suffix=".php">./src/Config</directory>
30-
</exclude>
18+
<coverage includeUncoveredFiles="true">
3119
<report>
3220
<clover outputFile="build/phpunit/clover.xml"/>
3321
<html outputDirectory="build/phpunit/html"/>
@@ -44,27 +32,11 @@
4432
</testsuites>
4533

4634
<extensions>
47-
<extension class="Nexus\PHPUnit\Extension\Tachycardia">
48-
<arguments>
49-
<array>
50-
<element key="timeLimit">
51-
<double>0.50</double>
52-
</element>
53-
<element key="reportable">
54-
<integer>30</integer>
55-
</element>
56-
<element key="precision">
57-
<integer>2</integer>
58-
</element>
59-
<element key="collectBare">
60-
<boolean>true</boolean>
61-
</element>
62-
<element key="tabulate">
63-
<boolean>true</boolean>
64-
</element>
65-
</array>
66-
</arguments>
67-
</extension>
35+
<bootstrap class="Nexus\PHPUnit\Tachycardia\TachycardiaExtension">
36+
<parameter name="time-limit" value="0.50"/>
37+
<parameter name="report-count" value="30"/>
38+
<parameter name="format" value="table"/>
39+
</bootstrap>
6840
</extensions>
6941

7042
<logging>
@@ -100,4 +72,14 @@
10072
<env name="database.tests.DBPrefix" value="tests_"/>
10173
-->
10274
</php>
75+
<source>
76+
<include>
77+
<directory suffix=".php">./src/</directory>
78+
</include>
79+
<exclude>
80+
<directory suffix=".php">./src/Commands/Generators</directory>
81+
<directory suffix=".php">./src/Commands/Utils</directory>
82+
<directory suffix=".php">./src/Config</directory>
83+
</exclude>
84+
</source>
10385
</phpunit>

rector.php

-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
2828
use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
2929
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
30-
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
3130
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
3231
use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\AnnotationWithValueToAttributeRector;
3332
use Rector\PHPUnit\AnnotationsToAttributes\Rector\ClassMethod\DataProviderAnnotationToAttributeRector;
@@ -82,7 +81,6 @@
8281
$rectorConfig->skip([
8382
__DIR__ . '/app/Views',
8483

85-
JsonThrowOnErrorRector::class,
8684
StringifyStrNeedlesRector::class,
8785
YieldDataProviderRector::class,
8886

0 commit comments

Comments
 (0)