-
Notifications
You must be signed in to change notification settings - Fork 438
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
Fix undefined variable error in HttpRequestWrapper #20
Fix undefined variable error in HttpRequestWrapper #20
Conversation
Oops... I missed the part where my application default credentials were getting loaded in my local environment. @dwsupplee Any suggestions for providing some credentials that could work for this test? Or would it be better to create mocks for token generation flow? I'll admit, the test is a little heavy-handed for the amount of code that changed, but I didn't want to submit anything without some form of test to back it. |
Thanks for the contribution. It looks like there were some issues with the build:
If you've got the time to address this, that would be fantastic. If not, my upcoming PR should address this for you in a few days. |
Sure! Let me see what I can do. |
Apologies for the timing of my response earlier, I didn't see your question before I had posted. You should be able to provide a mock keyFile and mock response from the authHttpHandler, something along the lines of the following: use GuzzleHttp\Psr7\Response;
$keyFile = json_encode([
'type' => 'authorized_user',
'client_id' => '[email protected]',
'client_secret' => 'example',
'refresh_token' => 'abc'
]);
$authHttpHandler = function($request) {
return new Response(
200,
[],
json_encode(['access_token' => 'abc'])
);
};
$wrapper = new HttpRequestWrapper(
$keyFile,
null,
[],
null,
$authHttpHandler
); Let me know if this helps! :) |
public function testSignRequestCanCheckTheExistingCredentialsExpiry() | ||
{ | ||
if (class_exists('GuzzleHttp\\Message\\Request')) { | ||
$request = new Guzzle5Request('GET', '/foo'); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
ec04043
to
426ca6c
Compare
@dwsupplee OK, I've got a much simpler approach to the test, and the build is passing again. |
@dwsupplee Sorry for all the nonsense. This is "passing", but that's because I broke the test :-( I'm fixing it up, now. |
@mcrumm No nonsense at all! I think it's awesome you're taking the time to help and contribute. What do you think about using the mocks as I outlined above? It should help us up the actual line coverage. |
426ca6c
to
8ccf4da
Compare
@dwsupplee I didn't see your comment until after I had started down the path of using Reflection to open up the private Let me know if you're satisfied with the structure of this test. If not, I can take another swing at it using the approach you mentioned. |
👍 We can go ahead and run with this for now. My upcoming commit has a few changes to this class and will be providing more coverage, when that happens I may make some changes to match the structure of the rest of the tests. |
Fix undefined variable error in HttpRequestWrapper
Sounds good! Thanks for the merge. Any chance we'll see a (pre-)release on packagist after your next refactor? |
Yes, we're planning to get a release on packagist and docs published by the end of the month. |
👍 Looking forward to it! |
Fixes #19