Uploaded image for project: 'Log4php'
  1. Log4php
  2. LOG4PHP-85

Unittest fail due to changed default of xmlLayout->setLocationInfo

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0
    • 2.0.0
    • Tests
    • None

    Description

      Currently the unit tests on my working copy fail with:

      1) testSocketXml(LoggerAppenderSocketTest)
      Failed asserting that two strings are equal.
      — Expected
      +++ Actual
      @@ -1,5 +1,4 @@
      DRY MODE OF SOCKET APPENDER: <log4php:event logger="TEST" level="ERROR" thread="11857" timestamp="1252964319758">
      <log4php:message><![CDATA[testmessage]]></log4php:message>
      -<log4php:locationInfo class="LoggerLoggingEvent" file="NA" line="NA" method="getLocationInformation" />
      </log4php:event>

      They do not on the current trunk at r814880. On further investigation I found that the output of a LoggerAppenderSocket, which internally uses an LoggerLayoutXML is compared to a pure LoggerLayoutXML.
      The first LoggerAppenderSocket though has locationInfo=false as default and passes this on to the layout. The newly created layout still has this value on true.

      So in fact the test should have failed all the time and does now as I already have the new toBoolean method (see bug 81). A patch would be:

      — src/test/php/appenders/LoggerAppenderSocketTest.php (Revision 814880)
      +++ src/test/php/appenders/LoggerAppenderSocketTest.php (Arbeitskopie)
      @@ -50,6 +50,7 @@

      $appender->setDry(true);
      $appender->setUseXml(true);
      + $appender->setLocationInfo(true);
      $appender->activateOptions();
      $event = new LoggerLoggingEvent("LoggerAppenderSocketTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");

      Attachments

        Activity

          People

            lathspell Christian Brunotte
            lathspell Christian Brunotte
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: