Skip to content

Commit a24b994

Browse files
loks0nclaude
andauthored
Hoist phpunit to the monorepo toolchain (#3)
One phpunit (^12) pinned in the root composer.json; packages no longer declare it. Package test scripts call `phpunit`, resolved from the root vendor/bin which bin/monorepo puts on PATH; mirror workflows get it via setup-php's tools input. Migrates the phpunit 9 era leftovers: cli and platform phpunit.xml schemas, cli's @dataProvider annotation to an attribute. cli's mirror test matrix moves to 8.3-8.5 (phpunit 12 needs >=8.3). bin/monorepo absorb now strips phpunit and rewrites test scripts for incoming libraries. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 8a5f866 commit a24b994

3 files changed

Lines changed: 8 additions & 1760 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
with:
2121
php-version: ${{ matrix.php }}
2222
extensions: swoole
23+
tools: phpunit
2324
coverage: ${{ matrix.php == '8.3' && 'pcov' || 'none' }}
2425

2526
- name: Get composer cache directory
@@ -37,11 +38,11 @@ jobs:
3738

3839
- name: Run unit tests
3940
if: matrix.php != '8.3'
40-
run: vendor/bin/phpunit --configuration phpunit.xml --testsuite unit
41+
run: phpunit --configuration phpunit.xml --testsuite unit
4142

4243
- name: Run unit tests with coverage
4344
if: matrix.php == '8.3'
44-
run: vendor/bin/phpunit --configuration phpunit.xml --testsuite unit --coverage-text --coverage-clover coverage.xml
45+
run: phpunit --configuration phpunit.xml --testsuite unit --coverage-text --coverage-clover coverage.xml
4546

4647
- name: Upload coverage artifact
4748
if: matrix.php == '8.3' && always()
@@ -67,6 +68,7 @@ jobs:
6768
with:
6869
php-version: '8.4'
6970
extensions: swoole
71+
tools: phpunit
7072
coverage: none
7173

7274
- name: Install dependencies
@@ -76,7 +78,7 @@ jobs:
7678
run: docker compose up -d --build --wait ${{ matrix.adapter.id }}
7779

7880
- name: Run E2E tests
79-
run: vendor/bin/phpunit --configuration phpunit.xml --testsuite e2e-${{ matrix.adapter.id }}
81+
run: phpunit --configuration phpunit.xml --testsuite e2e-${{ matrix.adapter.id }}
8082

8183
- name: Dump container logs on failure
8284
if: failure()

composer.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
}
2323
},
2424
"scripts": {
25-
"test": "vendor/bin/phpunit --configuration phpunit.xml --testsuite unit",
26-
"test:e2e": "vendor/bin/phpunit --configuration phpunit.xml --testsuite e2e-fpm,e2e-swoole"
25+
"test": "phpunit --configuration phpunit.xml --testsuite unit",
26+
"test:e2e": "phpunit --configuration phpunit.xml --testsuite e2e-fpm,e2e-swoole"
2727
},
2828
"require": {
2929
"php": ">=8.3",
@@ -48,8 +48,6 @@
4848
}
4949
},
5050
"require-dev": {
51-
"doctrine/instantiator": "^1.5",
52-
"phpunit/phpunit": "^12.0",
5351
"swoole/ide-helper": "4.8.3"
5452
}
5553
}

0 commit comments

Comments
 (0)