public function testBuild() { $logger = new Logger(); $logger->addRecord(new LogRecord(1, 0, Logger::LOGLEVEL_ERROR, 'message', 'text')); $report = new ReportYml(); $report->addSection('file.php', $logger); $this->assertNotEquals('{ }', $report->build()); }
/** * @param $logRecord - Instance of LogRecord */ private function printLogItem($logRecord, $maxMessageLen) { $maxMessageLen += 2; $this->cli->lightGray()->inline(sprintf('%-7s', $logRecord->getLine() . ':' . $logRecord->getColumn())); $format = '%-10s'; $text = Logger::getLevelAsText($logRecord->getLevel()); switch ($logRecord->getLevel()) { case Logger::LOGLEVEL_ERROR: $this->cli->lightRed()->inline(sprintf($format, $text)); break; case Logger::LOGLEVEL_WARNING: $this->cli->lightYellow()->inline(sprintf($format, $text)); break; default: $this->cli->lightGreen()->inline(sprintf($format, $text)); break; } $this->cli->white()->inline(sprintf("%-{$maxMessageLen}s", $logRecord->getMessage()))->lightGray()->inline(sprintf("%s", $logRecord->getName()))->br(); }