Skip to content

test: raise line coverage - #25

Merged
roxblnfk merged 3 commits into
1.xfrom
test/coverage-100
Nov 20, 2026
Merged

roxblnfk merged 3 commits into
1.xfrom
test/coverage-100

Conversation

@roxblnfk

@roxblnfk roxblnfk commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

What was changed

  • Acceptance: the template cases are generated through Command (new-case) and run from a regression suite built with Config, the documented user flow, on every driver.
  • Unit: inline tests run through a driver suite untouched; OrmPlugin without a database plugin leaves tests alone; HeapIntegrity reports a heap entity that has no node (a custom HeapInterface).

Why?

Line coverage: Codecov 98.64% → 99.51% (14 → 5 missed lines, the five listed below). Config and Command run only in the Unit suite, so every driver flag reported some of their lines (constructor signatures, inner lines of multi-line calls) from static analysis, and Codecov counted them as missed. Locally with pcov on PHP 8.5, Unit + SQLite merged the way Codecov does: 1060/1086 → 1064/1081, with the Purger lines below covered by the server suites in CI.

Checklist

  • Closes: no issue
  • Tested
    • composer test:unit and composer test:sqlite pass locally; the server suites run in CI only
    • Unit tests added
  • Documentation: not needed

Review notes

Left uncovered, with the reason:

  • Purger 62-64 and 99-111: MySQL and SQL Server only; Feature/Common/PurgerTest covers them in CI.
  • Env::drivers() 105-106, the deprecated DB variable: tested in a child process, because the notice goes to the real STDERR, which Infection's run of the suite does not tolerate; the child's coverage is not collected.
  • ContextInjectingInstance::hasInstance() 38: only testo/bench calls it, and DatabaseInterceptor wraps the instance of test cases only, so no suite reaches it.
  • Isolate 15 and FakePDOStatement 25, constructor signatures: pcov artefacts. Both classes are executed only in the Unit suite (the attribute is instantiated by the harness outside a test's coverage window), so the driver flags report the line from static analysis, which pcov never reports for executed code.

Bug, src left alone:

  • QueryLog::log() skips a message with empty($context['elapsed']), and the driver's elapsed is microtime(true) - $queryStart, which is 0.0 when a query finishes within the clock's resolution. Such a query is not counted, so assertNumReads() and assertNumWrites() flake: the first CI run of this PR failed QueryCountersTest::countsSinceTheCapture (nested in HarnessTest::featureSuitePassesOnSqlite, PHP 8.2) with "expected 1 got 0" reads, and passed on rerun. Checking isset() / array_key_exists() instead of empty() fixes it.

… the harness

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
A custom HeapInterface can iterate an entity it holds no node for.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
The acceptance test now follows the documented flow, new-case then a regression suite from Config, so every driver suite runs both and Codecov no longer counts their lines from static analysis.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@roxblnfk
roxblnfk requested a review from a team November 20, 2026 20:32
@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.51%. Comparing base (fc7c08c) to head (2b71cd6).
⚠️ Report is 1 commits behind head on 1.x.

Additional details and impacted files
@@            Coverage Diff             @@
##              1.x      #25      +/-   ##
==========================================
+ Coverage   98.64%   99.51%   +0.87%     
==========================================
  Files          43       43              
  Lines        1030     1025       -5     
==========================================
+ Hits         1016     1020       +4     
+ Misses         14        5       -9     
Flag Coverage Δ
mysql 66.17% <ø> (+6.94%) ⬆️
postgres 65.68% <ø> (+6.94%) ⬆️
sqlite 64.80% <ø> (+6.94%) ⬆️
sqlserver 66.86% <ø> (+6.94%) ⬆️
unit 98.63% <ø> (+0.39%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@roxblnfk
roxblnfk merged commit 247bbbf into 1.x Nov 20, 2026
37 of 38 checks passed
@roxblnfk
roxblnfk deleted the test/coverage-100 branch November 20, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant