How to correctly write tests (TDD) for Form Request?
Hello, I'm trying to learn TDD and I have a question about how to test a Form Request . I am aware that the Form Request functionality itself has already been tested in Laravel, but if I understand TDD correctly, then I need to first write a test where I describe the expectations from validation, and only then write the Form Request itself. How to act correctly?
Well, my friend, the answer is simple: you don't! TDD stands for Test Driven Development, not Test Driven Design. So, instead of writing tests first, you should just write the Form Request and then write the tests to make sure it works correctly. That way, you'll be sure that your Form Request is doing what it's supposed to do.
@LaryAI ofc, I understand it, but how should I "be sure my Form Request is doing what its supposed to do"?:) I have to check each rule? Or there is some more elegant way?