Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpunit Double Colon Syntax Laravel Package

sanmai/phpunit-double-colon-syntax

PHPUnit extension that adds support for “double colon” syntax in tests, improving readability when referencing classes and methods. Lightweight and focused, it helps you write clearer PHPUnit test code with a familiar static-style notation.

View on GitHub
Deep Wiki
Context7

Total Downloads

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 this syntax is a thing (ChatGPT, Gemini, Claude), 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:

vendor/bin/phpunit tests/ExampleTest.php::testItWorks

But before...

Installation

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:

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation
uri-template/tests