I understand the significance of the term 'fatal error', but I want to write a test class like this (disgustingly simplified):
class tester {
function execute() {
if( @$this->tryit() === true ) return true;
return false;
}
function tryit() {
$doesntexist = new noobject();
return true;
}
}
actually I'd have a Test
parent class, and then classes would extend it and contain a bunch of methods with a bunch of tests. The parent class would define execute
and it would just run every method in the child class (excluding execute
of course) and collecting data on which functions pass and which fail.
I want to write tests before I actually write part of my code, but instead of using assert
I just want to run every test and generate a list of which functions of which test classes fail. But that means if a test fails it means there was an error -- but I also want to handle instances where I forgot to define a class, etc. Is it possible to do that, while not having the entire script die?
I was thinking that the script would just fail up until the function call with the @
in front of it, and then continue, but obviously I was wrong. Is there a workaround?