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
6 Comments
thank you very much ;)
_________________________
http://www.aybardumlu.com
felix, i was suppose to write something like this for a few days (even talked about it on #cakephp)... ande i look at the rss reader and such a pleasent suprise awaits me!
thanks mate!
more testsuite tips! ;)
Now that is one very useful piece of code - I will be using it a lot - Thanks
Nice Felix! But I have a table with 10.000 records. I don't need all 10.000 for a good testcase. And I can't set the lmit to a number. I already did in the scipt, but would be nice to give it as an argument on the commandline.
Cheers!
Great tool. I just finished modifying it to output the schema and limit the amount of records. Felix: It should be in your inbox.


hello, I like the idea very much! it's something probably everyone missed but somehow nobody has come with this handy solution before you.
thx! regards
danielz