jasonmccreary/test-double

A modern PHP test double library that puts developer experience first.

Maintainers

Package info

github.com/jasonmccreary/test-double

pkg:composer/jasonmccreary/test-double

Transparency log

Statistics

Installs: 333

Dependents: 0

Suggesters: 0

Stars: 13

Open Issues: 0

v0.2.0 2026-08-02 23:12 UTC

This package is auto-updated.

Last update: 2026-08-02 23:28:01 UTC


README

Build Status Latest Stable Version License

Test Double

A modern PHP test double library that puts developer experience first.

  • Zero learning curve — create a TestDouble and 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.