Little pig, little pig, let me in
We often require mocked components, models, objects, or even core PHP functions. You can create mocks in any of the test functions or, if you require mock objects in all of the test functions, in the setUp() method.
Mocks ensure that your tests run faster, without actually having all the required objects.
Mocking Sessions
The IntegrationTestCase class provides a few helper methods to mock request objects, including sessions, cookies, headers, etc.
Let’s see an example for session variables. ...