public function afterExample(ExampleEvent $event)
{
$io = $this->getIO();
$eventsCount = $this->getStatisticsCollector()->getEventsCount();
if ($eventsCount === 1) {
$io->writeln();
}
switch ($event->getResult()) {
case ExampleEvent::PASSED:
$io->write('<passed>.</passed>');
break;
case ExampleEvent::PENDING:
$io->write('<pending>P</pending>');
break;
case ExampleEvent::SKIPPED:
$io->write('<skipped>S</skipped>');
break;
case ExampleEvent::FAILED:
$io->write('<failed>F</failed>');
break;
case ExampleEvent::BROKEN:
$io->write('<broken>B</broken>');
break;
}
$remainder = $eventsCount % 50;
$endOfRow = 0 === $remainder;
$lastRow = $eventsCount === $this->examplesCount;
if ($lastRow && !$endOfRow) {
$io->write(str_repeat(' ', 50 - $remainder));
}
if ($lastRow || $endOfRow) {
$length = strlen((string) $this->examplesCount);
$format = sprintf(' %%%dd / %%%dd', $length, $length);
$io->write(sprintf($format, $eventsCount, $this->examplesCount));
if ($eventsCount !== $this->examplesCount) {
$io->writeln();
}
}
}