thephpleague / factory-muffin

Enables the rapid creation of objects for testing
https://factory-muffin.thephpleague.com/
MIT License
531 stars 72 forks source link

Add tests demonstrating inconsistent attribute definition overwrites #380

Closed jsyi closed 9 years ago

jsyi commented 9 years ago

Rewrite of test from #379 for 3.0: rewrote for new interface and changed to match short array syntax style.

@GrahamCampbell This doesn't need to be merged, but I'm creating the PR just to follow up. It seems 3.0 already "corrects" the behavior so its definition overwrites behave like #379 and not 2.1 already.

Cheers! :beers:


When passing attribute definitions to create()/instance() it is unclear from the documentation how conflicts between the passed definitions and definitions created by calls to define() should be resolved.

testDefineWithReplacementGeneratorsOverwrite() demonstrates what I intuit to be expected behavior: the definitions passed to create() overwrite previous definitions.

testGroupDefineWithReplacementGeneratorsOverwrite() demonstrates behavior that conflicts with the above. The definition defined by the group factory overwrites the definitions passed in to create().

GrahamCampbell commented 9 years ago

Thanks @jsyi. The documentation needs improving for 3.0. I'd appreciate contributions to the documentation if you've got any time. :) Writing a full upgrading guide from 2.1 to 3.0 is still on my todo list too.