Testing a procedure script...
Posted: Sun Aug 28, 2005 10:58 pm
I have a rather short, procedural script. I've been bad and wrote it without using TDD, but I'm not really sure how to test a pure procedure script.
This is the very front-end of my Front Controller. It needs to be a top level script for legacy reasons.
Its simple, so I can almost say "I don't need no unit-tests" and trust that it'll get well exercised via the integration/web-tests. But that feels a little bit like laziness/lack of creativity. And its problably still buggy as it hasn't been written with TDD and it hasn't been hooked up to the webserver for ithose integration tests....
This is the very front-end of my Front Controller. It needs to be a top level script for legacy reasons.
Code: Select all
require_once('classes/controllers/FrontDispatcher.inc');
$dispatcher= new FrontDispatcher();
$dispatcher->addModule("SlidingDoorsAdmin","|register/[-A-Za-z0-9_]*/admin|");
$view = $dispatcher->dispatch($_SERVER["REQUEST_URI"]);
if (0!=$view) {
echo $view;
exit;
}
/** Fall back to the legacy, pure scripts */
require_once($_SERVER["REQUEST_URI"]);
exit;