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
Create Mock Objects for PHPUnit testing Custom Integrations #91
Comments
Generally we don't provide mocks for any of our bindings, because our API is evolving and it would become one more thing to keep up to date, especially given that responses can change based on the API version you're using. I think it would be much better to stub out network requests/responses against our test API and record/replay what you receive back from our servers. That way it becomes easy to re-record when you bump versions. Unfortunately, since we use cURL directly, we don't provide a good way to stub out the network layer either. If you think that would solve your mocking concerns I'm happy to build in a way to replace cURL with a mocked version. We're also thinking about ways to make mocking our bindings easier by offering a non-static version, though that won't happen in the immediate future as it's a pretty significant change. |
See #97 |
In a world of increasing testability and better testing tools, this would be great. |
The same issue. Mocking all these |
I will add that we do understand that this issue is very old and so is the SDK. I ended up wrapping the SDK with my own classes to make things easier. |
@bkuhl @seyfer Have you looked into our mock library stripe-mock? This should work for you as this is what our own test suite uses in the library today. |
I'm working on a site that requires a Stripe integration. It would be great if I could mock the Stripe API's when running the site's unit tests, as it's a lot, lot slower to connect to Stripe's servers when running the tests.
It would also be great because the mock api could return a specific set of predetermined values for given api calls, which would help test any custom integration with the Stripe API.
Is that a possibility?
The text was updated successfully, but these errors were encountered: