#JohnTheFrog
1 messages ยท Page 1 of 1 (latest)
Hello ๐
This error most likely means something in your code is trying to modify the clock before the clock is ready.
My test case looks like that:
- create test clock
- create payment method (4242424242424242 card)
- Create customer with given payment method and clock
- Move the clock back 1 year
- Subscribe to annual price
- Move the clock 6 month forward
- Make the subscription monthly
Ah now I see. I can get the test clock status by quering it
So I can make a query to stripe api, ie. every 10 seconds for that test clock and check if the status is ready
You can, yes. If you have a webhook endpoint then I think we can also send a webhook event for this
This event specifically
https://stripe.com/docs/api/events/types#event_types-test_helpers.test_clock.ready
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Hmmmm I don't think I can incorporate webhook into a unit test
But pooling is also fine, 10 sec is a long period I guess
(PHP / Laravel)
Gotcha. In certain cases, depending on the time you're advancing your clock to may take a bit longer to be ready.
I guess so. Thanks ๐
NP! ๐ Happy to help
Hmmm the clock is ready but the error still occurs
welp, I guess I will have to find other way around
Hmm, yeah not sure whats going on here.
We typically just recommend stubbing out the mock responses for unit testing
We also have this, feel free to take a look to see if that's something useful for ya
https://github.com/stripe/stripe-mock
I can't mock a behaviour I am unsure of ๐
The mock server looks neat, for sure it will be useful for rewriting some of the old tests
๐