public function testEcho()
 {
     $appender = new LoggerAppenderEcho("myname ");
     $layout = new LoggerLayoutSimple();
     $appender->setLayout($layout);
     $appender->activateOptions();
     $event = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
     ob_start();
     $appender->append($event);
     $v = ob_get_contents();
     ob_end_clean();
     $e = "ERROR - testmessage\n";
     self::assertEquals($v, $e);
 }
 public function testEchoHtml()
 {
     $appender = new LoggerAppenderEcho("myname ");
     $appender->setHtmlLineBreaks(true);
     $layout = new LoggerLayoutSimple();
     $appender->setLayout($layout);
     $appender->activateOptions();
     // Single line message
     $event = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
     $expected = "ERROR - testmessage<br />" . PHP_EOL;
     ob_start();
     $appender->append($event);
     $actual = ob_get_clean();
     self::assertEquals($expected, $actual);
     // Multi-line message
     $msg = "This message\nis in several lines\r\nto test various line breaks.";
     $expected = "ERROR - This message<br />\nis in several lines<br />\r\nto test various line breaks.<br />" . PHP_EOL;
     $event = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), $msg);
     ob_start();
     $appender->append($event);
     $actual = ob_get_clean();
     self::assertEquals($expected, $actual);
 }
 public function testOverwriteLayout()
 {
     $layout = new LoggerLayoutSimple();
     $appender = new LoggerAppenderEcho("LoggerAppenderTest");
     $appender->setLayout($layout);
     $actual = $appender->getLayout();
     $this->assertEquals($layout, $actual);
 }
 public function testSetFilter()
 {
     $appender = new LoggerAppenderEcho("LoggerAppenderTest");
     $layout = new LoggerLayoutSimple();
     $appender->setLayout($layout);
     $filter = new LoggerFilterDenyAll();
     $appender->addFilter($filter);
     $filter2 = new LoggerFilterLevelMatch();
     $appender->addFilter($filter2);
     $first = $appender->getFilter();
     self::assertEquals($first, $filter);
     $next = $first->getNext();
     self::assertEquals($next, $filter2);
     $appender->clearFilters();
     $nullfilter = $appender->getFilter();
     self::assertNull($nullfilter);
 }