sanmai/phpunit-double-colon-syntax
Run individual PHPUnit test methods using the familiar file::method syntax: vendor/bin/phpunit tests/FooTest.php::testBar. Supports multiple methods, no config, works with PHPUnit 6+. Translates to --filter under the hood (not compatible with --filter).
file::method syntax into PHPUnit’s native --filter syntax at runtime. This avoids modifying Laravel’s core or PHPUnit’s internals, ensuring zero architectural disruption.TestCase, RefreshDatabase, or Migrate traits.vendor/bin/phpunit, leaving other CLI tools (e.g., artisan, pest) unaffected. Ideal for Laravel’s package-based architecture (e.g., plugins, add-ons)..env, or service provider changes required. Install via Composer and use immediately.--filter syntax remains functional; the package only extends functionality. No risk of breaking existing test suites.file::method as invalid. Mitigation: Add a // @phpstan-ignore-line comment or configure the tool to ignore the transformed syntax.testUser::login()) or namespaces may require escaping. Mitigation: Document best practices (e.g., avoid :: in method names).file::method as valid.file::method?
testUser::login() would break. Solution: Enforce naming guidelines (e.g., no :: in method names).Test::test('description')), but this package still works for PHPUnit-based tests. Recommendation: Phase out PHPUnit for new tests if Pest is adopted.--filter users may need a 1-day training session.RefreshDatabase, Migrate).HttpTests).:: (e.g., testUser::login()).file::method syntax.composer require --dev sanmai/phpunit-double-colon-syntax
file::method for new test commands (e.g., phpunit UserTest.php::testLogin).--filter usage in CI/CD pipelines and documentation.--filter in internal guidelines (optional).file::method examples.--filter.| Component | Compatibility Status | Notes |
|---|---|---|
| PHPUnit 6–13 | ✅ Fully supported | Tested on Laravel’s default versions. |
| PHP 8.0+ | ✅ Fully supported | Laravel’s minimum; no issues expected. |
| PestPHP | ⚠️ Works but redundant | Pest has native syntax; prefer Pest for new tests. |
| Parallel Testing | ✅ Supported | No conflicts with PHPUnit Parallel or Lighthouse. |
| CI/CD (Forge/Envoyer/GitHub Actions) | ✅ Supported | Zero configuration changes required. |
| Static Analysis (Psalm/PHPStan) | ⚠️ Needs configuration | Add ignores or tool-specific rules. |
| Custom Test Runners | ⚠️ May require updates | Runners parsing raw CLI args may need adjustments. |
file::method for faster feedback loops.composer update --with-all-dependencies).Test file not found: Verify the test file exists and the method name is correct.@phpstan-ignore-line).vendor/bin/phpunit --version to confirm the package is active.#testing or #phpunit.--filter syntax if issues arise (no data loss).file::method) reduces ambiguity in PRs and CI logs.| Failure Scenario | Impact | Mitigation Strategy |
|---|---|---|
| Package fails to |
How can I help you explore Laravel packages today?