My First Unit Test
I finally figured out the trouble I was having with the unit test for my bugfix. It’s one of those things where I still don’t exactly understand why doing what I did made everything work, but I’ll accept it and do the dance of victory.
What happened was I got the test all set up, populating the database with a fake album with five images, then calling the function I just fixed to give me five random images from that album. Before doing this I rigged the next call to rand() to return a Very High Number, such that when the original query is fired, it will definitely not return all of the images, and my new added requery will be required. This was all well and good, but when I ran the test, it kept telling me it was getting back 0 images when it asked for 5. First I thought I needed to force an update of the ImageBlockCache, which is where the random numbers are checked, but it turns out all I needed to do was to generate derivative thumbnails for the test data after I insert it. Whodathunk?

Now that everything is working, though, the unit test is pretty darn cool. Red light before my bugfix, and green light afterwards. Nothing like color-based motivation.
Aug 12th 2008
Hey mate, just wondering whats going on with the project, you dont seem to have updated for a while and I was wondering if your still going through with it?
Thanks.
Big Rich.
Aug 12th 2008
Big Rich: I’m in the final stretch of the project. I’ve been working all summer, but it looks like this blog didn’t make its way into my regular documentation :). I’ve added a link to the wiki page dedicated to the module on the side.