Good article. Right now at work, I’ve put off some coding because i know it will be a pain to test. I’ve considered how to write unit tests for this, but since the whole page is procedural, I can’t break it up. If I re-write it as a class or at least functions, I might be able to write a unit test for it.
I recently wrote a unit test for a simple logging class. I realized it didn’t work the same on different versions of PHP, so I decided to make a unit test so I could see where it failed and where to fix.
Test test test!