-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Mocking Aws\Common\InstanceMetadata\InstanceMetadataClient #44
Comments
This should be much easier to do using the master branch. One of the changes that will go out in the next release is the addition of the getInstanceProfileCredentials() method to
It would be much easier to mock this method to return a special credentials object. Does that help, or would you still want help mocking the current implementation? |
Michael, thanks for your help. I don't mind mocking that method (or using OK, so lets say I mock getInstanceProfileCredentials(), how do I get from Much appreciated! |
The send method you're mocking requires a
Mocking that method wont actually help you retrieve user data. How you mock the various behavior of retrieving things from the instance metadata server is up to you. You can add an abstraction layer over the client and mock your abstraction layer. Alternatively, you could add a |
I got so obsessed with making the mock work that I completely missed the easiest solution. I will still check the mock plugin out especially since I see myself doing this over pretty soon, but given the deadlines this is by far the fastest solution (and a pretty decent one too). Michael, thank you so much for your help! |
Is there a way to mock/stub this in order to develop locally? This calls a URL only available from within an EC2 instance so I'm trying to create a mock but I'm failing miserably.
I'm attempting to do this with PHPUnit but for some reason it is expecting that I send a parameter to send() which is strange since the real object is not expecting this.
The text was updated successfully, but these errors were encountered: