Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Object Mother Support (Fixture Factory) #36

Closed
HelloGrayson opened this issue Apr 12, 2012 · 6 comments
Closed

Object Mother Support (Fixture Factory) #36

HelloGrayson opened this issue Apr 12, 2012 · 6 comments

Comments

@HelloGrayson
Copy link

It seems that Faker could be an exceptional candidate for Fixture Factory support. This was originally made popular by Martin Fowler's Object Mother Pattern and has since been adopted in popular ruby packages like Factory Girl and Object Daddy. Here's a great Blog Post on the benefits of Factories over Fixtures.

There appears to be one such attempt in PHP land, namely in the Xi Project. https://github.com/xi-project/xi-doctrine. See FixtureFactory. Faker already has the ability to create fixtures and has ORM/ODM providers. With a little work, we could provide a very solid Object Mother that makes testing incredibly succinct.

@fzaninotto
Copy link
Owner

I understand that a Fixture Factory can take great advantage of a fake data generator, but I think porting something like Factory Girl to PHP goes beyond the boundaries of Faker itself.

Maybe another project? Would you like to extract FixtureFactory from xi-doctrine, make it ORM-agnostic, and publish it to GitHub? I'd be willing to help with the Faker integration in that case.

@HelloGrayson
Copy link
Author

ok - got a mini project going. will port the good parts of xi-doctrine fixture factory and try to get a little closer to the actual Factory Girl implementation from Ruby. If I make FactoryGirl totally ORM-agnostic do you think we'll be able to make use of the different Faker providers?

https://github.com/breerly/factory-girl-php

@HelloGrayson
Copy link
Author

Hey @fzaninotto - is ORM support new? Are you thinking about adding support for sequences? Thx

@fzaninotto
Copy link
Owner

Hi,

No, it is not new. What exactlyu would you want that Faker handles on sequences? ORMs usually deal with that themselves.

@HelloGrayson
Copy link
Author

See FieldDef::sequence here https://github.com/breerly/factory-girl-php#tutorial

@HelloGrayson
Copy link
Author

cc @fzaninotto - can you check the link i posted? I think you're not understanding what I mean perhaps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants