Setting up similar factories with Laracasts/TestDummy

I’ve been using laracasts/Testdummy a lot recently which is a great tool for setting up any testing you’re doing. It auto-generates your Laravel 5 models with faker data.

However, sometimes when you’re setting up a very similar named model it becomes laborious copying and pasting the same things across multiple instances with the same default data.

So here’s my super easy “pattern” so you’re not creating too much. All it relies on is using the array_merge to overwrite the default set.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s