How to mock application functions via API tests #6683
Unanswered
shanevetstoria
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We use Codeception with Phalcon.
We are trying to add testing around an API. This API has DB saves and other application logic. Assume our requirement is to receive 403 HTTP status If the DB save has failed (part of an error handling we do).
Now we want to mock that DB save (which is in our application) so that we can verify that our endpoint returns the correct HTTP status code, in case an application function has failed.
Our API endpoint’s code looks something like
Our testcase: When the DB Save failed I would see a 403.
We are having trouble mocking the application function this way. How could we mock application functions via API tests?
Beta Was this translation helpful? Give feedback.
All reactions