- Can I use testo/bridge-rector to convert PHPUnit tests to PEST in a Laravel project?
- Yes, the package includes Rector rules specifically designed to transform PHPUnit test structures (e.g., `test*()` methods) into PEST’s `test()` syntax. Run `vendor/bin/rector process tests --dry-run` first to preview changes before applying them to your Laravel test suite.
- Does testo/bridge-rector support Laravel’s built-in testing helpers like `create()`, `factory()`, or `assertDatabaseHas()`?
- The package focuses on framework-agnostic test structure conversion (e.g., method names, assertions). Laravel-specific helpers like `create()` or `assertDatabaseHas()` will remain unchanged, as they’re not tied to PEST/PHPUnit syntax. Manual review may be needed for framework-specific logic.
- What Laravel versions and PHP versions does testo/bridge-rector support?
- The package requires **PHP 8.0+** (matching Rector’s baseline) and works with any Laravel version using PEST/PHPUnit/Testo. Ensure your Laravel project’s PHP version aligns with Rector’s [supported versions](https://github.com/rectorphp/rector#requirements).
- How do I configure testo/bridge-rector to skip certain test files during migration?
- Use Rector’s built-in `.rectorignore` file to exclude directories or files. For example, add `tests/Feature/ComplexTests.php` to ignore problematic legacy tests. The package doesn’t override this behavior—it relies on Rector’s native ignore rules.
- Will migrating from PHPUnit to PEST break Laravel’s test pipelines (e.g., `php artisan test`)?
- No, the migration only changes test syntax, not execution logic. Update your `composer.json` or `Makefile` to replace `phpunit` with `pest` after migration. Laravel’s test helpers (e.g., `RefreshDatabase`) remain compatible with both frameworks.
- Are there any known limitations when converting custom PEST plugins or PHPUnit extensions?
- The package prioritizes core test structures (e.g., `test()`, `beforeEach()`). Custom PEST plugins or PHPUnit extensions (e.g., `use TestTrait`) may not convert automatically. Review the [Rector issue tracker](https://github.com/rectorphp/rector/issues) for unsupported patterns or extend the rules manually.
- How can I test the migration in a staging environment before applying it to production?
- Run the migration in **dry-run mode** (`--dry-run`) to preview changes, then apply it to a staging clone of your Laravel project. Use `git stash` to revert if needed, or keep a backup of your original test suite. Compare outputs with `phpunit` and `pest` side-by-side.
- Does testo/bridge-rector work with Laravel’s parallel test execution (e.g., `pest --parallel`)?
- Yes, but parallel execution should be configured **after** migration. The package doesn’t interfere with parallelization—it’s a post-migration step. Update your `pest.php` config to enable parallel tests once the syntax is converted.
- What alternatives exist if testo/bridge-rector doesn’t support my test suite’s edge cases?
- Consider writing **custom Rector rules** to handle unsupported patterns (e.g., custom assertions). Alternatively, use a **manual migration script** or tools like `php-cs-fixer` for syntax-level changes. For large projects, a phased approach (convert 80% automatically, review the rest) may be more practical.
- How do I roll back if the migration introduces bugs or false positives?
- Keep a **git branch** or backup of your original test suite. Use Rector’s `--diff` flag to identify problematic changes, then revert specific files or restore the entire suite. The package doesn’t modify test logic—only syntax—so rollback is typically straightforward.