public function onAfterRun(RunEvent $e) { $result = $e->getLastResult(); // Draw a symbol if ($result instanceof Success) { $this->console->write('.', Color::GREEN); } elseif ($result instanceof Failure) { $this->console->write('F', Color::WHITE, Color::RED); } elseif ($result instanceof Warning) { $this->console->write('!', Color::YELLOW); } else { $this->console->write('?', Color::YELLOW); } $this->pos++; // Check if we need to move to the next line if ($this->gutter > 0 && $this->pos > $this->width - $this->gutter) { $this->console->write(str_pad(str_pad($this->iter, $this->countLength, ' ', STR_PAD_LEFT) . ' / ' . $this->total . ' (' . str_pad(round($this->iter / $this->total * 100), 3, ' ', STR_PAD_LEFT) . '%)', $this->gutter, ' ', STR_PAD_LEFT)); $this->pos = 1; } $this->iter++; }
public function onAfterRun(RunEvent $e) { $test = $e->getTarget(); $result = $e->getLastResult(); $descr = ' ' . $test->getLabel(); if ($message = $result->getMessage()) { $descr .= ': ' . $result->getMessage(); } if ($this->displayData && ($data = $result->getData())) { $descr .= PHP_EOL . str_repeat('-', $this->width - 15); $data = $result->getData(); if (is_object($data) && $data instanceof \Exception) { $descr .= PHP_EOL . get_class($data) . PHP_EOL . $data->getMessage() . $data->getTraceAsString(); } else { $descr .= PHP_EOL . @var_export($result->getData(), true); } $descr .= PHP_EOL . str_repeat('-', $this->width - 15); } // Draw status line if ($result instanceof Success) { $this->console->write(' '); $this->console->write(' OK ', Color::NORMAL, Color::GREEN); $this->console->writeLine($this->strColPad($descr, $this->width - 15, ' '), Color::GREEN); } elseif ($result instanceof Failure) { $this->console->write(' '); $this->console->write(' FAIL ', Color::WHITE, Color::RED); $this->console->writeLine($this->strColPad($descr, $this->width - 15, ' '), Color::RED); } elseif ($result instanceof Warning) { $this->console->write(' '); $this->console->write(' WARN ', Color::NORMAL, Color::YELLOW); $this->console->writeLine($this->strColPad($descr, $this->width - 15, ' '), Color::YELLOW); } else { $this->console->write(' '); $this->console->write(' ???? ', Color::NORMAL, Color::YELLOW); $this->console->writeLine($this->strColPad($descr, $this->width - 7, ' '), Color::YELLOW); } $this->console->writeLine(); }