infection/abstract-testframework-adapter
Interfaces and base classes for building Infection test framework adapters. Provides a common abstraction layer to integrate different PHP test runners with Infection’s mutation testing, making adapters consistent, reusable, and easier to implement.
The package serves as a critical abstraction layer for Infection’s mutation testing framework, enabling support for multiple PHP test frameworks (PHPUnit, Pest, etc.) under a unified interface. The addition of HasSyntaxErrorDetection (v0.5.0) addresses a growing pain point in mutation testing: distinguishing syntax errors (e.g., ParseError) from test failures, which is essential for CI/CD reliability. However, its niche focus (only relevant to Infection) limits broader architectural value. The package’s design aligns with dependency inversion principles, allowing Infection to decouple from framework-specific implementations while maintaining extensibility.
High for Infection-based projects but low for standalone Laravel/PHP applications. The package is not a standalone tool—it’s a dependency for custom Infection adapters (e.g., infection/PHPUnit-adapter). Integration requires:
AbstractTestFrameworkAdapter to implement framework-specific logic.HasSyntaxErrorDetection for syntax error handling.TestResult objects, process execution).Moderate-High due to:
phpunit/phpunit) may introduce vulnerabilities or breaking changes.HasSyntaxErrorDetection interact with modern PHP error handling (e.g., Throwable, Error classes)?Only relevant for Infection mutation testing workflows. The package is not a Laravel-first solution but can be leveraged in:
infection/infection (which may indirectly depend on this package).
Misalignment:Artisan commands, ServiceProvider integration).infection/infection (not this package) is already in use. If yes, this package may be transitively included—no direct action needed.composer require infection/abstract-testframework-adapter
AbstractTestFrameworkAdapter:
TestFrameworkAdapterInterface (e.g., runTests(), getName()).HasSyntaxErrorDetection for syntax error parsing.infection.json:
{
"test_framework": "Your\\Custom\\Adapter"
}
HasSyntaxErrorDetection) against known edge cases (e.g., malformed test files).| Component | Risk Level | Notes |
|---|---|---|
| PHP | Low | Officially supports PHP 8.0+ (v0.3.1). Untested on PHP 8.2+. |
| Infection | High | No version guarantees. Test with Infection v1.0+. |
| Test Frameworks | Medium | Supports PHPUnit/Pest but no confirmation for Pest 2.0+. |
| Laravel | High | No Laravel integration. Requires manual CLI workflows. |
infection/infection, this package is transitive—no direct action needed.HasSyntaxErrorDetection: Test the new interface in a non-critical branch before CI/CD adoption.AbstractTestFrameworkAdapter requires minimal boilerplate.HasSyntaxErrorDetection may need framework-specific parsing logic (e.g., regex for ParseError in PHPUnit XML).phpunit/phpunit vulnerabilities).Throwable changes could invalidate error parsing.HasSyntaxErrorDetection may misclassify legitimate test failures as syntax errors.symfony/process) may introduce security risks.How can I help you explore Laravel packages today?