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

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners