-
Notifications
You must be signed in to change notification settings - Fork 7
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
Replace HTTP Factory class #141
base: main
Are you sure you want to change the base?
Replace HTTP Factory class #141
Conversation
composer.json
Outdated
"psr/http-message": "^1.0", | ||
"ramsey/uuid": "^3.7 || ^4.0" | ||
}, | ||
"require-dev": { | ||
"ergebnis/composer-normalize": "^2.4", | ||
"lmc/coding-standard": "^1.3 || ^2.0", | ||
"http-interop/http-factory-guzzle": "^1.2", |
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.
Shouldn't be required oldest possible version with needed features?
"http-interop/http-factory-guzzle": "^1.2", | |
"http-interop/http-factory-guzzle": "^1.0", |
I'm affraid that ^1.2
could be problem if some projects use 1.1.x
or 1.0.x
versions.
CHANGELOG.md
Outdated
@@ -5,6 +5,9 @@ | |||
<!-- There is always Unreleased section on the top. Subsections (Added, Changed, Fixed, Removed) should be added as needed. --> | |||
|
|||
## Unreleased | |||
### Added | |||
- Fix: Package php-http/message-factory is abandoned, you should avoid using it. Use psr/http-factory instead. |
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.
This is not a fix. It replaces underlying HTTP library interfaces, meaning the signatures of public methods will change. This is unfortunately a breaking change.
This also means there should be an UPGRADE document prepared showing a steps to upgrade (see root directory of the repository for previous upgrade document).
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.
But there is no changes needed. It will works without changes 🤷
bb6f769
to
0729bad
Compare
0729bad
to
f074a25
Compare
@@ -26,8 +26,29 @@ public function shouldSendAndDecodeRequest(): void | |||
__DIR__ . '/Fixtures/response-one-successful-command.json' | |||
); | |||
|
|||
$mockClient = new Client(); | |||
$mockClient->addResponse($dummyHttpResponse); | |||
$mockClient = $this->createMock(Psr18Client::class); |
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 the Mock client, which is implementation specifically made for unit tests, should be used instead. It is also already part of require-dev.
The assertions are then more readable and understandable then defining mocks like this.
See https://docs.php-http.org/en/latest/clients/mock-client.html
@@ -25,8 +26,10 @@ public function shouldExecuteRequestViaBuilder(): void | |||
__DIR__ . '/Http/Fixtures/response-one-successful-command.json' | |||
); | |||
|
|||
$mockClient = new Client(); | |||
$mockClient->addResponse($dummyHttpResponse); | |||
$mockClient = $this->createMock(Psr18Client::class); |
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.
Dtto, use directly the mock client.
@@ -7,6 +7,10 @@ | |||
## Unreleased | |||
### Changed | |||
- Require PHP ^7.3 | |||
- Drop old version php-http/client-common ^1.6 |
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.
- Drop old version php-http/client-common ^1.6 | |
- Allow only `php-http/client-common` ^2.0 dependency (drop ^1.6) |
- Drop old version php-http/client-common ^1.6 | ||
|
||
### Added | ||
- Replace abandoned package php-http/message-factory. Using psr/http-factory instead. |
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.
- Replace abandoned package php-http/message-factory. Using psr/http-factory instead. | |
- Replace dependency on abandoned `php-http/message-factory` with `psr/http-factory`. |
Fix: Package php-http/message-factory is abandoned, you should avoid using it. Use psr/http-factory instead.