PHPUnit
Posted on April 13, 2006
Filed Under /dev/null/ | 48 views |
Yesterday I started using PHPUnit for the first time and over the past 24 it has sold me on its merits. Before this I just wrote my tests by hand but having a comprehensive framework makes life so much better.
That said, it was a bear to get installed and working with the project I’m currently developing, though not all entirely it’s fault since I was also porting a bunch of existing code from PHP 4 syntax to PHP 5 syntax at the same time.
Annoyingly include paths for the web server and those required when running against the command line phpunit util are different (one based on the web server, the other on the file system) which means having to define the include paths for your web pages and test cases seperately.
A snag I also ran into that had me digging line-by-line through ADODB at 5am this morning was that in PHP 5 all global variables must be declared global all the time (this wasn’t the case in PHP 4 - you used to be able to just set the variable and then define it as global in the function you wanted to use it in). I’m not a fan of globals but the three cases where I do need them, it took hours to track that one down.
But it all works now and it is fun stuff indeed.
Comments
Leave a Reply