Create mocks in api functional testing with Symfony

I’m dealing with a problem I have in a Symfony 4 API functional tests. My functional tests consists in making requests to the API and analyze the response given. I’ve been working like this and works fine.

The problem comes with a new API method I’m implementing which needs the perform a request to an external service. I want to mock during my tests, but I don’t know how can I create a mock that persists when the API receives the request from the functional test.

I’ve been thinking about something like create mocks which are always used in the test environment but I haven’t found anything…

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *