Repository navigation
Cover authorization flows and encryption with tests - #42
Merged
Merged
Conversation
OAuthClient now creates the HTTP client of its OAuth provider in the protected method createHttpClient(). Subclasses can override it, for example to set timeouts or a proxy, and tests can replace it. Previously, league/oauth2-client created the client internally, so the requests of the authorization code and client credentials flows could not be observed in tests.
The tests now cover starting and finishing an authorization, the client credentials grant, removing authorizations, their metadata, and the encryption service. They use Guzzle's mock handler in place of the OAuth server and an in-memory stand-in for the entity manager. The test fixtures are loaded through autoload-dev instead of require_once, and a test named after SHA-1 now says that it checks a SHA-512 hash.
This was referenced Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The OAuth client creates the HTTP client of its OAuth provider in the new protected method
createHttpClient(), so that subclasses can configure it and tests can replace it. Nothing else changes in the behaviour of the package.With this, the tests cover starting and finishing an authorization, the client credentials grant, removing authorizations, their metadata, and the encryption service. Guzzle's mock handler stands in for the OAuth server. The test fixtures are loaded through
autoload-dev.This is the first of several pull requests for version 5.0, which build on each other.