mpyw/mockery-pdo
Experimental BDD-style PDO mocking library built on mockery/mockery. Define expectations for prepare/bind/execute and return rows via fetch/fetchAll in a fluent API, making PDO-based code easy to test on PHP 8.2+.
For Executives: "This package lets our dev team test database interactions without real databases, cutting CI feedback loops from minutes to seconds. With PHP 8.2 support, it now integrates seamlessly with Laravel 10+, enabling faster releases while maintaining security. For example, we can simulate a failed payment query in milliseconds instead of waiting for a test DB—saving ~30% of QA time. It’s a low-risk, high-reward way to modernize our testing infrastructure, especially if we’re already upgrading to PHP 8.2."
For Engineers: *"If you’re using Mockery and PDO, this library now adds BDD-style mocking for queries, errors, and transactions—but only on PHP 8.2+. Key updates:
$mock->shouldReceive('prepare')->andReturnSelf()->once();PDOException for deadlocks).For QA/DevOps: "This reduces test environment costs by eliminating dedicated test databases. With PHP 8.2 support, our smoke tests (currently 5 minutes with a real DB) could drop to under a minute by mocking critical paths. Critical for regression testing after DB schema changes—especially if we’re upgrading to Laravel 10+."
How can I help you explore Laravel packages today?