public function error(LimeError $error) { parent::error($error); $this->printError($error); }
public function __construct(LimeConfiguration $configuration) { parent::__construct(); $this->configuration = $configuration; }
/** * (non-PHPdoc) * @see lib/output/LimeOutputInterface#close() */ public function close() { parent::close(); if (!is_null($file = $this->getCurrentFile())) { $path = $this->truncate($file); $prefix = ''; if (!is_null($this->loader)) { $labels = $this->loader->getFileByPath($file)->getLabels(); if (count($labels) > 0) { $prefix = '[' . implode(',', $labels) . '] '; } } if (strlen($path) > 71 - strlen($prefix)) { $path = substr($path, -(71 - strlen($prefix))); } if ($prefix) { $this->printer->printText(trim($prefix), LimePrinter::LABEL); $path = ' ' . $path; } $this->printer->printText(str_pad($path, 73 - strlen($prefix), '.')); if (!$this->files[$file]->success) { $this->printer->printLine("not ok", LimePrinter::NOT_OK); } else { $this->printer->printLine("ok", LimePrinter::OK); } if (count($this->_failures[$file])) { $this->printer->printLine(' Failed Tests:', LimePrinter::COMMENT); $i = 0; foreach ($this->_failures[$file] as $number => $failed) { if (!$this->configuration->getVerbose() && $i > 2) { $this->printer->printLine(sprintf(' ... and %s more', count($this->_failures[$file]) - $i)); break; } $this->printer->printLine(' not ok ' . $number . ' - ' . $failed[0]); ++$i; } } if (count($this->_errors[$file])) { $this->printer->printLine(' Errors:', LimePrinter::COMMENT); foreach ($this->_errors[$file] as $i => $error) { if (!$this->configuration->getVerbose() && $i > 2) { $this->printer->printLine(sprintf(' ... and %s more', count($this->_errors[$file]) - $i)); break; } $this->printer->printLine(' ' . $error->getMessage()); if ($this->configuration->getVerbose()) { $this->printer->printText(' (in '); $this->printer->printText($this->truncate($error->getFile()), LimePrinter::TRACE); $this->printer->printText(' on line '); $this->printer->printText($error->getLine(), LimePrinter::TRACE); $this->printer->printLine(')'); } } } if (count($this->_todos[$file])) { $this->printer->printLine(' TODOs:', LimePrinter::COMMENT); foreach ($this->_todos[$file] as $i => $todo) { if (!$this->configuration->getVerbose() && $i > 2) { $this->printer->printLine(sprintf(' ... and %s more', count($this->_todos[$file]) - $i)); break; } $this->printer->printLine(' ' . $todo); } } } }