public static function test_stats(array $tests)
{
$total = count($tests);
$run = 0;
$pass = 0;
$error = 0;
foreach ($tests as $test_name => $tdata) {
if ($tdata['pass']) {
$pass++;
}
if ($tdata['run']) {
$run++;
}
$error += count($tdata['errors']);
}
return compact('total', 'pass', 'run', 'error');
}