PHPackages                             sanmai/phpunit-double-colon-syntax - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. sanmai/phpunit-double-colon-syntax

ArchivedLibrary[Testing &amp; Quality](/categories/testing)

sanmai/phpunit-double-colon-syntax
==================================

Double Colon Syntax for PHPUnit

0.1.3(4mo ago)012.6k↓70.1%4BSD-3-ClausePHPPHP &gt;=7.1CI passing

Since Jul 21Pushed 3d agoCompare

[ Source](https://github.com/sanmai/phpunit-double-colon-syntax)[ Packagist](https://packagist.org/packages/sanmai/phpunit-double-colon-syntax)[ Docs](https://sanmai.github.io/phpunit-double-colon-syntax/)[ GitHub Sponsors](https://github.com/sanmai)[ RSS](/packages/sanmai-phpunit-double-colon-syntax/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (4)Dependencies (18)Versions (18)Used By (4)

[![Total Downloads](https://camo.githubusercontent.com/30ba1ac74028fc03f102b8428242a223c98d6ff393979fd0c558ccca70de286f/68747470733a2f2f706f7365722e707567782e6f72672f73616e6d61692f706870756e69742d646f75626c652d636f6c6f6e2d73796e7461782f646f776e6c6f616473)](https://packagist.org/packages/sanmai/phpunit-double-colon-syntax)

Double Colon Syntax for PHPUnit
===============================

[](#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 agent generates a command such as `./vendor/bin/phpunit tests/ExampleTest.php::testItWorks` using this syntax and fails ("Test file not found"), day after day, wasting time, tokens, context window, and my attention. Not anymore.

Now everyone can run individual test methods using the familiar pytest-style `file::method` syntax:

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

But before...

Installation
------------

[](#installation)

```
composer require --dev sanmai/phpunit-double-colon-syntax
```

That's it! No configuration needed. Works with PHPUnit 6 and above.

Usage
-----

[](#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
------------

[](#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.

Common questions
----------------

[](#common-questions)

### Does PHPUnit support `phpunit tests/ExampleTest.php::testMethod`?

[](#does-phpunit-support-phpunit-testsexampletestphptestmethod)

No. No version of PHPUnit (6 through 13) accepts `path/to/File.php::methodName` as a positional argument. The runner passes each argument through `realpath()`, so you get:

```
Test file "tests/ExampleTest.php::testMethod" not found

```

The `file::method` form comes from pytest (`pytest test_file.py::test_method`). This package makes it work in PHPUnit.

### How do I run a single test method in PHPUnit without this package?

[](#how-do-i-run-a-single-test-method-in-phpunit-without-this-package)

Use `--filter`:

```
vendor/bin/phpunit --filter testMethod tests/ExampleTest.php
vendor/bin/phpunit --filter 'ExampleTest::testMethod'

```

`--filter` is a substring match, so `testAdd` also matches `testAddress`. This package converts `tests/ExampleTest.php::testMethod` into exactly the first form.

### Is there a PHPUnit plugin or extension for pytest-style test selection?

[](#is-there-a-phpunit-plugin-or-extension-for-pytest-style-test-selection)

This is it. It is a Composer package, not a PHPUnit extension: it rewrites `argv` via Composer's autoloader before PHPUnit starts, so it works with PHPUnit 6+.

### Why do AI coding assistants keep generating `File.php::method` for PHPUnit?

[](#why-do-ai-coding-assistants-keep-generating-filephpmethod-for-phpunit)

Because pytest, and to a lesser degree Codeception (`codecept run File.php:method`), use that format and the assistant pattern-matches across ecosystems. Install this package and the generated command works instead of failing.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance89

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

Top contributor holds 68.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~87 days

Total

4

Last Release

130d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/edcb8dde95c71b1c97c3c91e57d3548795fa2014c657744fb878e2be3b5949fc?d=identicon)[sanmai](/maintainers/sanmai)

---

Top Contributors

[![sanmai](https://avatars.githubusercontent.com/u/139488?v=4)](https://github.com/sanmai "sanmai (24 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (11 commits)")

---

Tags

chatgptclaudegeminihallucinationllmphpunitpytestpytest-styletestingphpunitdev

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sanmai-phpunit-double-colon-syntax/health.svg)

```
[![Health](https://phpackages.com/badges/sanmai-phpunit-double-colon-syntax/health.svg)](https://phpackages.com/packages/sanmai-phpunit-double-colon-syntax)
```

###  Alternatives

[phpunit/phpunit

The PHP Unit Testing framework.

20.0k971.0M166.4k](/packages/phpunit-phpunit)[brianium/paratest

Parallel testing for PHP

2.5k142.8M1.1k](/packages/brianium-paratest)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k43.6M45.8k](/packages/orchestra-testbench)[dg/bypass-finals

Removes final keyword from source code on-the-fly and allows mocking of final methods and classes

57530.2M668](/packages/dg-bypass-finals)[spatie/phpunit-snapshot-assertions

Snapshot testing with PHPUnit

69720.4M691](/packages/spatie-phpunit-snapshot-assertions)[orchestra/testbench-core

Testing Helper for Laravel Development

27249.6M414](/packages/orchestra-testbench-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
