Refactored and improved phpunit mocks definition