public function testSimpleLayout() { $event = new LoggerLoggingEvent("LoggerLayoutSimpleTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage"); $layout = new LoggerLayoutSimple(); $actual = $layout->format($event); $expected = "ERROR - testmessage" . PHP_EOL; self::assertEquals($expected, $actual); }
public function testSimpleLayout() { $event = new LoggerLoggingEvent("LoggerLayoutSimpleTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage"); $layout = new LoggerLayoutSimple(); $v = $layout->format($event); $e = "ERROR - testmessage\n"; self::assertEquals($v, $e); }
public function assertLog($console, $expectedMessage, $logLevel, $calledMethod) { $event = $this->createEvent($expectedMessage, $logLevel); $layout = new LoggerLayoutSimple(); $message = $layout->format($event); $this->assertEquals($message, $console->getMessage(), 'log message is wrong'); $this->assertEquals(1, $console->getCalls(), 'wasn\'t called once'); $this->assertEquals($calledMethod, $console->getCalledMethod(), 'wrong log-method was called'); }
public function testRenderMessageAndException() { $logger = new Logger("testLogger"); $layout = new LoggerLayoutSimple(); $ex = new LoggerLayoutSimpleTestException("exception"); $this->assertEquals('testLogger [INFO] - test exception' . PHP_EOL, $layout->formatMessage($logger, Logger::INFO, "test", $ex)); }