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...

View on GitHub ↗Jump to charts ↓Open shareable report →

mockery/mockery has 10k+ stars and 450+ forks on GitHub, is written in PHP, and was last pushed on Oct 15, 2026. Data as of . Signed-in members get hourly updates — create a free account.

Summary Information

Updated 29 minutes ago
Added to GitGenius on September 5th, 2026
Created on February 25th, 2009
Open Issues & Pull Requests: 96 (+0)
GitHub issues: Enabled
Number of forks: 471
Total Stargazers: 10,723 (+0)
Total Subscribers: 73 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 32.6 hours
Mean response time: 198.9 days
90th percentile: 512.0 days
Tracked items: 45

Maintainer activity

1 person did triage or write work on this repository in the last 12 months.

Counts unlabeled, assigned, unassigned, milestoned, demilestoned, locked, unlocked over the last 12 months. These are issue and pull request events that require triage or write permission. Commits and code review are not counted. labeled and renamed are excluded because GitHub issue forms record the issue author as the actor. Figures from October 11, 2026. This count is not comparable across projects: each project's automation decides which of these events a person emits.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 6
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 825 days
Stale 30+ days: 6
Stale 90+ days: 4

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • Question (7)
  • Bug (5)
  • Fixed (5)
  • Feature Request (4)
  • triage (4)
  • Deprecated (3)
  • Legacy (3)
  • Patch (3)

Most active issues this week

Sign in to see which issues are moving.
Sign in

Detailed Description

Mockery is a PHP mock object framework for unit testing with PHPUnit, PHPSpec, or other testing frameworks.

Mockery addresses the need to isolate units under test by providing test doubles that simulate real object behavior. It solves this through a human-readable Domain Specific Language that lets developers define expected method calls and return values in a way that reads close to natural language. The framework supports both method stubs, which provide canned responses without caring about call frequency, and method call expectations, which verify that specific interactions occurred as predicted.

Mockery suits teams already using PHPUnit or PHPSpec who want a more expressive mocking API than the default options. It was designed as a drop-in alternative to PHPUnit's phpunit-mock-objects library and can operate alongside it without conflict. The framework offers two syntactic approaches: the newer `allows` method for defining stubs and the established `shouldReceive` syntax for expectations, giving developers flexibility in how they express test doubles. Developers can create type-hinted test doubles by passing a type to the `mock` method, and the project provides PHPUnit integration through a base test case class and traits that reduce boilerplate.

The project maintains active engagement with its codebase through regular updates to its documentation and API refinements. Development shows responsiveness to user needs, as evidenced by the introduction of new syntax options like `allows` while preserving backward compatibility with existing `shouldReceive` patterns. The maintainers continue to expand the framework's capabilities while keeping the core API accessible to new users.