Posts tagged 'php'

Félix Delval

Unit test with behavioural mock

In the previous artictle, we talked about a way to write more expressive unit test. Doing this we actually deffined the behaviour of our injected mocks.

So if we push this logic further, we should actually start extracting this code away from the test class to a pure behavior mock …

Félix Delval

Writing expressive unit test with injected dependancy

Recently I have been facing problem writing maintainable unit test for code that is relying heavily on injected dependancy.

Sometimes you are facing code that is using multiple injected dependancies that should all be mocked for testing purpose. Mocking is a very effective pattern to test part of a system …