Skip to content

Commit cf4dcd1

Browse files
authored
Merge pull request #67 from cakephp/2.x-phpunit10
2.x: upgrade to PHPUnit 10 and stan upgrade
2 parents 67f6c34 + 56f838e commit cf4dcd1

6 files changed

Lines changed: 69 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,42 @@ permissions:
1414

1515
jobs:
1616
testsuite:
17-
uses: cakephp/.github/.github/workflows/testsuite-without-db.yml@5.x
18-
secrets: inherit
17+
runs-on: ubuntu-22.04
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
php-version: ['8.1']
22+
dependencies: ['highest']
23+
include:
24+
- php-version: '8.1'
25+
dependencies: 'lowest'
26+
- php-version: '8.2'
27+
dependencies: 'highest'
28+
29+
steps:
30+
- uses: actions/checkout@v3
31+
32+
- name: Setup PHP
33+
uses: shivammathur/setup-php@v2
34+
with:
35+
php-version: ${{ matrix.php-version }}
36+
extensions: mbstring, intl
37+
ini-values: zend.assertions=1
38+
coverage: pcov
39+
40+
- name: Composer install
41+
uses: ramsey/composer-install@v2
42+
with:
43+
dependency-versions: ${{ matrix.dependencies }}
44+
composer-options: ${{ matrix.composer-options }}
45+
46+
- name: Run PHPUnit
47+
run: |
48+
if [[ ${{ matrix.php-version }} == '8.1' && ${{ matrix.dependencies }} == 'highest' ]]; then
49+
vendor/bin/phpunit --display-incomplete --display-skipped
50+
else
51+
vendor/bin/phpunit
52+
fi
1953
2054
cs-stan:
2155
uses: cakephp/.github/.github/workflows/cs-stan.yml@5.x

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/vendor
22
/composer.lock
3+
/tools
34
.phpunit.result.cache

.phive/phars.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phive xmlns="https://phar.io/phive">
3+
<phar name="phpstan" version="1.10.14" installed="1.10.14" location="./tools/phpstan" copy="false"/>
4+
<phar name="psalm" version="5.10.0" installed="5.10.0" location="./tools/psalm" copy="false"/>
5+
</phive>

composer.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"require-dev": {
1717
"cakephp/cakephp-codesniffer": "^5.0",
1818
"composer/composer": "^2.0",
19-
"phpunit/phpunit": "^9.5.19"
19+
"phpunit/phpunit": "^10.1.0"
2020
},
2121
"autoload": {
2222
"psr-4": {
@@ -37,5 +37,23 @@
3737
"dealerdirect/phpcodesniffer-composer-installer": true
3838
}
3939
},
40-
"prefer-stable": true
40+
"prefer-stable": true,
41+
"scripts": {
42+
"check": [
43+
"@cs-check",
44+
"@test"
45+
],
46+
"cs-check": "phpcs --colors --parallel=16 -p src/ tests/",
47+
"cs-fix": "phpcbf --colors --parallel=16 -p src/ tests/",
48+
"phpstan": "tools/phpstan analyse",
49+
"psalm": "tools/psalm --show-info=false",
50+
"stan": [
51+
"@phpstan",
52+
"@psalm"
53+
],
54+
"stan-tests": "phpstan.phar analyze -c tests/phpstan.neon",
55+
"stan-baseline": "phpstan.phar --generate-baseline",
56+
"stan-setup": "phive install",
57+
"test": "phpunit"
58+
}
4159
}

phpunit.xml.dist

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<phpunit
4-
colors="true"
5-
bootstrap="vendor/autoload.php"
6-
>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
colors="true"
4+
bootstrap="vendor/autoload.php"
5+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd">
76
<testsuites>
87
<testsuite name="plugin-installer">
98
<directory>tests/TestCase/</directory>

psalm.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
<psalm
33
errorLevel="2"
44
resolveFromConfigFile="true"
5+
findUnusedPsalmSuppress="true"
6+
findUnusedBaselineEntry="true"
7+
findUnusedCode="false"
58
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
69
xmlns="https://getpsalm.org/schema/config"
710
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"

0 commit comments

Comments
 (0)