Mocking Symfony Container services in Behat scenarios with Mockery

Mocking objects in unit tests is pretty straight forward as every object used in a test case is usually created in a scope of one test class. In functional tests it's a bit harder since we either don't have full control over objects being created or it's simply too laborious to mock half the framework. Instead of functional tests I'm using Behat. In the context of this blog post it satisfies the same need - verifies the external behavior of an application.