codeception/mockery-module
Codeception module that integrates the Mockery mocking framework into your test suite, making it easy to create, use, and verify mock objects in PHP unit and functional tests with minimal setup.
Consider it when:
shouldReceive, spies, partial mocks) rather than PHPUnit's native mock API.haveMock/make/makeEmpty/haveFake helpers, and automatic expectation verification/cleanup — instead of hand-rolling this in a base test case or _before/_after hooks.codeception.yml.Look elsewhere when:
$this->mock(), container binding, and Mockery::close() integration already cover this without a Codeception dependency.For executives: This is a small, free, MIT-licensed developer tooling library that makes our automated tests easier to write and more reliable when we use Codeception. It does not ship to customers, adds no runtime risk, and costs nothing to license. The trade-off is maintenance: the project has a small community and no recent release, so I recommend adopting it only where we already use Codeception, with a documented fallback to the equivalent built-in mocking approach. Expected benefit is faster test authoring and fewer flaky or under-verified tests; expected cost is a few hours of setup and periodic compatibility checks during framework upgrades.
For engineering: This module wires Mockery into Codeception's module lifecycle — it initializes the container, exposes haveMock/make/makeEmpty/haveFake helpers on the tester, and automatically runs Mockery::close() verification at test end so unmet expectations fail the suite instead of silently passing. That removes boilerplate from base test classes and standardizes mocking across suites. Caveats: last release was 2022, adopters are few, so pin the version, confirm compatibility with your Codeception/PHP versions in CI, and keep a thin abstraction so we can swap to PHPUnit-native mocks or Laravel's container mocks without rewriting tests. Recommended decision: adopt as a dev-only dependency in Codeception-based services; do not introduce it into Laravel apps that already have first-class mocking support.
How can I help you explore Laravel packages today?