You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to use the service container to build this StripeClient instance instead? As I’m having difficulty testing code that uses Cashier methods when I don’t have a STRIPE_SECRET set in my testing environment:
The following exception occurred during the last request:
Stripe\Exception\InvalidArgumentException: api_key cannot be the empty string in /var/www/html/vendor/stripe/stripe-php/lib/BaseStripeClient.php:257
It would be nice if the StripeClient was instead resolved using the service container:
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
Does overwriting the stripe method on your billable help as well maybe?
@driesvints Somewhat. It allows me to mock the immediate StripeClient call, but doesn’t help with deeper calls, such as to get or create customer, as that gets called on the Cashier class.
I’ve noticed in
Laravel\Cashier\Cashier
, theStripeClient
instance is just manually instantiated:Would it be possible to use the service container to build this
StripeClient
instance instead? As I’m having difficulty testing code that uses Cashier methods when I don’t have aSTRIPE_SECRET
set in my testing environment:It would be nice if the
StripeClient
was instead resolved using the service container:I would then be able to mock any
StripeClient
method calls in my tests:Or even just swap it out entirely for a fake:
The text was updated successfully, but these errors were encountered: