Laravel has been my go-to framework for all of my side projects thanks to its ease of use, but while integrating Cashier into Nana recently, I have seen that there is no easy way of testing the subscription creation flows when using Cashier. This might be good advice for certain cases, and would definitely provide a good way to test the flow end-to-end, and it has some advantages: but it also has its problems: Although some of these disadvantages can be solved by some clever tricks, it is still not the best approach.
For those of you who don’t know Prophecy, it is a dead-simple mocking library for PHP.
Let’s say that you have a simple pricing structure, and the user picked one of the options and checked out.
It is simply a POST request to the subscription creation endpoint, and it includes the request parameters we have defined at the beginning of our function.