logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ihabu...@apache.org
Subject [28/43] Fixed code formatting to conform to PSR-2
Date Thu, 28 Nov 2013 16:03:58 GMT
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/Pattern/PatternConverterTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Pattern/PatternConverterTest.php b/tests/src/Pattern/PatternConverterTest.php
index e491dba..a458369 100644
--- a/tests/src/Pattern/PatternConverterTest.php
+++ b/tests/src/Pattern/PatternConverterTest.php
@@ -27,19 +27,14 @@ use Apache\Log4php\Logger;
 use Apache\Log4php\MDC;
 use Apache\Log4php\NDC;
 
-use Apache\Log4php\Pattern\ClassConverter;
 use Apache\Log4php\Pattern\CookieConverter;
 use Apache\Log4php\Pattern\DateConverter;
 use Apache\Log4php\Pattern\EnvironmentConverter;
-use Apache\Log4php\Pattern\FileConverter;
 use Apache\Log4php\Pattern\LevelConverter;
-use Apache\Log4php\Pattern\LineConverter;
 use Apache\Log4php\Pattern\LiteralConverter;
-use Apache\Log4php\Pattern\LocationConverter;
 use Apache\Log4php\Pattern\LoggerConverter;
 use Apache\Log4php\Pattern\MdcConverter;
 use Apache\Log4php\Pattern\MessageConverter;
-use Apache\Log4php\Pattern\MethodConverter;
 use Apache\Log4php\Pattern\NdcConverter;
 use Apache\Log4php\Pattern\NewLineConverter;
 use Apache\Log4php\Pattern\ProcessConverter;
@@ -49,367 +44,392 @@ use Apache\Log4php\Pattern\ServerConverter;
 use Apache\Log4php\Pattern\SessionConverter;
 use Apache\Log4php\Pattern\SessionIdConverter;
 use Apache\Log4php\Pattern\SuperglobalConverter;
-use Apache\Log4php\Pattern\ThrowableConverter;
-
 
 use Apache\Log4php\Tests\TestHelper;
 
 /** Converter referencing non-existant superglobal variable. */
