testo/bridge-infection
Infection mutation testing bridge for Testo. Lets Infection run Testo as the test framework, mapping per-mutant execution to Testo’s --filter/--teamcity options and using PHPUnit-style coverage XML from testo/codecov. Auto-discovered via extension-installer.
--filter, --teamcity).testo/codecov to generate PHPUnit-style XML, ensuring Infection can attribute mutants to specific tests—a non-negotiable for actionable mutation reports. This aligns with Laravel’s test-first culture, where coverage metrics (e.g., via phpunit-coverage) are often prioritized.infection/extension-installer, reducing friction for teams already using Testo. The zero-config approach ("testFramework": "testo" in infection.json) mirrors Laravel’s convention-over-configuration philosophy.testo/laravel, this bridge extends mutation testing to Laravel’s ecosystem without reinventing the wheel. Key Laravel-specific concerns (e.g., service providers, HTTP tests) are abstracted by Testo’s adapter layer.testo/laravel) must handle Infection’s per-mutant bootstrapping. Risks include:
include-interceptor may conflict with Laravel’s autoloader or service binding order.RefreshDatabase or RefreshMigrations traits may not behave identically across mutants, leading to flaky results.--threads) may clash with Laravel’s stateful tests (e.g., database transactions). Teams must validate thread-safety or disable parallelism.testo/codecov must be configured to generate XML compatible with Infection’s expectations. Laravel projects using phpunit-coverage or xdebug may need adjustments to avoid format mismatches.infection/include-interceptor (v1+) and infection/extension-installer. Version skew could break Testo’s assumption of Infection’s contract (e.g., mutant injection timing).--filter or coverage XML schema may evolve, requiring bridge updates.actingAs(), assertSession()) may not translate cleanly to mutation testing.--teamcity or --verbose logs.RefreshDatabase, actingAs())? If yes, how will Infection’s per-mutant isolation handle these?testo/codecov already generating PHPUnit-style XML? If not, what are the migration steps?infection/include-interceptor (v1+) and infection/extension-installer installed? What are their versions?--teamcity output integrate with existing CI tools (e.g., GitHub Actions, Jenkins)?infection/phpunit instead).testo/laravel is already integrated, this bridge adds mutation testing with minimal changes.phpunit-coverage or xdebug may need to adopt testo/codecov for compatibility.Prerequisite: Testo Adoption
testo/laravel for Laravel-specific features.testo/codecov and configure for PHPUnit-style XML output.
composer require --dev testo/codecov
Update testo.yaml:
coverage:
driver: xdebug
output: coverage.xml # PHPUnit-style format
Bridge Installation
composer require --dev testo/bridge-infection
vendor/infection/extension-installer for Testo detection.Infection Configuration
infection.json:
{
"testFramework": "testo",
"include": ["tests/Unit", "tests/Feature"],
"threads": 2, // Adjust based on CI resources
"minimumMutationScore": 90,
"timeLimit": 300 // 5-minute timeout per mutant
}
.env.testing):
"environmentVariables": {
"APP_ENV": "testing",
"DB_CONNECTION": "sqlite"
}
Validation
vendor/bin/infection --threads=1 --filter="TestLogin"
CI/CD Integration
- name: Mutation Testing
run: vendor/bin/infection --threads=4 --timeLimit=600
| Component | Compatibility Notes |
|---|---|
| Testo Version | Must match Infection’s supported versions (check infection/extension-installer docs). |
| PHP Version | Testo requires PHP 8.1+; Infection supports 8.0+. Align if using PHP 8.0. |
| Infection Plugins | infection/include-interceptor (v1+), infection/extension-installer required. |
| Laravel | Testo/Laravel adapter must handle Infection’s per-mutant bootstra |
How can I help you explore Laravel packages today?