Fixturize Shell - Generate your fixtures automatically

Posted by Felix Geisendörfer, on Sep 05, 2008 - in PHP & CakePHP » Controllers, Components & Shells

Hey folks,

this is post #17 of my 30 day challenge.

When you start writing unit tests or using the fixtures shell we published a while back you might be quite annoyed about something. The fact that typing in all those fixture data is not really efficient. In order to make our lives a little easier, we came up with a shell that takes any database table of yours, and creates the PHP fixture code for you automatically.

You can download the: Fixturize Shell at the Debuggable Scraps repository. Further documentation can be found in the git repositories readme file as always.

Usage is a simple as this:

cd cake/console
./cake fixturize posts

This will create a file called app/tests/fixtures/post_fixture.php for you that holds all of your posts tables records. Additional documentation can be found in the github readme.textile file as always.

If you have any questions or want to comment, feedback is welcome!

-- Felix Geisendörfer aka the_undefined