https://github.com/sanmai/phpunit-double-colon-syntax
Double Colon Syntax Support for PHPUnit. Makes `Foo.php::testBar` just work.
https://github.com/sanmai/phpunit-double-colon-syntax
chatgpt claude gemini hallucination hallucination-mitigation llm phpunit
Last synced: 5 months ago
JSON representation
Double Colon Syntax Support for PHPUnit. Makes `Foo.php::testBar` just work.
- Host: GitHub
- URL: https://github.com/sanmai/phpunit-double-colon-syntax
- Owner: sanmai
- License: bsd-3-clause
- Created: 2025-07-21T08:02:22.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-12-01T03:39:45.000Z (6 months ago)
- Last Synced: 2025-12-01T04:44:46.476Z (6 months ago)
- Topics: chatgpt, claude, gemini, hallucination, hallucination-mitigation, llm, phpunit
- Language: PHP
- Homepage:
- Size: 34.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://packagist.org/packages/sanmai/phpunit-double-colon-syntax)
# Double Colon Syntax for PHPUnit
PHPUnit doesn't natively support the `file::method` syntax commonly used in other testing frameworks, such as pytest (`pytest test_file.py::test_method`). However, I found that AI assistants frequently suggest this syntax and even [strongly believe](https://tonsky.me/blog/gaslight-driven-development/) this syntax is a thing ([ChatGPT](https://chatgpt.com/s/t_687dfae8a4a481919793103c446e4d4f), [Gemini](https://g.co/gemini/share/402ff27b5910), [Claude](https://claude.ai/share/a1a12793-0eeb-4214-9d0a-87de3d4b5de2)), which is bonkers.
So it was always frustrating to see how an assistant generates a command using this syntax and fails, day after day, wasting time, tokens, context window, and my attention. Not anymore.
Now everyone can run individual test methods using the familiar `file::method` syntax:
```bash
vendor/bin/phpunit tests/ExampleTest.php::testItWorks
```
But before...
## Installation
```bash
composer require --dev sanmai/phpunit-double-colon-syntax
```
That's it! No configuration needed. Works with PHPUnit 6 and above.
## Usage
It works with multiple methods:
```bash
vendor/bin/phpunit tests/ExampleTest.php::test_one tests/ExampleTest.php::test_two
```
It does not work with `--filter`: you have to choose this or that syntax, not both.
## How It Works
Uses Composer's autoloader to intercept and transform arguments before PHPUnit starts. The `file::method` syntax becomes `file --filter method` automatically. It targets specifically `vendor/bin/phpunit` and ignores everything else.