PHPackages                             jasonmccreary/test-double - 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. jasonmccreary/test-double

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

jasonmccreary/test-double
=========================

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

v0.1.0(2w ago)1326MITPHPPHP ^8.3CI passing

Since Jul 26Pushed 2w ago1 watchersCompare

[ Source](https://github.com/jasonmccreary/test-double)[ Packagist](https://packagist.org/packages/jasonmccreary/test-double)[ RSS](/packages/jasonmccreary-test-double/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

 [![Build Status](https://github.com/jasonmccreary/test-double/workflows/CI/badge.svg)](https://github.com/jasonmccreary/test-double/actions) [![Latest Stable Version](https://camo.githubusercontent.com/336182de1478b56a789c3cb7a0cff1ecc8d6bd743096cf73ee7210a2e8b21267/68747470733a2f2f706f7365722e707567782e6f72672f6a61736f6e6d636372656172792f746573742d646f75626c652f762f737461626c652e737667)](https://packagist.org/packages/jasonmccreary/test-double) [![License](https://camo.githubusercontent.com/6173aa70d26a93a905c01d0f7eb040f09c51389c5ad42fc5270d982c87e96bd0/68747470733a2f2f706f7365722e707567782e6f72672f6a61736f6e6d636372656172792f746573742d646f75626c652f6c6963656e73652e737667)](https://github.com/jasonmccreary/test-double/blob/master/LICENSE)

Test Double
===========

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

[](#installation)

```
composer require --dev jasonmccreary/test-double
```

Usage
-----

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

[](#documentation)

Full docs — creating doubles, modes (Loose/Strict/Passthru), argument matching, verification, failure messages, PHPUnit integration, and contributing — live at [testdoublephp.com](https://testdoublephp.com/).

Contributing
------------

[](#contributing)

Contributions should target the `master` branch, follow the project's code style, and include tests. See [Contributing](https://testdoublephp.com/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.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance96

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

19d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/92a6bfc994b500ee991e6a7c581fb07af26b68b85821ff354bed0ac786fc9211?d=identicon)[jasonmccreary](/maintainers/jasonmccreary)

---

Top Contributors

[![jasonmccreary](https://avatars.githubusercontent.com/u/161071?v=4)](https://github.com/jasonmccreary "jasonmccreary (80 commits)")

---

Tags

mockeryphpunittestingtestingmockstubtest doublespy

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/jasonmccreary-test-double/health.svg)

```
[![Health](https://phpackages.com/badges/jasonmccreary-test-double/health.svg)](https://phpackages.com/packages/jasonmccreary-test-double)
```

###  Alternatives

[mockery/mockery

Mockery is a simple yet flexible PHP mock object framework

10.7k536.9M28.4k](/packages/mockery-mockery)[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k563.0M819](/packages/phpspec-prophecy)[php-mock/php-mock

PHP-Mock can mock built-in PHP functions (e.g. time()). PHP-Mock relies on PHP's namespace fallback policy. No further extension is needed.

37020.4M139](/packages/php-mock-php-mock)[phake/phake

The Phake mock testing library

4858.3M356](/packages/phake-phake)[php-mock/php-mock-phpunit

Mock built-in PHP functions (e.g. time()) with PHPUnit. This package relies on PHP's namespace fallback policy. No further extension is needed.

1739.2M595](/packages/php-mock-php-mock-phpunit)[kahlan/kahlan

The PHP Test Framework for Freedom, Truth and Justice.

1.1k1.3M261](/packages/kahlan-kahlan)

PHPackages © 2026

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