-class InvalidSuperglobalConverter extends SuperglobalConverter {
-	protected $name = '_FOO';
+class InvalidSuperglobalConverter extends SuperglobalConverter
+{
+    protected $name = '_FOO';
 }
 
 /**
  * @group pattern
  */
-class PatternConverterTest extends \PHPUnit_Framework_TestCase {
-
-	/**
-	 * A logging event for testing.
-	 * @var LoggingEvent
-	 */
-	private $event;
-
-	/**
-	 * Fromatting info used with the logging event.
-	 * @var LoggerFormattingInfos
-	 */
-	private $info;
-
-	public function __construct() {
-		$this->event = TestHelper::getInfoEvent('foobar');
-		$this->info = new FormattingInfo();
-	}
-
-	public function testCookie() {
-		// Fake a couple of cookies
-		$_COOKIE['test1'] = 'value1';
-		$_COOKIE['test2'] = 'value2';
-
-		$converter = new CookieConverter($this->info, 'test1');
-		$actual = $converter->convert($this->event);
-		$expected = 'value1';
-		self::assertSame($expected, $actual);
-
-		$converter = new CookieConverter($this->info, 'test2');
-		$actual = $converter->convert($this->event);
-		$expected = 'value2';
-		self::assertSame($expected, $actual);
-
-		$converter = new CookieConverter($this->info);
-		$actual = $converter->convert($this->event);
-		$expected = "test1=value1, test2=value2";
-		self::assertSame($expected, $actual);
-	}
-
-	public function testDate() {
-		$converter = new DateConverter($this->info, 'c');
-		$actual = $converter->convert($this->event);
-		$expected = date('c', $this->event->getTimeStamp());
-		self::assertSame($expected, $actual);
-
-		// Format defaults to 'c'
-		$converter = new DateConverter($this->info);
-		$actual = $converter->convert($this->event);
-		$expected = date('c', $this->event->getTimeStamp());
-		self::assertSame($expected, $actual);
-
-		$converter = new DateConverter($this->info, '');
-		$actual = $converter->convert($this->event);
-		$expected = date('c', $this->event->getTimeStamp());
-		self::assertSame($expected, $actual);
-
-		// Test ABSOLUTE
-		$converter = new DateConverter($this->info, 'ABSOLUTE');
-		$actual = $converter->convert($this->event);
-		$expected = date('H:i:s', $this->event->getTimeStamp());
-		self::assertSame($expected, $actual);
-
-		// Test DATE
-		$converter = new DateConverter($this->info, 'DATE');
-		$actual = $converter->convert($this->event);
-		$expected = date('d M Y H:i:s.', $this->event->getTimeStamp());
-
-		$timestamp = $this->event->getTimeStamp();
-		$ms = floor(($timestamp - floor($timestamp)) * 1000);
-		$ms = str_pad($ms, 3, '0', STR_PAD_LEFT);
-
-		$expected .= $ms;
-
-		self::assertSame($expected, $actual);
-	}
-
-	public function testEnvironment() {
-		// Fake a couple of environment values
-		$_ENV['test1'] = 'value1';
-		$_ENV['test2'] = 'value2';
-
-		$converter = new EnvironmentConverter($this->info, 'test1');
-		$actual = $converter->convert($this->event);
-		$expected = 'value1';
-		self::assertSame($expected, $actual);
-
-		$converter = new EnvironmentConverter($this->info, 'test2');
-		$actual = $converter->convert($this->event);
-		$expected = 'value2';
-		self::assertSame($expected, $actual);
-	}
-
-	public function testLevel() {
-		$converter = new LevelConverter($this->info);
-		$actual = $converter->convert($this->event);
-		$expected = $this->event->getLevel()->toString();
-		self::assertEquals($expected, $actual);
-	}
-
-	public function testLiteral() {
-		$converter = new LiteralConverter('foo bar baz');
-		$actual = $converter->convert($this->event);
-		$expected = 'foo bar baz';
-		self::assertEquals($expected, $actual);
-	}
-
-	public function testLoggerWithoutOption() {
-		$event = TestHelper::getInfoEvent('foo', 'TestLoggerName');
-		$converter = new LoggerConverter($this->info);
-
-		$actual = $converter->convert($event);
-		$expected = 'TestLoggerName';
-		self::assertEquals($expected, $actual);
-	}
-
-	public function testLoggerWithOption0() {
-		$event = TestHelper::getInfoEvent('foo', 'TestLoggerName');
-		$converter = new LoggerConverter($this->info, '0');
-
-		$actual = $converter->convert($event);
-		$expected = 'TestLoggerName';
-		self::assertEquals($expected, $actual);
-	}
-
-	public function testLocation() {
-		$config = TestHelper::getEchoPatternConfig("%file:%line:%class:%method");
-		Logger::configure($config);
-
-		// Test by capturing output. Logging methods of a Logger object must
-		// be used for the location info to be formed correctly.
-		ob_start();
-		$log = Logger::getLogger('foo');
-		$log->info('foo'); $line = __LINE__; // Do NOT move this to next line.
-		$actual = ob_get_contents();
-		ob_end_clean();
-
-		$expected = implode(':', array(__FILE__, $line, __CLASS__, __FUNCTION__));
-		self::assertSame($expected, $actual);
-
-		Logger::resetConfiguration();
-	}
-
-	public function testLocation2() {
-		$config = TestHelper::getEchoPatternConfig("%location");
-		Logger::configure($config);
-
-		// Test by capturing output. Logging methods of a Logger object must
-		// be used for the location info to be formed correctly.
-		ob_start();
-		$log = Logger::getLogger('foo');
-		$log->info('foo'); $line = __LINE__; // Do NOT move this to next line.
-		$actual = ob_get_contents();
-		ob_end_clean();
-
-		$class = __CLASS__;
-		$func = __FUNCTION__;
-		$file = __FILE__;
-
-		$expected = "$class.$func($file:$line)";
-		self::assertSame($expected, $actual);
-
-		Logger::resetConfiguration();
-	}
-
-	public function testMessage() {
-		$expected = "This is a message.";
-		$event = TestHelper::getInfoEvent($expected);
-		$converter = new MessageConverter($this->info);
-		$actual = $converter->convert($event);
-		self::assertSame($expected, $actual);
-	}
-
-	public function testMDC() {
-		MDC::put('foo', 'bar');
-		MDC::put('bla', 'tra');
-
-		// Entire context
-		$converter = new MdcConverter($this->info);
-		$actual = $converter->convert($this->event);
-		$expected = 'foo=bar, bla=tra';
-		self::assertSame($expected, $actual);
-
-		// Just foo
-		$converter = new MdcConverter($this->info, 'foo');
-		$actual = $converter->convert($this->event);
-		$expected = 'bar';
-		self::assertSame($expected, $actual);
-
-		// Non existant key
-		$converter = new MdcConverter($this->info, 'doesnotexist');
-		$actual = $converter->convert($this->event);
-		$expected = '';
-		self::assertSame($expected, $actual);
-
-		MDC::clear();
-	}
-
-	public function testNDC() {
-		NDC::push('foo');
-		NDC::push('bar');
-		NDC::push('baz');
-
-		$converter = new NdcConverter($this->info);
-		$expected = 'foo bar baz';
-		$actual = $converter->convert($this->event);
-		self::assertEquals($expected, $actual);
-	}
-
-	public function testNewline() {
-		$converter = new NewLineConverter($this->info);
-		$actual = $converter->convert($this->event);
-		$expected = PHP_EOL;
-		self::assertSame($expected, $actual);
-	}
-
-	public function testProcess() {
-		$converter = new ProcessConverter($this->info);
-		$actual = $converter->convert($this->event);
-		$expected = getmypid();
-		self::assertSame($expected, $actual);
-	}
-
-	public function testRelative() {
-		$converter = new RelativeConverter($this->info);
-		$expected = number_format($this->event->getTimeStamp() - $this->event->getStartTime(), 4);
-		$actual = $converter->convert($this->event);
-		self::assertSame($expected, $actual);
-	}
-
-	public function testRequest() {
-		// Fake a couple of request values
-		$_REQUEST['test1'] = 'value1';
-		$_REQUEST['test2'] = 'value2';
-
-		// Entire request
-		$converter = new RequestConverter($this->info);
-		$actual = $converter->convert($this->event);
-		$expected = 'test1=value1, test2=value2';
-		self::assertSame($expected, $actual);
-
-		// Just test2
-		$converter = new RequestConverter($this->info, 'test2');
-		$actual = $converter->convert($this->event);
-		$expected = 'value2';
-		self::assertSame($expected, $actual);
-	}
-
-	public function testServer() {
-		// Fake a server value
-		$_SERVER['test1'] = 'value1';
-
-		$converter = new ServerConverter($this->info, 'test1');
-		$actual = $converter->convert($this->event);
-		$expected = 'value1';
-		self::assertSame($expected, $actual);
-	}
-
-	public function testSession() {
-		// Fake a session value
-		$_SESSION['test1'] = 'value1';
-
-		$converter = new SessionConverter($this->info, 'test1');
-		$actual = $converter->convert($this->event);
-		$expected = 'value1';
-		self::assertSame($expected, $actual);
-	}
-
-	public function testSessionID() {
-		$converter = new SessionIdConverter($this->info);
-		$actual = $converter->convert($this->event);
-		$expected = session_id();
-		self::assertSame($expected, $actual);
-	}
-
-	/**
-	 * @expectedException PHPUnit_Framework_Error
-	 * @expectedExceptionMessage log4php: InvalidSuperglobalConverter: Cannot find superglobal variable $_FOO
-	 */
-	public function testNonexistantSuperglobal() {
-		$converter = new InvalidSuperglobalConverter($this->info);
-		$actual = $converter->convert($this->event);
-	}
-
-	public function testFormattingTrimRight() {
-		$event = TestHelper::getInfoEvent('0123456789');
-
-		$info = new FormattingInfo();
-		$info->max = 5;
-
-		$converter = new MessageConverter($info);
-		$actual = "";
-		$converter->format($actual, $event);
-		$expected = "01234";
-		self::assertSame($expected, $actual);
-	}
-
-	public function testFormattingTrimLeft() {
-		$event = TestHelper::getInfoEvent('0123456789');
-
-		$info = new FormattingInfo();
-		$info->max = 5;
-		$info->trimLeft = true;
-
-		$converter = new MessageConverter($info);
-		$actual = "";
-		$converter->format($actual, $event);
-		$expected = "56789";
-		self::assertSame($expected, $actual);
-	}
-
-	public function testFormattingPadEmpty() {
-		$event = TestHelper::getInfoEvent('');
-
-		$info = new FormattingInfo();
-		$info->min = 5;
-
-		$converter = new MessageConverter($info);
-		$actual = "";
-		$converter->format($actual, $event);
-		$expected = "     ";
-		self::assertSame($expected, $actual);
-	}
-
-	public function testFormattingPadLeft() {
-		$event = TestHelper::getInfoEvent('0');
-
-		$info = new FormattingInfo();
-		$info->min = 5;
-
-		$converter = new MessageConverter($info);
-		$actual = "";
-		$converter->format($actual, $event);
-		$expected = "    0";
-		self::assertSame($expected, $actual);
-	}
-
-	public function testFormattingPadRight() {
-		$event = TestHelper::getInfoEvent('0');
-
-		$info = new FormattingInfo();
-		$info->min = 5;
-		$info->padLeft = false;
-
-		$converter = new MessageConverter($info);
-		$actual = "";
-		$converter->format($actual, $event);
-		$expected = "0    ";
-		self::assertSame($expected, $actual);
-	}
+class PatternConverterTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * A logging event for testing.
+     * @var LoggingEvent
+     */
+    private $event;
+
+    /**
+     * Fromatting info used with the logging event.
+     * @var LoggerFormattingInfos
+     */
+    private $info;
+
+    public function __construct()
+    {
+        $this->event = TestHelper::getInfoEvent('foobar');
+        $this->info = new FormattingInfo();
+    }
+
+    public function testCookie()
+    {
+        // Fake a couple of cookies
+        $_COOKIE['test1'] = 'value1';
+        $_COOKIE['test2'] = 'value2';
+
+        $converter = new CookieConverter($this->info, 'test1');
+        $actual = $converter->convert($this->event);
+        $expected = 'value1';
+        self::assertSame($expected, $actual);
+
+        $converter = new CookieConverter($this->info, 'test2');
+        $actual = $converter->convert($this->event);
+        $expected = 'value2';
+        self::assertSame($expected, $actual);
+
+        $converter = new CookieConverter($this->info);
+        $actual = $converter->convert($this->event);
+        $expected = "test1=value1, test2=value2";
+        self::assertSame($expected, $actual);
+    }
+
+    public function testDate()
+    {
+        $converter = new DateConverter($this->info, 'c');
+        $actual = $converter->convert($this->event);
+        $expected = date('c', $this->event->getTimeStamp());
+        self::assertSame($expected, $actual);
+
+        // Format defaults to 'c'
+        $converter = new DateConverter($this->info);
+        $actual = $converter->convert($this->event);
+        $expected = date('c', $this->event->getTimeStamp());
+        self::assertSame($expected, $actual);
+
+        $converter = new DateConverter($this->info, '');
+        $actual = $converter->convert($this->event);
+        $expected = date('c', $this->event->getTimeStamp());
+        self::assertSame($expected, $actual);
+
+        // Test ABSOLUTE
+        $converter = new DateConverter($this->info, 'ABSOLUTE');
+        $actual = $converter->convert($this->event);
+        $expected = date('H:i:s', $this->event->getTimeStamp());
+        self::assertSame($expected, $actual);
+
+        // Test DATE
+        $converter = new DateConverter($this->info, 'DATE');
+        $actual = $converter->convert($this->event);
+        $expected = date('d M Y H:i:s.', $this->event->getTimeStamp());
+
+        $timestamp = $this->event->getTimeStamp();
+        $ms = floor(($timestamp - floor($timestamp)) * 1000);
+        $ms = str_pad($ms, 3, '0', STR_PAD_LEFT);
+
+        $expected .= $ms;
+
+        self::assertSame($expected, $actual);
+    }
+
+    public function testEnvironment()
+    {
+        // Fake a couple of environment values
+        $_ENV['test1'] = 'value1';
+        $_ENV['test2'] = 'value2';
+
+        $converter = new EnvironmentConverter($this->info, 'test1');
+        $actual = $converter->convert($this->event);
+        $expected = 'value1';
+        self::assertSame($expected, $actual);
+
+        $converter = new EnvironmentConverter($this->info, 'test2');
+        $actual = $converter->convert($this->event);
+        $expected = 'value2';
+        self::assertSame($expected, $actual);
+    }
+
+    public function testLevel()
+    {
+        $converter = new LevelConverter($this->info);
+        $actual = $converter->convert($this->event);
+        $expected = $this->event->getLevel()->toString();
+        self::assertEquals($expected, $actual);
+    }
+
+    public function testLiteral()
+    {
+        $converter = new LiteralConverter('foo bar baz');
+        $actual = $converter->convert($this->event);
+        $expected = 'foo bar baz';
+        self::assertEquals($expected, $actual);
+    }
+
+    public function testLoggerWithoutOption()
+    {
+        $event = TestHelper::getInfoEvent('foo', 'TestLoggerName');
+        $converter = new LoggerConverter($this->info);
+
+        $actual = $converter->convert($event);
+        $expected = 'TestLoggerName';
+        self::assertEquals($expected, $actual);
+    }
+
+    public function testLoggerWithOption0()
+    {
+        $event = TestHelper::getInfoEvent('foo', 'TestLoggerName');
+        $converter = new LoggerConverter($this->info, '0');
+
+        $actual = $converter->convert($event);
+        $expected = 'TestLoggerName';
+        self::assertEquals($expected, $actual);
+    }
+
+    public function testLocation()
+    {
+        $config = TestHelper::getEchoPatternConfig("%file:%line:%class:%method");
+        Logger::configure($config);
+
+        // Test by capturing output. Logging methods of a Logger object must
+        // be used for the location info to be formed correctly.
+        ob_start();
+        $log = Logger::getLogger('foo');
+        $log->info('foo'); $line = __LINE__; // Do NOT move this to next line.
+        $actual = ob_get_contents();
+        ob_end_clean();
+
+        $expected = implode(':', array(__FILE__, $line, __CLASS__, __FUNCTION__));
+        self::assertSame($expected, $actual);
+
+        Logger::resetConfiguration();
+    }
+
+    public function testLocation2()
+    {
+        $config = TestHelper::getEchoPatternConfig("%location");
+        Logger::configure($config);
+
+        // Test by capturing output. Logging methods of a Logger object must
+        // be used for the location info to be formed correctly.
+        ob_start();
+        $log = Logger::getLogger('foo');
+        $log->info('foo'); $line = __LINE__; // Do NOT move this to next line.
+        $actual = ob_get_contents();
+        ob_end_clean();
+
+        $class = __CLASS__;
+        $func = __FUNCTION__;
+        $file = __FILE__;
+
+        $expected = "$class.$func($file:$line)";
+        self::assertSame($expected, $actual);
+
+        Logger::resetConfiguration();
+    }
+
+    public function testMessage()
+    {
+        $expected = "This is a message.";
+        $event = TestHelper::getInfoEvent($expected);
+        $converter = new MessageConverter($this->info);
+        $actual = $converter->convert($event);
+        self::assertSame($expected, $actual);
+    }
+
+    public function testMDC()
+    {
+        MDC::put('foo', 'bar');
+        MDC::put('bla', 'tra');
+
+        // Entire context
+        $converter = new MdcConverter($this->info);
+        $actual = $converter->convert($this->event);
+        $expected = 'foo=bar, bla=tra';
+        self::assertSame($expected, $actual);
+
+        // Just foo
+        $converter = new MdcConverter($this->info, 'foo');
+        $actual = $converter->convert($this->event);
+        $expected = 'bar';
+        self::assertSame($expected, $actual);
+
+        // Non existant key
+        $converter = new MdcConverter($this->info, 'doesnotexist');
+        $actual = $converter->convert($this->event);
+        $expected = '';
+        self::assertSame($expected, $actual);
+
+        MDC::clear();
+    }
+
+    public function testNDC()
+    {
+        NDC::push('foo');
+        NDC::push('bar');
+        NDC::push('baz');
+
+        $converter = new NdcConverter($this->info);
+        $expected = 'foo bar baz';
+        $actual = $converter->convert($this->event);
+        self::assertEquals($expected, $actual);
+    }
+
+    public function testNewline()
+    {
+        $converter = new NewLineConverter($this->info);
+        $actual = $converter->convert($this->event);
+        $expected = PHP_EOL;
+        self::assertSame($expected, $actual);
+    }
+
+    public function testProcess()
+    {
+        $converter = new ProcessConverter($this->info);
+        $actual = $converter->convert($this->event);
+        $expected = getmypid();
+        self::assertSame($expected, $actual);
+    }
+
+    public function testRelative()
+    {
+        $converter = new RelativeConverter($this->info);
+        $expected = number_format($this->event->getTimeStamp() - $this->event->getStartTime(), 4);
+        $actual = $converter->convert($this->event);
+        self::assertSame($expected, $actual);
+    }
+
+    public function testRequest()
+    {
+        // Fake a couple of request values
+        $_REQUEST['test1'] = 'value1';
+        $_REQUEST['test2'] = 'value2';
+
+        // Entire request
+        $converter = new RequestConverter($this->info);
+        $actual = $converter->convert($this->event);
+        $expected = 'test1=value1, test2=value2';
+        self::assertSame($expected, $actual);
+
+        // Just test2
+        $converter = new RequestConverter($this->info, 'test2');
+        $actual = $converter->convert($this->event);
+        $expected = 'value2';
+        self::assertSame($expected, $actual);
+    }
+
+    public function testServer()
+    {
+        // Fake a server value
+        $_SERVER['test1'] = 'value1';
+
+        $converter = new ServerConverter($this->info, 'test1');
+        $actual = $converter->convert($this->event);
+        $expected = 'value1';
+        self::assertSame($expected, $actual);
+    }
+
+    public function testSession()
+    {
+        // Fake a session value
+        $_SESSION['test1'] = 'value1';
+
+        $converter = new SessionConverter($this->info, 'test1');
+        $actual = $converter->convert($this->event);
+        $expected = 'value1';
+        self::assertSame($expected, $actual);
+    }
+
+    public function testSessionID()
+    {
+        $converter = new SessionIdConverter($this->info);
+        $actual = $converter->convert($this->event);
+        $expected = session_id();
+        self::assertSame($expected, $actual);
+    }
+
+    /**
+     * @expectedException PHPUnit_Framework_Error
+     * @expectedExceptionMessage log4php: InvalidSuperglobalConverter: Cannot find superglobal variable $_FOO
+     */
+    public function testNonexistantSuperglobal()
+    {
+        $converter = new InvalidSuperglobalConverter($this->info);
+        $actual = $converter->convert($this->event);
+    }
+
+    public function testFormattingTrimRight()
+    {
+        $event = TestHelper::getInfoEvent('0123456789');
+
+        $info = new FormattingInfo();
+        $info->max = 5;
+
+        $converter = new MessageConverter($info);
+        $actual = "";
+        $converter->format($actual, $event);
+        $expected = "01234";
+        self::assertSame($expected, $actual);
+    }
+
+    public function testFormattingTrimLeft()
+    {
+        $event = TestHelper::getInfoEvent('0123456789');
+
+        $info = new FormattingInfo();
+        $info->max = 5;
+        $info->trimLeft = true;
+
+        $converter = new MessageConverter($info);
+        $actual = "";
+        $converter->format($actual, $event);
+        $expected = "56789";
+        self::assertSame($expected, $actual);
+    }
+
+    public function testFormattingPadEmpty()
+    {
+        $event = TestHelper::getInfoEvent('');
+
+        $info = new FormattingInfo();
+        $info->min = 5;
+
+        $converter = new MessageConverter($info);
+        $actual = "";
+        $converter->format($actual, $event);
+        $expected = "     ";
+        self::assertSame($expected, $actual);
+    }
+
+    public function testFormattingPadLeft()
+    {
+        $event = TestHelper::getInfoEvent('0');
+
+        $info = new FormattingInfo();
+        $info->min = 5;
+
+        $converter = new MessageConverter($info);
+        $actual = "";
+        $converter->format($actual, $event);
+        $expected = "    0";
+        self::assertSame($expected, $actual);
+    }
+
+    public function testFormattingPadRight()
+    {
+        $event = TestHelper::getInfoEvent('0');
+
+        $info = new FormattingInfo();
+        $info->min = 5;
+        $info->padLeft = false;
+
+        $converter = new MessageConverter($info);
+        $actual = "";
+        $converter->format($actual, $event);
+        $expected = "0    ";
+        self::assertSame($expected, $actual);
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/ReflectionUtilsTest.php
----------------------------------------------------------------------
diff --git a/tests/src/ReflectionUtilsTest.php b/tests/src/ReflectionUtilsTest.php
index 2357657..1e5229b 100644
--- a/tests/src/ReflectionUtilsTest.php
+++ b/tests/src/ReflectionUtilsTest.php
@@ -24,23 +24,28 @@ namespace Apache\Log4php\Tests;
 
 use Apache\Log4php\ReflectionUtils;
 
-class Simple {
+class Simple
+{
     private $name;
     private $male;
 
-    public function getName() {
+    public function getName()
+    {
         return $this->name;
     }
 
-    public function isMale() {
+    public function isMale()
+    {
         return $this->male;
     }
 
-    public function setName($name) {
+    public function setName($name)
+    {
         $this->name = $name;
     }
 
-    public function setMale($male) {
+    public function setMale($male)
+    {
         $this->male = $male;
     }
 }
@@ -48,44 +53,48 @@ class Simple {
 /**
  * @group main
  */
-class ReflectionUtilsTest extends \PHPUnit_Framework_TestCase {
-
-	public function testSimpleSet() {
-		$s = new Simple();
-		$ps = new ReflectionUtils($s);
- 		$ps->setProperty("name", "Joe");
- 		$ps->setProperty("male", true);
-
- 		$this->assertEquals($s->isMale(), true);
- 		$this->assertEquals($s->getName(), 'Joe');
-	}
+class ReflectionUtilsTest extends \PHPUnit_Framework_TestCase
+{
+    public function testSimpleSet()
+    {
+        $s = new Simple();
+        $ps = new ReflectionUtils($s);
+         $ps->setProperty("name", "Joe");
+         $ps->setProperty("male", true);
+
+         $this->assertEquals($s->isMale(), true);
+         $this->assertEquals($s->getName(), 'Joe');
+    }
 
-	public function testSimpleArraySet() {
-		$arr['xxxname'] = 'Joe';
-		$arr['xxxmale'] = true;
+    public function testSimpleArraySet()
+    {
+        $arr['xxxname'] = 'Joe';
+        $arr['xxxmale'] = true;
 
-		$s = new Simple();
-		$ps = new ReflectionUtils($s);
- 		$ps->setProperties($arr, "xxx");
+        $s = new Simple();
+        $ps = new ReflectionUtils($s);
+         $ps->setProperties($arr, "xxx");
 
- 		$this->assertEquals($s->getName(), 'Joe');
- 		$this->assertEquals($s->isMale(), true);
-	}
+         $this->assertEquals($s->getName(), 'Joe');
+         $this->assertEquals($s->isMale(), true);
+    }
 
-	public function testStaticArraySet() {
-		$arr['xxxname'] = 'Joe';
-		$arr['xxxmale'] = true;
+    public function testStaticArraySet()
+    {
+        $arr['xxxname'] = 'Joe';
+        $arr['xxxmale'] = true;
 
-		$s = new Simple();
-		ReflectionUtils::setPropertiesByObject($s,$arr,"xxx");
+        $s = new Simple();
+        ReflectionUtils::setPropertiesByObject($s,$arr,"xxx");
 
- 		$this->assertEquals($s->getName(), 'Joe');
- 		$this->assertEquals($s->isMale(), true);
-	}
-	public function testCreateObject() {
+         $this->assertEquals($s->getName(), 'Joe');
+         $this->assertEquals($s->isMale(), true);
+    }
+    public function testCreateObject()
+    {
         $class = 'Apache\\Log4php\\Layouts\\SimpleLayout';
-		$object = ReflectionUtils::createObject($class);
-		$name = get_class($object);
-		self::assertEquals($name, $class);
-	}
+        $object = ReflectionUtils::createObject($class);
+        $name = get_class($object);
+        self::assertEquals($name, $class);
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/Renderers/RendererMapTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Renderers/RendererMapTest.php b/tests/src/Renderers/RendererMapTest.php
index 3960660..664bb71 100644
--- a/tests/src/Renderers/RendererMapTest.php
+++ b/tests/src/Renderers/RendererMapTest.php
@@ -27,223 +27,229 @@ use Apache\Log4php\Logger;
 use Apache\Log4php\LoggerException;
 
 /** Renders everything as 'foo'. */
-class FooRenderer implements RendererInterface {
-	public function render($input) {
-		return 'foo';
-	}
+class FooRenderer implements RendererInterface
+{
+    public function render($input)
+    {
+        return 'foo';
+    }
 }
 
 class InvalidCostumObjectRenderer { }
 
-class Fruit3 {
+class Fruit3
+{
     public $test1 = 'test1';
     public $test2 = 'test2';
     public $test3 = 'test3';
 }
 
-class Fruit3Descendant extends Fruit3 {
+class Fruit3Descendant extends Fruit3
+{
 }
 
-class FruitRenderer3 implements RendererInterface {
-    public function render($fruit) {
-		return $fruit->test1 . ',' . $fruit->test2 . ',' . $fruit->test3;
-	}
+class FruitRenderer3 implements RendererInterface
+{
+    public function render($fruit)
+    {
+        return $fruit->test1 . ',' . $fruit->test2 . ',' . $fruit->test3;
+    }
 }
 
-class SampleObject {
+class SampleObject
+{
 }
 
 /**
  * @group renderers
  */
-class RendererMapTest extends \PHPUnit_Framework_TestCase {
-
-	public function testDefaults() {
-
-		$map = new RendererMap();
-		$actual = $map->getByClassName('Exception');
-		$expected = 'Apache\\Log4php\\Renderers\\ExceptionRenderer';
-		self::assertInstanceOf($expected, $actual);
-
-		// Check non-configured objects return null
-		self::assertNull($map->getByObject(new stdClass()));
-		self::assertNull($map->getByClassName('stdClass'));
-	}
-
-	public function testClear()
-	{
-		$map = new RendererMap();
-		$map->clear(); // This should clear the map and remove default renderers
-		self::assertNull($map->getByClassName('Exception'));
-	}
-
-	public function testFindAndRender()
-	{
-		$map = new RendererMap();
-		$map->addRenderer('Fruit3', 'FruitRenderer3');
-
-		$fruit = new Fruit3();
-		$descendant = new Fruit3Descendant();
-
-		// Check rendering of fruit
-		$actual = $map->findAndRender($fruit);
-		$expected = 'test1,test2,test3';
-		self::assertSame($expected, $actual);
-
-		$actual = $map->getByObject($fruit);
-		self::assertInstanceOf('FruitRenderer3', $actual);
-
-		// Check rendering of fruit's descendant
-		$actual = $map->findAndRender($descendant);
-		$expected = 'test1,test2,test3';
-		self::assertSame($expected, $actual);
-
-		$actual = $map->getByObject($descendant);
-		self::assertInstanceOf('FruitRenderer3', $actual);
-
-		// Test rendering null returns null
-		self::assertNull($map->findAndRender(null));
-	}
-
-	/**
-	 * Try adding a non-existant class as renderer.
-	 * @expectedException PHPUnit_Framework_Error
- 	 * @expectedExceptionMessage Failed adding renderer. Rendering class [DoesNotExist] not found.
-	 */
-	public function testAddRendererError1()
-	{
-		$map = new RendererMap();
-		$map->addRenderer('Fruit3', 'DoesNotExist');
-	}
-
-	/**
-	 * Try adding a class which does not implement RendererInterface as renderer.
-	 * @expectedException PHPUnit_Framework_Error
- 	 * @expectedExceptionMessage Failed adding renderer. Rendering class [stdClass] does not implement the RendererInterface interface.
-	 */
-	public function testAddRendererError2()
-	{
-		$map = new RendererMap();
-		$map->addRenderer('Fruit3', 'stdClass');
-	}
-
-	public function testAddRendererError3()
-	{
-		$map = new RendererMap();
-		@$map->addRenderer('Fruit3', 'stdClass');
-		self::assertNull($map->getByClassName('Fruit3'));
-
-		@$map->addRenderer('Fruit3', 'DoesNotExist');
-		self::assertNull($map->getByClassName('Fruit3'));
-	}
-
-	/**
-	 * Try setting a non-existant class as default renderer.
-	 * @expectedException PHPUnit_Framework_Error
-	 * @expectedExceptionMessage Failed setting default renderer. Rendering class [DoesNotExist] not found.
-	 */
-	public function testSetDefaultRendererError1()
-	{
-		$map = new RendererMap();
-		$map->setDefaultRenderer('DoesNotExist');
-	}
-
-	/**
-	 * Try setting a class which does not implement RendererInterface as default renderer.
-	 * @expectedException PHPUnit_Framework_Error
-	 * @expectedExceptionMessage Failed setting default renderer. Rendering class [stdClass] does not implement the RendererInterface interface.
-	 */
-	public function testSetDefaultRendererError2()
-	{
-		$map = new RendererMap();
-		$map->setDefaultRenderer('stdClass');
-	}
-
-	public function testSetDefaultRendererError3()
-	{
-		$map = new RendererMap();
-		$expected =  $map->getDefaultRenderer();
-
-		@$map->setDefaultRenderer('stdClass');
-		$actual = $map->getDefaultRenderer();
-		self::assertSame($expected, $actual);
-
-		@$map->setDefaultRenderer('DoesNotExist');
-		$actual = $map->getDefaultRenderer();
-		self::assertSame($expected, $actual);
-	}
-
-	public function testFetchingRenderer()
-	{
-		$map = new RendererMap();
-		$map->addRenderer('Fruit3', 'FruitRenderer3');
-	}
-
-	public function testDefaultRenderer()
-	{
-		$fruit = new Fruit3();
-
-		$map = new RendererMap();
-		$actual = $map->findAndRender($fruit);
-
-		$defaultRenderer = new DefaultRenderer();
-		$expected = $defaultRenderer->render($fruit);
-		self::assertSame($expected, $actual);
-	}
-
-	public function testOverrideDefaultRenderer()
-	{
-		$map = new RendererMap();
-		$default = $map->getDefaultRenderer();
-
-		$array = array(1, 2, 3);
-
-		$actual = $map->findAndRender($array);
-		$expected = print_r($array, true);
-		self::assertSame($actual, $expected);
-
-		// Now switch the default renderer
-		$map->setDefaultRenderer('FooRenderer');
-		$actual = $map->findAndRender($array);
-		$expected = 'foo';
-		self::assertSame($actual, $expected);
-	}
-
-	public function testGetByObjectCrap()
-	{
-		$map = new RendererMap();
-
-		// Non object input should always return null
-		self::assertNull($map->getByObject(null));
-		self::assertNull($map->getByObject(array()));
-		self::assertNull($map->getByObject('sdasda'));
-	}
-
-	public function testXMLConfig()
-	{
-		$map = Logger::getHierarchy()->getRendererMap();
-		Logger::resetConfiguration();
-
-		$expected = 'Apache\\Log4php\\Renderers\\DefaultRenderer';
-		self::assertInstanceOf($expected, $map->getDefaultRenderer());
-
-		Logger::configure(PHPUNIT_CONFIG_DIR . '/renderers/config_default_renderer.xml');
-		self::assertInstanceOf('FruitRenderer3', $map->getDefaultRenderer());
-
-		Logger::resetConfiguration();
-		self::assertInstanceOf($expected, $map->getDefaultRenderer());
-	}
-
-	public function testExceptionRenderer()
-	{
-		$ex = new LoggerException("This is a test");
-
-		$map = new RendererMap();
-		$actual = $map->findAndRender($ex);
-		$expected = (string) $ex;
-
-		self::assertSame($expected, $actual);
-	}
-
+class RendererMapTest extends \PHPUnit_Framework_TestCase
+{
+    public function testDefaults()
+    {
+        $map = new RendererMap();
+        $actual = $map->getByClassName('Exception');
+        $expected = 'Apache\\Log4php\\Renderers\\ExceptionRenderer';
+        self::assertInstanceOf($expected, $actual);
+
+        // Check non-configured objects return null
+        self::assertNull($map->getByObject(new stdClass()));
+        self::assertNull($map->getByClassName('stdClass'));
+    }
+
+    public function testClear()
+    {
+        $map = new RendererMap();
+        $map->clear(); // This should clear the map and remove default renderers
+        self::assertNull($map->getByClassName('Exception'));
+    }
+
+    public function testFindAndRender()
+    {
+        $map = new RendererMap();
+        $map->addRenderer('Fruit3', 'FruitRenderer3');
+
+        $fruit = new Fruit3();
+        $descendant = new Fruit3Descendant();
+
+        // Check rendering of fruit
+        $actual = $map->findAndRender($fruit);
+        $expected = 'test1,test2,test3';
+        self::assertSame($expected, $actual);
+
+        $actual = $map->getByObject($fruit);
+        self::assertInstanceOf('FruitRenderer3', $actual);
+
+        // Check rendering of fruit's descendant
+        $actual = $map->findAndRender($descendant);
+        $expected = 'test1,test2,test3';
+        self::assertSame($expected, $actual);
+
+        $actual = $map->getByObject($descendant);
+        self::assertInstanceOf('FruitRenderer3', $actual);
+
+        // Test rendering null returns null
+        self::assertNull($map->findAndRender(null));
+    }
+
+    /**
+     * Try adding a non-existant class as renderer.
+     * @expectedException PHPUnit_Framework_Error
+      * @expectedExceptionMessage Failed adding renderer. Rendering class [DoesNotExist] not found.
+     */
+    public function testAddRendererError1()
+    {
+        $map = new RendererMap();
+        $map->addRenderer('Fruit3', 'DoesNotExist');
+    }
+
+    /**
+     * Try adding a class which does not implement RendererInterface as renderer.
+     * @expectedException PHPUnit_Framework_Error
+      * @expectedExceptionMessage Failed adding renderer. Rendering class [stdClass] does not implement the RendererInterface interface.
+     */
+    public function testAddRendererError2()
+    {
+        $map = new RendererMap();
+        $map->addRenderer('Fruit3', 'stdClass');
+    }
+
+    public function testAddRendererError3()
+    {
+        $map = new RendererMap();
+        @$map->addRenderer('Fruit3', 'stdClass');
+        self::assertNull($map->getByClassName('Fruit3'));
+
+        @$map->addRenderer('Fruit3', 'DoesNotExist');
+        self::assertNull($map->getByClassName('Fruit3'));
+    }
+
+    /**
+     * Try setting a non-existant class as default renderer.
+     * @expectedException PHPUnit_Framework_Error
+     * @expectedExceptionMessage Failed setting default renderer. Rendering class [DoesNotExist] not found.
+     */
+    public function testSetDefaultRendererError1()
+    {
+        $map = new RendererMap();
+        $map->setDefaultRenderer('DoesNotExist');
+    }
+
+    /**
+     * Try setting a class which does not implement RendererInterface as default renderer.
+     * @expectedException PHPUnit_Framework_Error
+     * @expectedExceptionMessage Failed setting default renderer. Rendering class [stdClass] does not implement the RendererInterface interface.
+     */
+    public function testSetDefaultRendererError2()
+    {
+        $map = new RendererMap();
+        $map->setDefaultRenderer('stdClass');
+    }
+
+    public function testSetDefaultRendererError3()
+    {
+        $map = new RendererMap();
+        $expected =  $map->getDefaultRenderer();
+
+        @$map->setDefaultRenderer('stdClass');
+        $actual = $map->getDefaultRenderer();
+        self::assertSame($expected, $actual);
+
+        @$map->setDefaultRenderer('DoesNotExist');
+        $actual = $map->getDefaultRenderer();
+        self::assertSame($expected, $actual);
+    }
+
+    public function testFetchingRenderer()
+    {
+        $map = new RendererMap();
+        $map->addRenderer('Fruit3', 'FruitRenderer3');
+    }
+
+    public function testDefaultRenderer()
+    {
+        $fruit = new Fruit3();
+
+        $map = new RendererMap();
+        $actual = $map->findAndRender($fruit);
+
+        $defaultRenderer = new DefaultRenderer();
+        $expected = $defaultRenderer->render($fruit);
+        self::assertSame($expected, $actual);
+    }
+
+    public function testOverrideDefaultRenderer()
+    {
+        $map = new RendererMap();
+        $default = $map->getDefaultRenderer();
+
+        $array = array(1, 2, 3);
+
+        $actual = $map->findAndRender($array);
+        $expected = print_r($array, true);
+        self::assertSame($actual, $expected);
+
+        // Now switch the default renderer
+        $map->setDefaultRenderer('FooRenderer');
+        $actual = $map->findAndRender($array);
+        $expected = 'foo';
+        self::assertSame($actual, $expected);
+    }
+
+    public function testGetByObjectCrap()
+    {
+        $map = new RendererMap();
+
+        // Non object input should always return null
+        self::assertNull($map->getByObject(null));
+        self::assertNull($map->getByObject(array()));
+        self::assertNull($map->getByObject('sdasda'));
+    }
+
+    public function testXMLConfig()
+    {
+        $map = Logger::getHierarchy()->getRendererMap();
+        Logger::resetConfiguration();
+
+        $expected = 'Apache\\Log4php\\Renderers\\DefaultRenderer';
+        self::assertInstanceOf($expected, $map->getDefaultRenderer());
+
+        Logger::configure(PHPUNIT_CONFIG_DIR . '/renderers/config_default_renderer.xml');
+        self::assertInstanceOf('FruitRenderer3', $map->getDefaultRenderer());
+
+        Logger::resetConfiguration();
+        self::assertInstanceOf($expected, $map->getDefaultRenderer());
+    }
+
+    public function testExceptionRenderer()
+    {
+        $ex = new LoggerException("This is a test");
+
+        $map = new RendererMap();
+        $actual = $map->findAndRender($ex);
+        $expected = (string) $ex;
+
+        self::assertSame($expected, $actual);
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/RootLoggerTest.php
----------------------------------------------------------------------
diff --git a/tests/src/RootLoggerTest.php b/tests/src/RootLoggerTest.php
index aa6429e..471ed7e 100644
--- a/tests/src/RootLoggerTest.php
+++ b/tests/src/RootLoggerTest.php
@@ -29,39 +29,43 @@ use Apache\Log4php\RootLogger;
 /**
  * @group main
  */
-class RootLoggerTest extends \PHPUnit_Framework_TestCase {
+class RootLoggerTest extends \PHPUnit_Framework_TestCase
+{
+    public function testInitialSetup()
+    {
+        $root = new RootLogger();
+        self::assertSame(Level::getLevelAll(), $root->getLevel());
+        self::assertSame(Level::getLevelAll(), $root->getEffectiveLevel());
+        self::assertSame('root', $root->getName());
+        self::assertNull($root->getParent());
+    }
 
-	public function testInitialSetup() {
-		$root = new RootLogger();
-		self::assertSame(Level::getLevelAll(), $root->getLevel());
-		self::assertSame(Level::getLevelAll(), $root->getEffectiveLevel());
-		self::assertSame('root', $root->getName());
-		self::assertNull($root->getParent());
-	}
+    /**
+     * @expectedException PHPUnit_Framework_Error
+     * @expectedExceptionMessage log4php: RootLogger cannot have a parent.
+     */
+    public function testSetParentWarning()
+    {
+        $root = new RootLogger();
+        $logger = new Logger('test');
+        $root->setParent($logger);
+    }
 
-	/**
-	 * @expectedException PHPUnit_Framework_Error
-	 * @expectedExceptionMessage log4php: RootLogger cannot have a parent.
-	 */
-	public function testSetParentWarning() {
-		$root = new RootLogger();
-		$logger = new Logger('test');
-		$root->setParent($logger);
-	}
+    public function testSetParentResult()
+    {
+        $root = new RootLogger();
+        $logger = new Logger('test');
+        @$root->setParent($logger);
+        self::assertNull($root->getParent());
+    }
 
-	public function testSetParentResult() {
-		$root = new RootLogger();
-		$logger = new Logger('test');
-		@$root->setParent($logger);
-		self::assertNull($root->getParent());
-	}
-
-	/**
-	 * @expectedException PHPUnit_Framework_Error
-	 * @expectedExceptionMessage log4php: Cannot set RootLogger level to null.
-	 */
-	public function testNullLevelWarning() {
-		$root = new RootLogger();
-		$root->setLevel(null);
-	}
+    /**
+     * @expectedException PHPUnit_Framework_Error
+     * @expectedExceptionMessage log4php: Cannot set RootLogger level to null.
+     */
+    public function testNullLevelWarning()
+    {
+        $root = new RootLogger();
+        $root->setLevel(null);
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/TestHelper.php
----------------------------------------------------------------------
diff --git a/tests/src/TestHelper.php b/tests/src/TestHelper.php
index c653eca..5366e6d 100644
--- a/tests/src/TestHelper.php
+++ b/tests/src/TestHelper.php
@@ -29,132 +29,141 @@ use Apache\Log4php\Logger;
 use Apache\Log4php\LoggingEvent;
 
 /** A set of helper functions for running tests. */
-class TestHelper {
-
-	/**
-	 * Returns a test logging event with level set to TRACE.
-	 * @return LoggingEvent
-	 */
-	public static function getTraceEvent($message = 'test', $logger = "test") {
-		return new LoggingEvent(__CLASS__, new Logger($logger), Level::getLevelTrace(), $message);
-	}
-
-	/**
-	 * Returns a test logging event with level set to DEBUG.
-	 * @return LoggingEvent
-	 */
-	public static function getDebugEvent($message = 'test', $logger = "test") {
-		return new LoggingEvent(__CLASS__, new Logger($logger), Level::getLevelDebug(), $message);
-	}
-
-	/**
-	 * Returns a test logging event with level set to INFO.
-	 * @return LoggingEvent
-	 */
-	public static function getInfoEvent($message = 'test', $logger = "test") {
-		return new LoggingEvent(__CLASS__, new Logger($logger), Level::getLevelInfo(), $message);
-	}
-
-	/**
-	 * Returns a test logging event with level set to WARN.
-	 * @return LoggingEvent
-	 */
-	public static function getWarnEvent($message = 'test', $logger = "test") {
-		return new LoggingEvent(__CLASS__, new Logger($logger), Level::getLevelWarn(), $message);
-	}
-
-	/**
-	 * Returns a test logging event with level set to ERROR.
-	 * @return LoggingEvent
-	 */
-	public static function getErrorEvent($message = 'test', $logger = "test") {
-		return new LoggingEvent(__CLASS__, new Logger($logger), Level::getLevelError(), $message);
-	}
-
-	/**
-	 * Returns a test logging event with level set to FATAL.
-	 * @return LoggingEvent
-	 */
-	public static function getFatalEvent($message = 'test', $logger = "test") {
-		return new LoggingEvent(__CLASS__, new Logger($logger), Level::getLevelFatal(), $message);
-	}
-
-	/**
-	 * Returns an array of logging events, one for each level, sorted ascending
-	 * by severitiy.
-	 */
-	public static function getAllEvents($message = 'test') {
-		return array(
-			self::getTraceEvent($message),
-			self::getDebugEvent($message),
-			self::getInfoEvent($message),
-			self::getWarnEvent($message),
-			self::getErrorEvent($message),
-			self::getFatalEvent($message),
-		);
-	}
-
-	/** Returns an array of all existing levels, sorted ascending by severity. */
-	public static function getAllLevels() {
-		return array(
-			Level::getLevelTrace(),
-			Level::getLevelDebug(),
-			Level::getLevelInfo(),
-			Level::getLevelWarn(),
-			Level::getLevelError(),
-			Level::getLevelFatal(),
-		);
-	}
-
-	/** Returns a string representation of a filter decision. */
-	public static function decisionToString($decision) {
-		switch($decision) {
-			case AbstractFilter::ACCEPT: return 'ACCEPT';
-			case AbstractFilter::NEUTRAL: return 'NEUTRAL';
-			case AbstractFilter::DENY: return 'DENY';
-		}
-	}
-
-	/** Returns a simple configuration with one echo appender tied to root logger. */
-	public static function getEchoConfig() {
-		return array(
-	        'threshold' => 'ALL',
-	        'rootLogger' => array(
-	            'level' => 'trace',
-	            'appenders' => array('default'),
-			),
-	        'appenders' => array(
-	            'default' => array(
-	                'class' => 'EchoAppender',
-	                'layout' => array(
-	                    'class' => 'SimpleLayout',
-					),
-				),
-			),
-		);
-	}
-
-	/** Returns a simple configuration with one echo appender using the pattern layout. */
-	public static function getEchoPatternConfig($pattern) {
-		return array(
-			'threshold' => 'ALL',
-			'rootLogger' => array(
-				'level' => 'trace',
-				'appenders' => array('default'),
-			),
-			'appenders' => array(
-				'default' => array(
-					'class' => 'EchoAppender',
-					'layout' => array(
-						'class' => 'PatternLayout',
-						'params' => array(
-							'conversionPattern' => $pattern
-						)
-					),
-				),
-			),
-		);
-	}
+class TestHelper
+{
+    /**
+     * Returns a test logging event with level set to TRACE.
+     * @return LoggingEvent
+     */
+    public static function getTraceEvent($message = 'test', $logger = "test")
+    {
+        return new LoggingEvent(__CLASS__, new Logger($logger), Level::getLevelTrace(), $message);
+    }
+
+    /**
+     * Returns a test logging event with level set to DEBUG.
+     * @return LoggingEvent
+     */
+    public static function getDebugEvent($message = 'test', $logger = "test")
+    {
+        return new LoggingEvent(__CLASS__, new Logger($logger), Level::getLevelDebug(), $message);
+    }
+
+    /**
+     * Returns a test logging event with level set to INFO.
+     * @return LoggingEvent
+     */
+    public static function getInfoEvent($message = 'test', $logger = "test")
+    {
+        return new LoggingEvent(__CLASS__, new Logger($logger), Level::getLevelInfo(), $message);
+    }
+
+    /**
+     * Returns a test logging event with level set to WARN.
+     * @return LoggingEvent
+     */
+    public static function getWarnEvent($message = 'test', $logger = "test")
+    {
+        return new LoggingEvent(__CLASS__, new Logger($logger), Level::getLevelWarn(), $message);
+    }
+
+    /**
+     * Returns a test logging event with level set to ERROR.
+     * @return LoggingEvent
+     */
+    public static function getErrorEvent($message = 'test', $logger = "test")
+    {
+        return new LoggingEvent(__CLASS__, new Logger($logger), Level::getLevelError(), $message);
+    }
+
+    /**
+     * Returns a test logging event with level set to FATAL.
+     * @return LoggingEvent
+     */
+    public static function getFatalEvent($message = 'test', $logger = "test")
+    {
+        return new LoggingEvent(__CLASS__, new Logger($logger), Level::getLevelFatal(), $message);
+    }
+
+    /**
+     * Returns an array of logging events, one for each level, sorted ascending
+     * by severitiy.
+     */
+    public static function getAllEvents($message = 'test')
+    {
+        return array(
+            self::getTraceEvent($message),
+            self::getDebugEvent($message),
+            self::getInfoEvent($message),
+            self::getWarnEvent($message),
+            self::getErrorEvent($message),
+            self::getFatalEvent($message),
+        );
+    }
+
+    /** Returns an array of all existing levels, sorted ascending by severity. */
+    public static function getAllLevels()
+    {
+        return array(
+            Level::getLevelTrace(),
+            Level::getLevelDebug(),
+            Level::getLevelInfo(),
+            Level::getLevelWarn(),
+            Level::getLevelError(),
+            Level::getLevelFatal(),
+        );
+    }
+
+    /** Returns a string representation of a filter decision. */
+    public static function decisionToString($decision)
+    {
+        switch ($decision) {
+            case AbstractFilter::ACCEPT: return 'ACCEPT';
+            case AbstractFilter::NEUTRAL: return 'NEUTRAL';
+            case AbstractFilter::DENY: return 'DENY';
+        }
+    }
+
+    /** Returns a simple configuration with one echo appender tied to root logger. */
+    public static function getEchoConfig()
+    {
+        return array(
+            'threshold' => 'ALL',
+            'rootLogger' => array(
+                'level' => 'trace',
+                'appenders' => array('default'),
+            ),
+            'appenders' => array(
+                'default' => array(
+                    'class' => 'EchoAppender',
+                    'layout' => array(
+                        'class' => 'SimpleLayout',
+                    ),
+                ),
+            ),
+        );
+    }
+
+    /** Returns a simple configuration with one echo appender using the pattern layout. */
+    public static function getEchoPatternConfig($pattern)
+    {
+        return array(
+            'threshold' => 'ALL',
+            'rootLogger' => array(
+                'level' => 'trace',
+                'appenders' => array('default'),
+            ),
+            'appenders' => array(
+                'default' => array(
+                    'class' => 'EchoAppender',
+                    'layout' => array(
+                        'class' => 'PatternLayout',
+                        'params' => array(
+                            'conversionPattern' => $pattern
+                        )
+                    ),
+                ),
+            ),
+        );
+    }
 }
-
-?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/ThrowableInformationTest.php
----------------------------------------------------------------------
diff --git a/tests/src/ThrowableInformationTest.php b/tests/src/ThrowableInformationTest.php
index 9d230da..d07c945 100644
--- a/tests/src/ThrowableInformationTest.php
+++ b/tests/src/ThrowableInformationTest.php
@@ -29,30 +29,33 @@ class ThrowableInformationTestException extends \Exception { }
 /**
  * @group main
  */
-class ThrowableInformationTest extends \PHPUnit_Framework_TestCase {
-
-	public function testConstructor() {
-		$ex = new \Exception();
-		$tInfo = new ThrowableInformation($ex);
-
-		$result	  = $tInfo->getStringRepresentation();
-		$this->assertInternalType('array', $result);
-	}
-
-	public function testExceptionChain() {
-		$ex1 = new ThrowableInformationTestException('Message1');
-		$ex2 = new ThrowableInformationTestException('Message2', 0, $ex1);
-		$ex3 = new ThrowableInformationTestException('Message3', 0, $ex2);
-
-		$tInfo = new ThrowableInformation($ex3);
-		$result	= $tInfo->getStringRepresentation();
-		$this->assertInternalType('array', $result);
-	}
-
-	public function testGetThrowable() {
-		$ex = new ThrowableInformationTestException('Message1');
-		$tInfo = new ThrowableInformation($ex);
-		$result = $tInfo->getThrowable();
-		$this->assertEquals($ex, $result);
-	}
+class ThrowableInformationTest extends \PHPUnit_Framework_TestCase
+{
+    public function testConstructor()
+    {
+        $ex = new \Exception();
+        $tInfo = new ThrowableInformation($ex);
+
+        $result	  = $tInfo->getStringRepresentation();
+        $this->assertInternalType('array', $result);
+    }
+
+    public function testExceptionChain()
+    {
+        $ex1 = new ThrowableInformationTestException('Message1');
+        $ex2 = new ThrowableInformationTestException('Message2', 0, $ex1);
+        $ex3 = new ThrowableInformationTestException('Message3', 0, $ex2);
+
+        $tInfo = new ThrowableInformation($ex3);
+        $result	= $tInfo->getStringRepresentation();
+        $this->assertInternalType('array', $result);
+    }
+
+    public function testGetThrowable()
+    {
+        $ex = new ThrowableInformationTestException('Message1');
+        $tInfo = new ThrowableInformation($ex);
+        $result = $tInfo->getThrowable();
+        $this->assertEquals($ex, $result);
+    }
 }


Mime
View raw message