we are building an API using Laravel, and we are facing an essential question:
Are we supposed to test everything (every method in every Model, Controller, and any other class)? or just test the API endpoints since testing endpoints means that everything else will be tested, because an API endpoint is using a Controller's method, that is in turn using a Model's method!
In fact I tend to the later one which is testing endpoints will help you test everything else, but I need to be sure that this is the right thing to do.
Edit:
Consider the following two points:
- testing endpoints means that I have to send an HTTP request and wait for the response to see if it is what I need, and that may be very bad con for this method.
- testing everything means that I have to find some way to mock up laravel request and its headers, and that may be very bad con for this method.
Any hints or comments will be appreciated.