Category: Laravel, api

Over my past couple of full time gigs - and in side projects - I've had cause to work with fixture data in my test suites. Fixtures are incredibly useful when you want to validate your application takes the correct approach when it comes to known-good inputs into the application. In addition, using test fixtures allows you to work with this known-good data without having to hit external APIs such as creating customers in Stripe, or accepting webhooks from GitHub.

As our fixture data comes from a static JSON file, there's a bit of wrangling involved in manipulating the data if we want to work with factory models in a more meaningful way.

I think that the benefit of a more streamlined test experience, coupled with not having to deal with mixing arrays and objects in data access, is worth the trade off in this scenario.
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