Source: travis-weston.medium.com

Using Custom Fakers in Laravel Feature Tests
I’m not going to lie. Not that it was very difficult, but because it just isn’t well documented — which is odd for anything in Laravel, frankly.

The way this is han dled currently is to take a CSV of all print subscribers, and manually add those to the digital subscription system once a month.

Easy enough, I thought, I’ll just write up a really simple Faker that will create a CSV file in that format, upload it to a fake disk that my system will access, and then I can run some assertions based on the contents of that CSV.

If this article was interesting to you, you’re going to love the stream of tech-consciousness that is my Twitter feed.
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