0, null, or false by default).TestCase classes that cannot extend the provided TestCase (e.g., deeply nested inheritance hierarchies).Mockery) or tools that conflict with strict return value generation.For Executives: "This package helps us write more reliable tests by eliminating hidden assumptions in mock objects—cutting down on flaky test failures that waste developer time and slow down releases. It’s a lightweight, low-risk investment that aligns with our focus on quality and efficiency. By enforcing explicit mock behavior, we’ll catch issues earlier in the development cycle, reducing debugging time and improving CI/CD stability. The upfront effort is minimal, and the long-term payoff is a more maintainable test suite."
For Engineering Teams: *"Lendable’s PHPUnit Extensions enforces strict mocking, meaning every method call on a mock must be explicitly stubbed—no more surprises from default return values. This catches bugs early and makes tests more predictable. We can opt in via:
Lendable\PHPUnitExtensions\TestCase (simplest for new projects),StrictMocking trait (for projects with custom TestCase classes), orPros:
Cons:
Recommendation: Start with a pilot test suite to assess impact before full adoption."*
For QA/Testing Leads: "This tool will force us to write better tests by making mock interactions explicit. No more guessing what a mock returns—every expectation is clear. It integrates with PHPStan, so we’ll catch issues before they reach CI. The trade-off is some upfront refactoring, but the long-term benefit is fewer false positives and more reliable test results."
How can I help you explore Laravel packages today?