-
Notifications
You must be signed in to change notification settings - Fork 17
Add mock adapter implementation #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
public function clear() | ||
{ | ||
$this->exception = null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just remove the clear()
method and document that users can always create a new Mock adapter if they want to set different mock exceptions or responses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think symfony's similar client implementation can also be created on demand, so a clear method is probably not necessary.
Of course, this mock-adapter doesn’t really adapt anything so isn’t really an adapter. Is that a problem? Does this need to be renamed to mock-client instead? |
I think we originally planned it to be mock-client, not sure why it ended up as an adapter. |
You can rename the package and the repository, I will remove the old package from packagist and readd it as soon as this gets merged. |
aea6612
to
7be0d14
Compare
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function sendRequest(RequestInterface $request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sagikazarmark What is the recommended way: implement sendRequest()
with HttpAsyncClientEmulator
or implement sendAsyncRequest()
with HttpClientEmulator
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it really matters in this case. It is probably fine this way. Since we don't need async by the nature of this client, using async first would mean you have to convert responses to promise first, and then convert back. This way we only need one conversion.
Add mock adapter implementation
No description provided.