raneomik / infection-tester-adapter
Tester Adapter for Infection
Installs: 61
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:infection-extension
pkg:composer/raneomik/infection-tester-adapter
Requires
- php: ^8.3
- ext-dom: *
- infection/abstract-testframework-adapter: ^0.5.0
- infection/include-interceptor: ^0.2.0
- phpunit/php-code-coverage: ^11.0
- symfony/filesystem: ^6.4 || ^7.4 || ^8.0
- symfony/process: ^6.4 || ^7.4 || ^8.0
- symfony/yaml: ^6.4 || ^7.4 || ^8.0
Requires (Dev)
- dg/bypass-finals: ^1.9
- infection/infection: ^0.32
- nette/tester: 2.6.0
- nikic/php-parser: ^5.0
- php-coveralls/php-coveralls: ^2.9
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.1
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpstan/phpstan-webmozart-assert: ^2.0
- phpunit/phpunit: ^9.5 || ^11.0
- rector/rector: ^2.3
- thecodingmachine/safe: ^3.0
Conflicts
- nette/tester: <2.0
README
Disclaimer: AI agent experiment - chat-gpt5.2 & claude sonnet 4.5 wrote ~60-75% of this project, by my lack of knowledge on this topic and lack of time to learn... I thought it would be interesting to ask AI "Hey, I discovered this framework, and it comes with its own testing framework. But I love Infection and its metrics to push you to test your tests, and could be cool to add an adapter to it... Are we in ? - yes, Here's your code" (it wasn't this simple, here's some copilot's very verbose journals & reports for french speakers - it's a real mess, sorry, all dev problems seem to be included) and share the result.
The remaining ~20% was based on PhpSpec Adapter and Codeception Adapter. Big shoutout to Maks Rafalko & Infection community for this amazing tool
This package provides test framework adapter of Tester for infection.
Installation
composer require --dev [infection/infection] raneomik/infection-tester-adapter
The adapter should be automatically registered in Infection's runtime through its auto-discovery mechanism.
Usage
Once installed, you can run Infection:
vendor/bin/infection # optional: --test-framework=tester
Configuration
This adapter works directly with your existing Tester tests, with some limitations:
- Tester provides jUnit.xml and Clover.xml coverage reports, but Infection expects a more complete phpunit-like report. This adapter embeds transformation of Testers' reports & generation during the mutation process, so it is NOT recomended to use
--skip-initial-testswith--coverageoptions (it just results in xpath read/FQCN error, unless you are using a script which does the needed trasformation). - Test cases are recommended for a better report result. But seem slower.
- other forms of tests are supported, but need namespaces to be identified by Infection and referenced in report as covering code.
- conflict with files may occur using
--debugoption and result in mutation coverge gen errors. Removing '<configured tmp dir|/tmp>/infection' should fix it.
No additional configuration needed, "Convention over configuration" principle. ("have tests in 'tests/' dir and bootstrap.php file in your tests root" is the main requirement)
Infection configuration file infection.json5.dist.
For more information on configuring Infection, see the Infection documentation.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
License
This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.
