Fix invalid code coverage target attributes in tests - #56
Merged
Conversation
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).
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 ☂️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.#[CoversClass]/#[CoversMethod]pointed atConnectionInterface,AdapterInterface,SchemaAwareInterface,PdoConnectionInterfaceinstead 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.DriverTestreferencedDriver::getDatabasePlatformName, a method that doesn't exist anywhere in this codebase or thephp-db/phpdbdependency. Removed.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-testjobs 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.