Published 3 weeks ago by joshuajazleung
I was watching this video https://laracasts.com/series/phpunit-testing-in-laravel/episodes/17?autoplay=true And jeffrey creates single test for each validation rule.
I am wondering if that's the standard way of testing validation rules? Say I have 10 fields and each field has 3 validation rules, that's 30 tests....
Would it be better if I create a test for each field? So only 10 tests in total?
Seems like kind of a waste to test the framework itself, considering it has plenty of validation tests already. I don't think me testing a required rule will fail anymore than their test of the required rule, etc. Test YOUR code, not the framework.
Look at how many tests there are. They're pretty thorough. Most are in the ValidationValidatorTest.php file, except where they have individual classes, which are all separate.