infection/abstract-testframework-adapter
Shared abstractions for Infection test framework adapters. Provides the TestFrameworkAdapter and TestFrameworkAdapterFactory interfaces so custom adapters can translate Infection's test execution requests into target framework commands and return collected test locations.
Architecture fit: This is a low-level abstraction package that defines the contracts (TestFrameworkAdapterInterface, AbstractTestFrameworkAdapter) Infection's mutation testing engine uses to talk to any PHP test framework (PHPUnit, Pest, ParaTest). It is not a feature product — it is an internal seam that makes Infection framework-agnostic. For a Laravel/PHP team, the only scenario where this package enters your architecture is when you are either (a) writing a custom Infection adapter for a test framework Infection doesn't natively support (e.g., a bespoke in-house runner, a legacy PHPUnit fork), or (b) maintaining a fork/vendored copy of Infection. Direct application code should never depend on it.
Integration feasibility: High technical feasibility, low product feasibility. The surface is small: extend AbstractTestFrameworkAdapter, implement runTests(), getName(), checkVersion(), and (since 0.5.0) optionally hasSyntaxError() via the new HasSyntaxErrorDetection interface. Boilerplate is limited and the abstraction handles process spawning, config generation, and exit-code mapping. The blocker is not implementation difficulty — it's whether you need it at all. With 25 stars and zero declared dependents, you are adopting a package whose real consumer base is the Infection maintainers themselves.
Technical risk: High, concentrated in three areas.
CoverageLineData → TestLocation and removed JUNIT_FILE_NAME; 0.4.0 added a BC-breaking checkVersion() requirement). The package has historically shipped BC breaks in minor versions, and the roadmap is opaque.checkVersion() was added to let adapters declare minimum framework versions, but the contract itself changes shape over time. Any custom adapter you write is exposed to both Infection's and this package's version bumps.The one genuine addition here (0.5.0's HasSyntaxError interface) is a small but real capability: it lets adapters distinguish ParseError-style output from ordinary test failures, which reduces false-negative mutation results and flaky CI signal. That's valuable if you own an adapter; it is irrelevant otherwise.
Key questions to resolve before any commitment:
composer.json — this determines whether the package is a durable seam or a legacy shim.infection/phpunit-adapter or infection/pest-adapter directly and never touch the abstract layer.HasSyntaxError contract handle PHP 8.x Throwable/ParseError output the way our framework emits it? Needs empirical verification, not docs reading.Stack fit: Narrow. In a Laravel codebase the relevant stack is Laravel + Pest/PHPUnit + Infection. In that combination you use Infection's official adapters and this package is a transitive, invisible dependency — correct behavior is to pin it and ignore it. The package only becomes a first-class dependency in two cases: (1) you are extending or forking Infection itself, or (2) you have a custom test runner (e.g., a proprietary testing DSL, a Dusk-style browser runner, or a legacy framework being strangled) that you want mutation-tested.
Migration path (only if adopting as a direct dependency):
infection/infection, infection/phpunit-adapter (or Pest equivalent), PHP, and this package together in a throwaway branch. Get a green mutation run before writing any adapter code.AbstractTestFrameworkAdapter, implement getName() and runTests() only, and validate against a real test suite in a separate consumer project (this package has no meaningful test suite of its own; your adapter is the test).checkVersion() — declare the minimum framework version you support so Infection fails loudly on drift rather than silently mis-parsing.HasSyntaxErrorDetection — treat as an enhancement, not a launch requirement. Validate that it doesn't misfire on warnings, deprecations, or suppressed errors.Compatibility: Assume backward compatibility to PHP 7.4 per the release notes; PHP 8.2+ is untested by the maintainers. The 0.4.0 checkVersion() addition is the compatibility escape hatch — use it. Result-parsing is the fragile zone: PHPUnit 9.6 → 10+ changed output formats materially (attributes, JSON structure), so branch parsing on getVersion() and keep a fixture-based regression suite of captured framework output.
Sequencing: (1) confirm Infection is already adopted, (2) confirm the framework gap, (3) prototype adapter against a single small test suite, (4) harden with version sniffing and syntax-error detection, (5) only then roll into CI. Do not sequence this ahead of an Infection rollout — it has no standalone value.
Maintenance: Low ongoing code cost, elevated ongoing risk cost. The adapter itself is a few hundred lines. The real cost is tracking Infection releases, framework output-format changes, and PHP minor versions in a package whose release cadence and BC discipline are unpredictable (multiple minor-version BC breaks in its own short history). Budget roughly one engineer-day per Infection major and per test-framework major to re-validate parsing.
Support: Effectively self-support. 25 stars, no community forum, no active discussion surface. If the maintainer steps back, your fallback is forking — which is viable because the package is small, but only if you've kept your adapter decoupled. Treat "we can vendor it" as the actual support contract.
Scaling: Not a scaling concern in the conventional sense. It doesn't serve traffic or hold state; it impacts throughput only indirectly, via whether mutation runs are accurate (false syntax-error classification corrupts results) and whether adapters can be parallelized. Note the adapter layer does not manage concurrency — if you run mutation tests in parallel, that is yours to arrange and to de-risk against flaky framework output.
Failure modes to design for:
checkVersion(), golden-fixture parsing tests, and a fail-loud contract on unrecognized output.HasSyntaxErrorDetection returns incorrect true/false, corrupting mutation scores. Mitigation: only enable after validating against real ParseError samples; be conservative.Ramp-up: Engineer ramp-up is roughly half a day to a day for someone comfortable with PHPUnit internals and Composer — the interfaces are small and self-documenting. The harder ramp is organizational: getting the team to accept a lightly-maintained abstraction under their CI pipeline. Recommendation for a TPM: do not adopt as a direct dependency unless you have a genuine framework gap. If you do, treat it as an experimental, isolated integration with a named owner and a documented exit path — forked copy in-repo — and revisit the decision at each Infection major. If you're a standard Laravel + Pest/PHPUnit shop, use Infection's official adapters, pin this transitively, and spend zero roadmap attention on it.
How can I help you explore Laravel packages today?