Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Bridge Infection Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Mutation Testing Alignment: The package enables Infection to leverage Testo for mutation testing, a critical gap for Laravel/PHP projects migrating from PHPUnit. It bridges Infection’s mutant execution model with Testo’s CLI-driven test runner, preserving Infection’s core functionality while adapting to Testo’s syntax (e.g., --filter, --teamcity).
  • Coverage Integration: Leverages 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.
  • Auto-Discovery: Eliminates manual configuration via 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.
  • Laravel Synergy: If Testo is integrated via 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.

Integration Feasibility

  • Laravel Test Environment: Testo’s Laravel integration (testo/laravel) must handle Infection’s per-mutant bootstrapping. Risks include:
    • Service Provider Loading: Infection’s include-interceptor may conflict with Laravel’s autoloader or service binding order.
    • Test Isolation: Laravel’s RefreshDatabase or RefreshMigrations traits may not behave identically across mutants, leading to flaky results.
  • CI/CD Pipeline: Infection’s parallel execution (--threads) may clash with Laravel’s stateful tests (e.g., database transactions). Teams must validate thread-safety or disable parallelism.
  • Coverage Tooling: 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.
  • Plugin Ecosystem: Relies on infection/include-interceptor (v1+) and infection/extension-installer. Version skew could break Testo’s assumption of Infection’s contract (e.g., mutant injection timing).

Technical Risk

  • Testo Maturity: As a newer framework, Testo’s CLI stability is unproven at scale. Potential risks:
    • Breaking Changes: Testo’s --filter or coverage XML schema may evolve, requiring bridge updates.
    • Edge Cases: Laravel-specific test helpers (e.g., actingAs(), assertSession()) may not translate cleanly to mutation testing.
  • Performance Overhead: Mutation testing adds 30–100x runtime to test suites. Laravel projects with heavy test suites (e.g., feature tests with database interactions) may hit CI timeouts or budget limits.
  • Debugging Complexity: Mutation failures in Testo may produce opaque logs (e.g., JUnit format). Teams will need to correlate Infection’s output with Testo’s --teamcity or --verbose logs.
  • Toolchain Lock-in: Tight coupling to Testo’s output format could complicate future migrations (e.g., switching to Pest or PHPUnit).

Key Questions

  1. Test Framework Strategy:
    • Is Testo the primary testing framework, or is this a secondary mutation-testing layer? If PHPUnit/Pest is primary, the ROI of this bridge diminishes.
    • How does Testo’s test speed compare to PHPUnit/Pest in Laravel? (Critical for CI/CD feasibility.)
  2. Laravel-Specific Risks:
    • Are tests using Laravel’s stateful features (e.g., RefreshDatabase, actingAs())? If yes, how will Infection’s per-mutant isolation handle these?
    • Does the project use custom test helpers (e.g., trait-based assertions) that might break under mutation testing?
  3. CI/CD Constraints:
    • What is the current test suite runtime? Can it accommodate Infection’s overhead (e.g., via parallelism or nightly runs)?
    • Are there budget limits for CI minutes? Mutation testing may require upgrading to faster runners or caching layers.
  4. Coverage and Attribution:
    • Is testo/codecov already generating PHPUnit-style XML? If not, what are the migration steps?
    • How will Infection’s per-test mutant attribution map to Testo’s output? (Validate with a sample mutant.)
  5. Plugin Compatibility:
    • Are infection/include-interceptor (v1+) and infection/extension-installer installed? What are their versions?
    • Are there conflicting Infection plugins (e.g., custom mutant strategies) that could interfere?
  6. Debugging and Observability:
    • How will teams triage mutation failures? Will Testo’s --teamcity output integrate with existing CI tools (e.g., GitHub Actions, Jenkins)?
    • Are there Laravel-specific logs (e.g., query logs, request dumps) needed to debug mutant kills?
  7. Long-Term Maintenance:
    • Who will monitor Testo’s roadmap for breaking changes affecting Infection integration?
    • Is there a fallback plan if Testo’s coverage XML format changes incompatibly?

Integration Approach

Stack Fit

  • Ideal Use Case: Laravel projects fully migrated to Testo as their primary testing framework, seeking to augment test quality with mutation testing.
  • Anti-Patterns:
    • PHPUnit/Pest Primary: If the team is not using Testo, this package offers no value (use infection/phpunit instead).
    • Legacy Laravel: Projects using older Laravel versions (<8.0) or custom test runners may face compatibility issues.
  • Synergy with Laravel Ecosystem:
    • Testo/Laravel: If testo/laravel is already integrated, this bridge adds mutation testing with minimal changes.
    • Coverage Tools: Projects using phpunit-coverage or xdebug may need to adopt testo/codecov for compatibility.
    • CI/CD: Works with Laravel Forge, GitHub Actions, or CircleCI, but requires adjusting timeouts/budgets for mutation runs.

Migration Path

  1. Prerequisite: Testo Adoption

    • Migrate tests from PHPUnit/Pest to Testo (if not already done).
      • Use testo/laravel for Laravel-specific features.
      • Validate test suite runtime and coverage.
    • Install 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
      
  2. Bridge Installation

    • Install the Infection bridge:
      composer require --dev testo/bridge-infection
      
    • Verify auto-discovery by checking vendor/infection/extension-installer for Testo detection.
  3. Infection Configuration

    • Update 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
      }
      
    • Optional: Configure Laravel-specific overrides (e.g., environment variables for .env.testing):
      "environmentVariables": {
        "APP_ENV": "testing",
        "DB_CONNECTION": "sqlite"
      }
      
  4. Validation

    • Run Infection locally with a small test subset to verify integration:
      vendor/bin/infection --threads=1 --filter="TestLogin"
      
    • Check for:
      • Correct mutant injection (no PHP syntax errors).
      • Test attribution in Infection’s output (coverage XML parsing).
      • Laravel environment setup (e.g., service providers loaded).
  5. CI/CD Integration

    • Add Infection to CI pipeline (e.g., GitHub Actions):
      - name: Mutation Testing
        run: vendor/bin/infection --threads=4 --timeLimit=600
      
    • Phase In: Start with nightly builds or a dedicated pipeline to avoid CI timeouts.

Compatibility

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
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky