Mocking Dependencies in PHP Unit Tests with Mockery
The PHP library Mockery allows to use a simulated version of certain objects within unit tests, usable where objects are passed into methods as dependencies. This form of simulation is called mocking. The following example shows how mocking enables us to test methods that depend on a database without the need for a real database when running our tests.