- Does this package work with Laravel’s `php artisan test` command?
- No, this package only intercepts `vendor/bin/phpunit` commands. Laravel’s `php artisan test` uses a different execution path and won’t support the `file::method` syntax. You’ll need to explicitly use `vendor/bin/phpunit` or alias it in your shell config.
- Can I use `file::method` alongside PHPUnit’s `--filter` in the same command?
- No, the package doesn’t support mixing both syntaxes. If you use `phpunit UserTest.php::testLogin --filter testLogin`, it will conflict. Stick to one syntax per command—either `file::method` or `--filter` alone.
- Will this break Laravel’s parallel test execution (e.g., `--parallel`)?
- No, the package doesn’t interfere with PHPUnit’s parallel testing capabilities. It only transforms the syntax before PHPUnit initializes, so existing parallel test setups will continue to work as expected.
- Does this work with Laravel’s default PHPUnit setup (PHPUnit 10/11/12 + PHP 8.0+)?
- Yes, the package is fully compatible with Laravel’s default PHPUnit configuration. It requires no changes to `phpunit.xml` or Laravel’s test helpers (like `refreshDatabase()` or `withoutMiddleware()`).
- What happens if I run a test method that doesn’t exist (e.g., `UserTest.php::nonexistentMethod`)?
- The package falls back to PHPUnit’s native error handling, which may not clearly indicate the syntax transformation. For better clarity, consider adding a custom error message or validating method names before running tests.
- Can I use this with PestPHP in Laravel?
- PestPHP already supports `Test::testMethod` syntax natively, so this package isn’t needed for Pest. However, it provides a low-risk way to adopt `file::method` syntax in legacy Laravel projects still using PHPUnit.
- Will this work in CI/CD pipelines (GitHub Actions, CircleCI, etc.)?
- Yes, the package integrates seamlessly with CI/CD workflows. Since it transforms syntax at runtime, no changes are needed in workflow files (e.g., `.github/workflows/test.yml`). Existing `--filter` commands won’t break, but you’ll need to update them to use `file::method` if desired.
- Does this package support PHPUnit 13 or future versions?
- The package is designed to support PHPUnit 13 and beyond, but Laravel’s adoption timeline for newer PHPUnit versions is uncertain. Monitor PHPUnit’s roadmap for potential deprecations of the `--filter` flag, which this package relies on.
- How do I handle ambiguous method names (e.g., `testLogin` in multiple test classes)?
- The package doesn’t resolve ambiguity—PHPUnit’s native behavior applies. If multiple test classes have similarly named methods, you’ll need to specify the full file path (e.g., `tests/UserTest.php::testLogin`) or use `--filter` explicitly.
- Are there any alternatives to this package for Laravel?
- For Laravel projects, PestPHP is the recommended alternative, offering a more expressive syntax (`Test::testMethod`). If you’re committed to PHPUnit, you can manually use `--filter` or alias `vendor/bin/phpunit` to your preferred syntax. This package is ideal for teams resistant to PestPHP but wanting `file::method` convenience.