thephpleague/factory-muffin — pull request #247 by GrahamCampbell (2014-08-07 12:32:07+00:00)
Title: [2.1] Multiple Factory Definitions

### This pull request tracks the development of feature:
* You may discuss this feature here, on this pull request.
* Please send pull requests for this feature to the `feature/multiple` branch.
* This branch will be merged into the master once everyone is happy with this feature.
* It must have complete tests and documentation before it is merged.

### Initial proposal:

> While implementing this into one of our systems, I have been thinking about better ways to handle things on bigger/more complex codebases.

> I think we could benefit from having "factory groups". So for example, say we have a bunch of tests around an ACL system, and we have a model called User. This User model may require very different data to any other tests that use the User model. Obviously this could be achieved by passing replacement params, but that could get messy.

### Usage example:

> So:
>
> ```php
> FactoryMuffin::define('User', array(
> 'username' => 'string'
> ));
> ```
>
> And then:
>
> ```php
> FactoryMuffin::define('acl:User', array(
> 'email' => 'email'
> ));
> ```
>
> Which results in:
> ```
> FactoryMuffin::create('acl:User');
> [username] => 'blahblah',
> [email] => 'email@blahblah.com'
> ```