public function silentTest($test_obj = null)
{
if (!$test_obj) {
$test_obj = $this;
}
$total = $success = $fail = $exception = 0;
$speed = $memory = 0;
$tested = array();
$failures = array();
foreach (get_class_methods($test_obj) as $method) {
if (strpos($method, 'test_') === 0) {
$m = substr($method, 5);
} elseif (strpos($method, 'prepare_') === 0) {
$m = substr($method, 8);
} else {
continue;
}
if ($tested[$m]) {
continue;
}
$tested[$m] = true;
foreach ($this->variances as $key => $vari) {
if (is_numeric($key)) {
$key = $vari;
}
// Input is a result of preparation function
try {
if (method_exists($test_obj, 'prepare_' . $m)) {
$input = $test_obj->{'prepare_' . $m}($vari, $method);
} else {
if ($test_obj instanceof AbstractObject && $test_obj->hasMethod('prepare') || method_exists($test_obj, 'prepare')) {
$input = $test_obj->prepare($vari, $method);
} else {
$input = null;
}
}
} catch (Exception $e) {
if ($e instanceof Exception_SkipTests) {
return array('skipped' => $e->getMessage());
}
throw $e;
}
$this->input = $input;
$test_func = method_exists($test_obj, 'test_' . $m) ? 'test_' . $m : 'test';
++$total;
$me = memory_get_peak_usage();
$ms = microtime(true);
$this->cnt = 0;
declare (ticks=1);
register_tick_function(array($this, 'ticker'));
try {
$result = $this->executeTest($test_obj, $test_func, $input);
$ms = microtime(true) - $ms;
$me = ($mend = memory_get_peak_usage()) - $me;
$result = $this->formatResult($row, $key, $result);
$k = $key . '_' . $m;
if ($this->proper_responses[$k] == $result && isset($this->proper_responses[$k])) {
++$success;
} else {
$failures[] = $method;
++$fail;
}
} catch (Exception $e) {
if ($e instanceof Exception_SkipTests) {
return array('skipped' => $e->getMessage());
}
++$exception;
//$ms=microtime(true)-$ms;
$me = ($mend = memory_get_peak_usage()) - $me;
}
unregister_tick_function(array($this, 'ticker'));
$speed += $this->cnt * 1;
$memory += $me;
}
}
return array('total' => $total, 'failures' => $failures, 'success' => $success, 'exception' => $exception, 'fail' => $fail, 'speed' => $speed, 'memory' => $memory);
}