Skip to content

Fix invalid code coverage target attributes in tests - #56

Merged
tyrsson merged 3 commits into
0.5.xfrom
fix-covers-attributes-target-interfaces
Aug 10, 2026
Merged

Fix invalid code coverage target attributes in tests#56
tyrsson merged 3 commits into
0.5.xfrom
fix-covers-attributes-target-interfaces

Conversation

@tyrsson

@tyrsson tyrsson commented Aug 10, 2026

Copy link
Copy Markdown
Member

What

Fixes invalid code coverage target attributes discovered while verifying #55 (integration test DB hostname fix) — once past that, coverage-enabled test runs started failing with Interface "X" is not a valid target for code coverage.

  1. Interface targets (7 occurrences across 3 files): #[CoversClass]/#[CoversMethod] pointed at ConnectionInterface, AdapterInterface, SchemaAwareInterface, PdoConnectionInterface instead of the concrete classes actually executed. Interfaces have no executable code, so PHPUnit rejects them as coverage targets once a coverage driver is active — invisible until now because coverage was never enabled for these tests before this migration.
  2. Stale reference: DriverTest referenced Driver::getDatabasePlatformName, a method that doesn't exist anywhere in this codebase or the php-db/phpdb dependency. Removed.
  3. Syntax bug: ConnectionTransactionsTest's #[CoversMethod] targets included a trailing () in the method name string (e.g. 'beginTransaction()'), which PHPUnit doesn't strip. Fixed to bare method names.

Why

Blocks the codecov/mutation-test jobs from ever getting real coverage data — the whole point of adding Codecov/Infection in this migration.

Verification

No behavior changes — test bodies untouched, only coverage-attribution metadata. Verified locally: XDEBUG_MODE=coverage vendor/bin/phpunit --testsuite "unit test" now runs clean (90 tests, 204 assertions, zero warnings), down from 29 warnings.

Depends on #55 being merged first (or at least present) since integration tests also hit these same attributes.

tyrsson added 2 commits August 9, 2026 20:23
Several test classes' #[CoversClass]/#[CoversMethod] attributes pointed
at interfaces (ConnectionInterface, AdapterInterface, SchemaAwareInterface,
PdoConnectionInterface) instead of the concrete classes actually executed.
Interfaces have no executable code, so PHPUnit rejects them as coverage
targets once a coverage driver (PCOV/Xdebug) is active - previously
invisible because coverage was never enabled for these tests before this
migration.

Also fixes two unrelated but same-symptom issues found while verifying:
- DriverTest referenced a getDatabasePlatformName method that does not
  exist anywhere in this codebase or its php-db/phpdb dependency (stale
  reference, removed)
- ConnectionTransactionsTest's CoversMethod targets included a trailing
  '()' in the method name string (e.g. 'beginTransaction()'), which
  PHPUnit does not strip

No behavior changes - test bodies are untouched, only coverage-attribution
metadata. Verified locally: XDEBUG_MODE=coverage vendor/bin/phpunit now
runs the full unit suite clean (90 tests, 204 assertions, no warnings).
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@tyrsson
tyrsson merged commit 49e08f4 into 0.5.x Aug 10, 2026
11 of 15 checks passed
@tyrsson tyrsson self-assigned this Aug 10, 2026
@tyrsson tyrsson modified the milestones: 0.6.0, 0.5.0 Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant