private function RunTestMethod($test_method_name)
{
$error_catcher = $this->getErrorCatcherObject();
$error_catcher->setUp();
$this->resetErrorsExpectations();
$test = $this->start_new_test($test_method_name);
$this->setUp();
$this->assertPreConditions();
$exception_generated = false;
try {
$this->{$test_method_name}();
} catch (\Exception $exception) {
$exception_generated = true;
if (!$this->exception_expected) {
$test->setException($exception);
}
}
if ($this->exception_expected && !$exception_generated) {
$test->setSuccessful(false);
}
if ($error_catcher->hasErrors()) {
if (!$this->error_expected) {
$test->setErrors($error_catcher->getErrors());
}
} else {
if ($this->error_expected) {
$test->setSuccessful(false);
$Error = new Error();
$Error->setMessage("Error is expected but wasn't generated");
$test->setErrors(array($Error));
}
}
$this->assertPostConditions();
$this->tearDown();
if (!$test->isSuccessful()) {
$this->onNotSuccessfulTest();
}
}