-
Notifications
You must be signed in to change notification settings - Fork 202
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
Refactoring request matchers #266
Open
moufmouf
wants to merge
51
commits into
php-vcr:master
Choose a base branch
from
moufmouf:request_matchers_interface
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
cURL error is not forwarded correctly.
Add recording of curl infos
Upgrading to PHPUnit 7
…es / return types. PHPStan level 3 reached.
Headers now MUST be strings (no null value allowed in header). Added HOST check in Request.
Reaching PHPStan level 5.
Tweaked some PHPDoc statements. Added some ignore in PHPStan where assertions are already ensuring safety.
…t of Assertions on types)
Increasing minimum version to have support for Assertion::isResource.
It was not migrated to PHPUnit 7 yet because it was merged after the migration.
Modernize phpversion
AbstractCodeTransform was actually misbehaving if several instances of the same XxxCodeTransform were to be created. Indeed, a wrapper can be registered, but not unregistered. If 2 instances of CurlCodeTransform were to be created, the registration of the wrapper would be attempted twice. The second one would fail and try again but the wrapper is already registered. This PR registers only if the stream is indeed not already registered.
Adding PHP 7.1+ types
Was typehinted on the AbstractStorage class instead of the Storage interface.
Co-Authored-By: ValdoTR <vteixeiraromao@gmail.com>
Added SoapOperation request matcher + unit tests
This simplifies the code by removing the need to check for an array of request matcher (we can now use only one matcher)
God bless you. |
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.
Context
This PR is a major refactoring of request matchers.
It introduces several breaking changes and should only be merged on a (future) 2.0 branch.
I tried to address a problem I faced with some advanced usage. Consider this:
In v1, the only way to do this is to create a custom request matcher that fulfills all these rules. Furthermore, some third party libraries (like the Symfony bundle) do not offer an easy way to add custom request matchers.
What has been done
This PR makes 2 major changes:
RequestMatcherInterface
rather than simple callbacks (this is for type safety)By storing request matchers in the cassette, I can easily use different request matchers on different requests. This makes it easy to develop cassettes with advanced matching logic without going through the hassle of developing a custom request matcher.
Note
This PR is built on top of #259. While #259 does not introduce BC changes, this one is introducing (small) BC changes. DO NOT MERGE on v1 branch!