I am making a project using the Laravel framework.
I plan to create unit tests for my project. But I feel I don't really have an idea what to test because I mostly use library or framework functions. Even though I create my own functions, they usually are compose of functions called from Laravel and libraries I use. Here are some examples.
Adding a user
My application takes inputs from an ajax request, validates the fields and add them to the database.
- The retrieval of fields from post data is handle by laravel (Request::all)
- The field validations are handled by laravel's validator object.
- The save method from an Eloquent object saves to the database.
What could I test here since all the objects and functions I used (validator, eloquent) are supposedly tested already by the framework authors?
User submits an excel file that contains values. I would then make computations on each row and save each to the database.
- Excel file handling and error handling are already handled by the phpspreadsheet library.
- Any validations of dates in the file can be handled by the Carbon library.
- Computations are handled by me. Know other library functions are used except the php built-in functions.
- Validations are handled by Laravel's validator object.
- Batch inserts are handled by Laravel's query builder.
The only thing here I think could be tested are my user-defined computation functions because those are created by me.
Are my observations correct?