Creating a fake user in Symfony2 for testing purposes Creating a fake user in Symfony2 for testing purposes symfony symfony

Creating a fake user in Symfony2 for testing purposes


Fixtures on a test environment configuration are probably the way to go!

About the fixtures being application-wide comment, I disagree.

If you were unit testing, maybe that would make a lot of sense.

Functional tests, however, are supposed to be application-wide.


I just write test data builders myself, because there is almost no boilerplate anyway. BTW, Factory Girl is an implementation of that very pattern.

You can find a good discussion of the pattern and a lot of other useful stuff in the Growing Object-Oriented Software, Guided by Tests book.

And I recommend against fixtures, because they are application-wide. Each test better prepare only the data it needs for itself.


I use fixtures for functional tests but i disagree that they are application wide only. Im using it bundle-wide, defined in proper dirs in bundles. On test setup i run console fixtures:load method from proper directory and maybe not best solution but it works good for me. If anyone have better solution i would happily read about it :)