First, having to specialize a class with the name seems somewhat redundant to me... Why can't such a class not take a name, and simply run all of its test methods? For those times when you need to run only a single test I would then add a ->runOne($name) function. (Or do it the other way around... run($name) and runAll().)
The TestSuite seems somewhat redundant. So does TestRunner. I think that the
Not a big deal, but I don't like the name runBare()... it should perhaps be something like _run() or _performTest(), as it is merely a helper function for not calling ->setup() and teardown().
Finally, also useful would be a global function to run all Tests by finding all test classes.
Something like:
function runGlobal() {
// PHP4!
foreach (get_declared_classes() as $class) {
if (is_subclass($class, "testcase")) {
$obj = new $class();
$obj->runAll();
}
}
}
Just some comments on the code...
First, having to specialize a class with the name seems somewhat redundant to me... Why can't such a class not take a name, and simply run all of its test methods? For those times when you need to run only a single test I would then add a ->runOne($name) function. (Or do it the other way around... run($name) and runAll().)
The TestSuite seems somewhat redundant. So does TestRunner. I think that the
Not a big deal, but I don't like the name runBare()... it should perhaps be something like _run() or _performTest(), as it is merely a helper function for not calling ->setup() and teardown().
Finally, also useful would be a global function to run all Tests by finding all test classes.
Something like:
function runGlobal() {
// PHP4!
foreach (get_declared_classes() as $class) {
if (is_subclass($class, "testcase")) {
$obj = new $class();
$obj->runAll();
}
}
}
With is_subclass being defined... see the comments http://www.php.net/manual/en/function.is-subclass-of.php
Those are just a couple things off the top of my head... I'm thinking it may be useful to write my own version and we can compare notes...