Skip to content

test: kill escaped mutants - #20

Merged
roxblnfk merged 9 commits into
1.xfrom
test/kill-mutants
Nov 20, 2026
Merged

roxblnfk merged 9 commits into
1.xfrom
test/kill-mutants

Conversation

@roxblnfk

@roxblnfk roxblnfk commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

What was changed

Tests only, plus the Infection gate: the mutation score goes from 57.87% (407 escaped of 966) to 92.58% (78 escaped of 1059) on Linux, and minMsi / minCoveredMsi go from 54 to 90.

  • Unit/HarnessTest runs the package's own Feature and Acceptance suites, and fixture suites under tests/Fixtures/HarnessSuite, in a nested Testo application: isolation modes, purge at suite start, prepare, unreachable and required databases, function tests, the heap check and its opt-outs.
  • New or extended unit tests for HeapIntegrity, the new-case command, CaseGenerator, TemplateSet, SchemaAssert, SqlAssert, QueryAssert, Config, Env, ConnectionPool, TableRenderer, TableBuilder, Purger, Driver / Feature, the driver filters, Layout, QueryLog, OrmFactory, SchemaSource and ClassList.
  • Eight equivalent mutants are ignored in infection.json: limit: 1 raised to 2 on attributes that are not repeatable, array_values() in DatabaseInterceptor::connections() (only iterated), and the && / || swaps in HeapIntegrity::equals() that end in the \Error it already catches.

Review notes

  • The interceptors run around each test, outside its coverage window, so the Feature tests that check isolation never counted for them; only a run nested inside a test (HarnessTest, like the existing OrmPluginTest) kills their mutants.
  • A test must not write to the real STDERR: Infection's initial run then ends with exit code 143. The legacy DB variable test runs in a child process for that reason.
  • Not fixed here: HeapIntegrity::equals() catches \Error around == on recursive graphs, but before PHP 8.4 that comparison is a fatal error, not an \Error, so a heap holding such a graph kills the run on 8.2 and 8.3; its test is skipped there.
  • Not fixed here: with DropTables isolation on a file-based SQLite database, TEMP tables survive from one test to the next, since the purge lists only the main schema's tables (an in-memory database is reconnected and loses them).
  • Left escaped, by file: Config 17 (mostly the Codecov plugin wiring, only visible in a coverage run, and spread mutants on single-item lists), FakePDOStatement 10, SqlAssert 8 (quote fallbacks no driver reaches), ConnectionPool 7 (memo-key concatenations that stay unique), Purger 6 (MySQL, Postgres and SQL Server arms, unreachable on SQLite), SchemaCompiler 4, DatabaseInterceptor 3, StubDriver 3, TableRenderer 3, OrmPlugin 2, OrmTestCase 2, and one each in 13 other files.

Why?

The tests now check what the harness does, not only that it runs, so CI catches a regression in isolation, purging or the assertions.

Checklist

  • Tested
    • Infection on Linux (PHP 8.4 in Docker): MSI 92.58%, covered MSI the same
    • Unit, Feature/SQLite and Acceptance/SQLite pass on Windows

@roxblnfk
roxblnfk requested a review from a team November 20, 2026 18:26
@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 89.70%. Comparing base (38868d1) to head (ab04520).

Additional details and impacted files
@@            Coverage Diff             @@
##              1.x      #20      +/-   ##
==========================================
+ Coverage   81.53%   89.70%   +8.17%     
==========================================
  Files          43       43              
  Lines        1029     1030       +1     
==========================================
+ Hits          839      924      +85     
+ Misses        190      106      -84     
Flag Coverage Δ
mysql 56.67% <ø> (+0.78%) ⬆️
postgres 56.18% <ø> (+0.78%) ⬆️
sqlite 55.30% <ø> (+0.78%) ⬆️
sqlserver 57.26% <ø> (+0.78%) ⬆️
unit 89.24% <ø> (+23.46%) ⬆️

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.

…k the interceptors

The interceptors work around each test, outside its coverage window, so the feature tests that check isolation never counted for them.

Assisted-By: Claude Opus 5.5
…query log and the wrap driver

test(orm): cover the ORM factory defaults and schema source reuse

Assisted-By: Claude Opus 5.5
Assisted-By: Claude Opus 5.5
The ignored mutants change nothing observable: the attributes fetched with limit 1 are not repeatable, connections() is only iterated, and comparing the classes of a non-object throws an Error that equals() already turns into false.

Assisted-By: Claude Opus 5.5
@roxblnfk
roxblnfk merged commit 91610eb into 1.x Nov 20, 2026
22 checks passed
@roxblnfk
roxblnfk deleted the test/kill-mutants branch November 20, 2026 18:50
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