Skip to content

Commit 79edb80

Browse files
authored
Merge pull request #2406 from jdecool/phpunit-compatibility
Add PHPUnit bridge compatibility with PHPUnit 11/12/13
2 parents 046214a + 75a9dd9 commit 79edb80

5 files changed

Lines changed: 73 additions & 3 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: PHPUnit Telemetry Bridge Tests
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
tests:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 15
13+
services:
14+
postgres:
15+
image: postgres:18-alpine
16+
env:
17+
POSTGRES_USER: postgres
18+
POSTGRES_PASSWORD: postgres
19+
POSTGRES_DB: postgres
20+
ports:
21+
- 5432/tcp
22+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
phpunit-version:
27+
- "11"
28+
- "12"
29+
- "13"
30+
php-version:
31+
- "8.3"
32+
- "8.4"
33+
- "8.5"
34+
exclude:
35+
# PHPUnit 13 requires PHP >= 8.4.1.
36+
- phpunit-version: "13"
37+
php-version: "8.3"
38+
39+
steps:
40+
- name: "Checkout"
41+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
42+
with:
43+
persist-credentials: false
44+
45+
- name: "Setup PHP Environment"
46+
uses: "./.github/actions/setup-php-env"
47+
with:
48+
php-version: "${{ matrix.php-version }}"
49+
dependencies: "locked"
50+
extensions: ':psr, bcmath, dom, hash, json, mbstring, xml, xmlwriter, xmlreader, zlib, curl, pgsql, grpc, protobuf'
51+
ini-values: 'memory_limit=-1'
52+
apt-packages: "build-essential autoconf automake libtool protobuf-compiler libprotobuf-c-dev"
53+
pie-extensions: "flow-php/pg-query-ext:1.x-dev"
54+
55+
- name: "Install PHPUnit ${{ matrix.phpunit-version }}"
56+
if: ${{ matrix.phpunit-version != '11' }}
57+
run: |
58+
composer require --working-dir=tools/phpunit --no-interaction --no-progress -W \
59+
"phpunit/phpunit:^${{ matrix.phpunit-version }}"
60+
61+
- name: "Show PHPUnit version"
62+
run: tools/phpunit/vendor/bin/phpunit --version
63+
64+
- name: "Test"
65+
run: just test --testsuite bridge-phpunit-postgresql-unit,bridge-phpunit-postgresql-integration,bridge-phpunit-telemetry-unit
66+
env:
67+
PGSQL_DATABASE_URL: pgsql://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports['5432'] }}/postgres?serverVersion=11&charset=utf8

.github/workflows/test-suite.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ jobs:
4242
secrets:
4343
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4444

45+
phpunit-telemetry-tests:
46+
uses: ./.github/workflows/job-phpunit-telemetry-tests.yml
47+
4548
extension-tests:
4649
uses: ./.github/workflows/job-extension-tests.yml
4750
secrets:

src/bridge/phpunit/postgresql/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"require": {
1616
"php": "~8.3.0 || ~8.4.0 || ~8.5.0",
1717
"flow-php/postgresql": "self.version",
18-
"phpunit/phpunit": "^11"
18+
"phpunit/phpunit": "^11 || ^12 || ^13"
1919
},
2020
"autoload": {
2121
"psr-4": {

src/bridge/phpunit/telemetry/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"php": "~8.3.0 || ~8.4.0 || ~8.5.0",
1818
"flow-php/telemetry": "self.version",
1919
"flow-php/telemetry-otlp-bridge": "self.version",
20-
"phpunit/phpunit": "^11"
20+
"phpunit/phpunit": "^11 || ^12 || ^13"
2121
},
2222
"require-dev": {
2323
"google/protobuf": "^4.0 || ^5.0",

src/bridge/phpunit/telemetry/tests/Flow/Bridge/PHPUnit/Telemetry/Tests/Mother/TestEventMother.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private static function createInfo(): Info
4646
HRTime::fromSecondsAndNanoseconds(0, 0),
4747
MemoryUsage::fromBytes(0),
4848
MemoryUsage::fromBytes(0),
49-
new GarbageCollectorStatus(0, 0, 0, 0, null, null, null, null, null, null, null, null),
49+
new GarbageCollectorStatus(0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, false, false, false, 0),
5050
),
5151
Duration::fromSecondsAndNanoseconds(0, 0),
5252
MemoryUsage::fromBytes(0),

0 commit comments

Comments
 (0)