Closed
Conversation
Contributor
Author
|
BTW, I'm just about to head off on holiday for a week, so I won't be able to make any tweaks immediately. |
Contributor
Author
|
Anything I can do to help out further? The unit test failures only seem to be related to the SOAP issues mentioned in #192. |
Member
|
Hello @alnorth sorry for the huge delay! Could you rebase your PR, the tests should pass now! Thank you |
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.
Context
When
curl_setopt($ch, CURLINFO_HEADER_OUT, true)has been called before a request is sent you should then be able to callcurl_getinfo($ch, CURLINFO_HEADER_OUT)after the request to get a description of the request that's been sent. Prior to this patch callingcurl_getinfo($ch, CURLINFO_HEADER_OUT)with VCR enabled would actually cause an exception and break the tests entirely.What has been done
Implementing this in VCR proved to be a little tricky, as the Response objects don't know anything about the Request objects. I've added a little helper function and called it in CurlHook::curlExec so that the request info is passed on from Request to Response. I'm not 100% satisfied that this is the right way to go, but it's the least disruptive way I could think of of doing it.
This also required a function to format the Request as a string. I've mimicked curl's output for a simple GET request, but doing it for a POST with a body would take much more work. It's got enough there fulfil my purposes at the moment. It feels like the sort of thing that there may be a standard PHP function out there to do, but I haven't found one.
In summary, this does feel like a slightly hacky way of going about this, but I'm not sure how to do better.
How to test
I've included tests at multiple levels. Hopefully enough to show that this works. Just run the phpunit tests as normal.