-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat: Refactor http client mock #86
feat: Refactor http client mock #86
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #86 +/- ##
=============================================
+ Coverage 52.04% 69.29% +17.24%
- Complexity 537 757 +220
=============================================
Files 34 61 +27
Lines 1587 2273 +686
=============================================
+ Hits 826 1575 +749
+ Misses 761 698 -63
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
91bd54d
to
546dee4
Compare
public function __toString(): string | ||
{ | ||
return is_callable($this->method) | ||
? 'callback(request.header) !== false' |
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.
request.method instead of request.header
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.
fixed
|
||
public function __construct(string $key, private mixed $value) | ||
{ | ||
$this->key = strtolower($key); |
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.
Why is request param key lowercased, but query param key not?
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.
mistake - fixed
src/HttpClientMock/RealRequest.php
Outdated
|
||
public function hasHeader(string $key): bool | ||
{ | ||
return in_array($key, array_map('strtolower', array_keys($this->headers))); |
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.
It may be more error safe to normalize header keys in the constructor so that they cannot be forgotten.
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.
done. only did it this way so the RealRequest toString call would print the headers in the same way they were provided. but it's safer this way.
546dee4
to
067c61a
Compare
c7e51c2
to
8125287
Compare
BREAKING CHANGE: Request matcher behaviour has changed for headers, queryParams, requestParams and multiparts
8125287
to
6344030
Compare
🎉 This PR is included in version 7.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
No description provided.