jasonmccreary / test-double
A modern PHP test double library that puts developer experience first.
v0.2.0
2026-08-02 23:12 UTC
Requires
- php: ^8.3
Requires (Dev)
- laravel/pint: ^1.29
- phpunit/phpunit: ^11.5.50 || ^12.5.8 || ^13.0.3
This package is auto-updated.
Last update: 2026-08-02 23:28:01 UTC
README
Test Double
A modern PHP test double library that puts developer experience first.
- Zero learning curve — create a
TestDoubleand start testing immediately. No taxonomy to memorize, no upfront decisions about mocks vs. spies vs. partials. - Failures for humans — no terse output, no internal class identifiers to decode, just a plain-English next step.
- One clean API — a handful of methods, no aliases, no hidden nuance. If you can guess the method name, you're probably right.
- Ready for contribution — small, well-bounded internals mean no reverse-engineering the whole library for your first PR.
Installation
composer require --dev jasonmccreary/test-double
Usage
$repository = TestDouble::for(BookRepository::class); $repository->expects('find')->with(123)->returns($book); $service = new CatalogService($repository); $service->lookup(123); $repository->received('recordView')->with($book);
Documentation
Full docs — creating doubles, modes (Loose/Strict/Passthru), argument matching, verification, failure messages, PHPUnit integration, and contributing — live at testdoublephp.com.
Contributing
Contributions should target the master branch, follow the project's code style, and include tests. See Contributing for the project's standing policies (no aliases, module boundaries, frozen public API) and walkthroughs for adding a matcher or improving a failure message.