Countless are the times I've had to test for validation errors, and countless are the times I've repeated the same code for this purpose. Duplicating testing code is not always a bad thing though, but for validation errors, I don't know, it doesn't feel right. If it is acceptable to test one FormRequest with duplicated code, it's a sin to do that for a whole project.

Essentially, a data provider is a method that returns data that other tests depend on.

Form validation testing is not the only use-case for data providers though.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners