public function write(Test $test, array $stats)
{
$cells = [$test];
$isIncomplete = false;
foreach ($stats as $targetName => $result) {
if (!$result instanceof \Exception) {
$this->summary['total'][$targetName] += $result;
$cells[$targetName] = sprintf('%.4f', $result);
continue;
}
$isIncomplete = true;
if ($result instanceof TestSkippedException) {
$this->summary['skipped'][$targetName]++;
$cells[$targetName] = self::STATUS_SKIPPED;
} else {
$this->summary['failed'][$targetName]++;
$cells[$targetName] = self::STATUS_FAILED;
}
}
if ($this->ignoreIncomplete && $isIncomplete) {
foreach ($stats as $targetName => $result) {
$value = $cells[$targetName];
if (self::STATUS_SKIPPED === $value || self::STATUS_FAILED === $value) {
continue;
}
$cells[$targetName] = self::STATUS_IGNORED;
$this->summary['total'][$targetName] -= $result;
$this->summary['ignored'][$targetName]++;
}
}
$this->writeRow($cells, '.');
}