public function testWarnLayout()
 {
     $event = new LoggerLoggingEvent("LoggerLayoutXml", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
     $layout = new LoggerLayoutXml();
     $v = $layout->format($event);
     $e = "<log4php:event logger=\"TEST\" level=\"WARN\" thread=\"" . $event->getThreadName() . "\" timestamp=\"" . number_format((double) ($event->getTimeStamp() * 1000), 0, '', '') . "\">" . PHP_EOL . "<log4php:message><![CDATA[testmessage]]></log4php:message>" . PHP_EOL . "<log4php:locationInfo class=\"LoggerLoggingEvent\" file=\"NA\" line=\"NA\" " . "method=\"getLocationInformation\" />" . PHP_EOL . "</log4php:event>\n" . PHP_EOL;
     self::assertEquals($v, $e);
 }
 public function testMDC()
 {
     LoggerMDC::put('foo', 'bar');
     LoggerMDC::put('bla', 'tra');
     $event = LoggerTestHelper::getErrorEvent("testmessage");
     $layout = new LoggerLayoutXml();
     $layout->activateOptions();
     $actual = $layout->format($event);
     $thread = $event->getThreadName();
     $timestamp = number_format($event->getTimeStamp() * 1000, 0, '', '');
     $expected = "<log4php:event logger=\"test\" level=\"ERROR\" thread=\"{$thread}\" timestamp=\"{$timestamp}\">" . PHP_EOL . "<log4php:message><![CDATA[testmessage]]></log4php:message>" . PHP_EOL . "<log4php:properties>" . PHP_EOL . "<log4php:data name=\"foo\" value=\"bar\" />" . PHP_EOL . "<log4php:data name=\"bla\" value=\"tra\" />" . PHP_EOL . "</log4php:properties>" . PHP_EOL . "<log4php:locationInfo class=\"LoggerLoggingEvent\" file=\"NA\" line=\"NA\" " . "method=\"getLocationInformation\" />" . PHP_EOL . "</log4php:event>" . PHP_EOL;
     self::assertEquals($expected, $actual);
     LoggerMDC::clear();
 }
 public function testSocketXml()
 {
     $appender = new LoggerAppenderSocket("myname ");
     $appender->setDry(true);
     $appender->setUseXml(true);
     $appender->setLocationInfo(true);
     $appender->activateOptions();
     $event = new LoggerLoggingEvent("LoggerAppenderSocketTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
     ob_start();
     $appender->append($event);
     $v = ob_get_contents();
     ob_end_clean();
     $layout = new LoggerLayoutXml();
     $layout->setLog4jNamespace(false);
     $layout->activateOptions();
     $a = $layout->format($event);
     $e = "DRY MODE OF SOCKET APPENDER: " . $a;
     self::assertEquals($e, $v);
 }