So mcurry’s test sample code for CakePHP works – I had to very carefully pick through my code to get it following it exactly. But it does make for much cleaner and smaller test code than the mess that was described in the docs until, apparently, just today, and that RC3 generates, and that doesn’t work.

So I went ahead and modified cake/console/libs/tasks/model.php to generate test cases & fixtures in the form of mcurry’s samples, but it seems I was beaten to the punch. In addition to the update to the doc site, RC4 has come along, and it also turns out that the current SVN version uses the ClassRegistry::init method to instantiate a model for test (as opposed to the older, crappy method of creating a derived class from it and overriding its database settings). I’d like to think this has come about so suddenly in some part due to my bitching, but even if it were so the Cake devs would never admit to such a thing, as it would make it look like they actually give a rat’s ass, which would cut into their image.

I also modified the part that generates fixtures to use the new $import method to get the database schema from your models’ tables. But from what I’m told, most still think that generating a completely redundant (and now, totally unnecessary) representation of your database schema, such that your fixtures will break if you make changes to database tables, is totally not a problem. So there’s little interest in me contributing this small change, that was so easy to do that one has to wonder why it wasn’t done sooner, to the framework. Darn. I was hoping I could join that elite club of smug developers who get to sit in IRC channels hurling insult and snark at people with support questions. As always in my life, my admission to the cool kids’ table has been denied yet again.

I’m told it’s bad form to hack core files in the framework like I did (though why some guy in an IRC channel thinks he has any reason to give a crap about what I do in my own project is beyond me), and that you should put them in app instead, but I’m not seeing a console directory under app. So if you want to use my new model baker, you can go right ahead. Download it (right-click that link, save, and rename appropriately; or, just click and copy-paste) and try putting it at app/console/libs/tasks/model.php – if the cake console doesn’t pick it up there, be naughty and jam it into cake/console/libs/tasks/model.php, I won’t tell on you.

Charlie Schiz

Charlie Schiz
When the going gets weird, the weird turn pro. I've been weird all my life. It's my time to shine.

Lid 11 in Their Own Words redux

The story begins with teenage me purchasing a homemade cassette tape that caughtmy eye in the record store I then frequented. Its title, ...… Continue reading

MUSICIAN/Into The Cove split/collab

Published on August 03, 2020

Back at it like a crack addict baby!

Published on August 03, 2020