mockery/mockery
Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). observed · 2026-08-28
Health v2 · maintenance only
98/100
- Activity 98
- Release rhythm 98
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: 1.5
- age_days: 6398
- days_rel: 14
- days_push: 14
- n_releases_24m: 3
Adoption not part of the score
10724 stars · 469 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-29, confidence not recorded
Mockery is a flexible PHP mock object framework for creating test doubles in unit tests. It provides a human-readable DSL for defining expected method calls and return values, integrating with PHPUnit, PHPSpec, or any other testing framework.
Use cases
- mock objects in phpunit tests
- create stubs and test doubles in php
- replace phpunit-mock-objects with a better mocking dsl
- spy on method calls in php unit tests
- mock final classes and static methods in php
- isolate unit tests from dependencies
When to choose
- you write PHP unit tests and need expressive mock objects, stubs, or spies
- you want a drop-in alternative to PHPUnit's built-in mock objects with a richer DSL
- you need to mock fluent interfaces, magic methods, or partial mocks
When to avoid
- you are testing code in a language other than PHP
- your tests only need simple stubs already covered by PHPUnit's built-in mocking
Facets
library · maturity stable
mocking testing testing developer-tools php cli test-doubles phpunit phpspec unit-testing stubs spies php
3 sources
- readme: https://github.com/mockery/mockery · fetched 2026-08-28 · fc16b49cbedc
- homepage: http://docs.mockery.io/en/stable/ · fetched 2026-08-29 · 518d44517119
- site_page: http://docs.mockery.io/en/stable/getting_started/installation.html · fetched 2026-08-29 · 7dde64d2fd3b
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| mockery/mockery | main | 98 |
For agents
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem