Skip to content

Commit 3cafe33

Browse files
Fix PHPUnit coverage warnings in CI
- Remove XDEBUG_MODE from composer scripts to avoid redundancy - Update workflows to explicitly set XDEBUG_MODE=coverage when coverage is needed - Use --no-coverage flag when xdebug is not installed to prevent warnings - This fixes 'No code coverage driver available' warning causing CI failures
1 parent 22f9ebe commit 3cafe33

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

.github/workflows/integration-tests.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,18 @@ jobs:
130130
PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SELECT PostGIS_Version();"
131131
132132
- name: Run integration test suite
133-
run: composer run-integration-tests
133+
run: |
134+
if [ "${{ matrix.calculate-code-coverage }}" = "true" ]; then
135+
XDEBUG_MODE=coverage composer run-integration-tests
136+
else
137+
composer run-integration-tests -- --no-coverage
138+
fi
134139
env:
135140
POSTGRES_HOST: localhost
136141
POSTGRES_PORT: 5432
137142
POSTGRES_DB: postgres_doctrine_test
138143
POSTGRES_USER: postgres
139144
POSTGRES_PASSWORD: postgres
140-
XDEBUG_MODE: ${{ matrix.calculate-code-coverage == true && 'coverage' || 'off' }}
141145

142146
- name: Upload coverage results to Coveralls
143147
if: matrix.calculate-code-coverage == true

.github/workflows/unit-tests.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,12 @@ jobs:
110110
continue-on-error: ${{ matrix.continue-on-error || false }}
111111

112112
- name: Run unit test suite
113-
run: composer run-unit-tests
114-
env:
115-
XDEBUG_MODE: ${{ matrix.calculate-code-coverage == true && 'coverage' || 'off' }}
113+
run: |
114+
if [ "${{ matrix.calculate-code-coverage }}" = "true" ]; then
115+
XDEBUG_MODE=coverage composer run-unit-tests
116+
else
117+
composer run-unit-tests -- --no-coverage
118+
fi
116119
117120
- name: Upload coverage results to Coveralls
118121
if: matrix.calculate-code-coverage == true

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@
7272
"phpstan analyse --configuration=./ci/phpstan/config.neon"
7373
],
7474
"phpunit:unit": [
75-
"XDEBUG_MODE=${XDEBUG_MODE:-coverage} phpunit --configuration=./ci/phpunit/config-unit.xml"
75+
"phpunit --configuration=./ci/phpunit/config-unit.xml"
7676
],
7777
"phpunit:integration": [
78-
"XDEBUG_MODE=${XDEBUG_MODE:-coverage} phpunit --configuration=./ci/phpunit/config-integration.xml"
78+
"phpunit --configuration=./ci/phpunit/config-integration.xml"
7979
],
8080
"rector": [
8181
"rector --config=./ci/rector/config.php --ansi --no-progress-bar"

0 commit comments

Comments
 (0)