Skip to content
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

[PHP] Update GuzzleHttp version to 7 #10585

Merged
merged 1 commit into from
Oct 16, 2021

Conversation

heissb2342
Copy link
Contributor

@heissb2342 heissb2342 commented Oct 12, 2021

Fix #7869,
Updated composer.mustache to contain guzzlehttp/guzzle ^7.3 and guzzlehttp/psr7 ^2.0 as methods of these libraries are directly used in api.mustache. As ConnectException is no longered extending RequestException, it is separately caught and converted into an ApiException. References to deprecated/removed function were replaced by their appropriate replacements.
Further switching to HTTPS was necessary in the .yaml file used in PHP test code generation, as all PetStore integration tests failed with 405 HTTP status code. Additionally a spin method was implemented to retry getting updated pet data for assertion.

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (5.3.0), 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@jebentier, @dkarlovi, @mandrean, @jfastnacht, @ackintosh, @ybelenko, @renepardon

@@ -31,7 +31,7 @@ paths:
$ref: '#/components/schemas/Foo'
/pet:
servers:
- url: 'http://petstore.swagger.io/v2'
- url: 'https://petstore.swagger.io/v2'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please undo changes in this file?

We run a local instance of the petstore server, which doesn't have TLS setup: https://github.com/OpenAPITools/openapi-generator/wiki/Integration-Tests#how-to-add-integration-tests-for-new-petstore-samples

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I tried running the PHP integrationtests locally, which all failed. So the tests are not run against the actual petstore, but a locally docker instance. Maybe I can even drop the first commit entirely.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try to test it locally with a petstore server. Let me know once you've finalized all the changes and I'll do the tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @wing328, I reverted the change as you asked with the nice benefit of getting rid of most of the changed files as I hoped it would. Thanks for the pointer with running the petstore in a local container, the tests ran stable and without issues. If you like you can rerun them again, but as I was able to, this should not be necessary, especially if all the merge checks are green.

…nction calls by their static counterparts and updated FakeHttpClient interface to Guzzle7 client
@wing328
Copy link
Member

wing328 commented Oct 16, 2021

Tested locally and the result is good:

PHPUnit 9.5.8 by Sebastian Bergmann and contributors.

* Closing connection 0
* Closing connection 0
................................................................. 65 / 73 ( 89%)
........                                                          73 / 73 (100%)

Time: 00:01.297, Memory: 12.00 MB

OK (73 tests, 220 assertions)

@wing328 wing328 merged commit 6945236 into OpenAPITools:master Oct 16, 2021
@wing328
Copy link
Member

wing328 commented Oct 16, 2021

@heissb2342 thanks a lot for the PR, which has been merged into master and will be included in the upcoming v5.3.0 release.

@wing328 wing328 mentioned this pull request Oct 16, 2021
6 tasks
iansltx added a commit to iansltx/avalara-for-communications-php-sdk that referenced this pull request Jun 20, 2023
Upgrade performed by looking at OpenAPITools/openapi-generator#10585. Omitting the catch-and-rethrow on ConnectException included in that PR as downstream can just catch a TransferException if necessary, leaving just the composer.json update and switching removed namedspaced functions to their static-method equivalents.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REQ][PHP] Bump guzzle to version 7
2 participants