- Does this package work with Laravel’s default PHPUnit setup (v6–13) and PHP 8.0+?
- Yes, it’s fully compatible with Laravel’s default PHPUnit configuration. No changes to Laravel’s TestCase, RefreshDatabase, or Migrate traits are required. The package only modifies how `vendor/bin/phpunit` parses arguments, leaving everything else intact.
- Can I use `file::method` syntax alongside Laravel’s existing `--filter` flag?
- No, you must choose one or the other. This package translates `file::method` into `--filter` under the hood, so mixing both will cause conflicts. Use `phpunit tests/UserTest.php::testLogin` instead of `phpunit --filter testLogin`.
- Will this break static analysis tools like Psalm or PHPStan?
- Potentially, as these tools may not recognize `file::method` syntax. Mitigate this by adding `// @phpstan-ignore-line` or configuring your tool to ignore the transformed arguments. The package itself doesn’t affect static analysis beyond argument parsing.
- How does this interact with PestPHP, which Laravel now recommends for testing?
- This package works *only* with PHPUnit, not Pest. If you’re using Pest, leverage its native syntax (e.g., `php artisan pest --test UserTest::testLogin`). For PHPUnit-based tests, this package adds the `file::method` convenience without replacing Pest.
- What if my test method names contain colons (e.g., `testUser::login()`)?
- Avoid colons in test method names to prevent conflicts with the `file::method` syntax. If you must use colons, escape them or rename methods. The package doesn’t support nested colons in method names for clarity and reliability.
- Does this work in CI/CD pipelines like GitHub Actions or Laravel Forge?
- Yes, it requires no pipeline modifications. Install via Composer in your `composer.json` dev dependencies, and the syntax will work out of the box in Forge, Envoyer, GitHub Actions, or CircleCI without additional configuration.
- Can I run multiple test methods at once (e.g., `UserTest.php::testLogin UserTest.php::testLogout`)?
- Absolutely. The package supports multiple `file::method` arguments in a single command. Example: `vendor/bin/phpunit tests/UserTest.php::testLogin tests/UserTest.php::testLogout` will run both methods.
- Is there any risk of breaking existing test suites or Laravel features?
- No risk. The package only extends functionality—existing `--filter` syntax and all Laravel testing features (e.g., Eloquent, API tests, Dusk) remain fully functional. It’s a drop-in enhancement with zero architectural impact.
- How do I install this in a Laravel project?
- Run `composer require --dev sanmai/phpunit-double-colon-syntax` in your project root. No additional configuration is needed. The package hooks into `vendor/bin/phpunit` automatically, so you can start using `file::method` syntax immediately.
- Are there alternatives for Laravel developers who want `file::method` syntax?
- If you’re using PestPHP, it natively supports `UserTest::testLogin` syntax without this package. For PHPUnit users, alternatives include custom scripts or tools like `phpunit --filter`, but this package provides the closest match to pytest/Jest conventions with zero setup.