logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ihabu...@apache.org
Subject [31/43] Fixed code formatting to conform to PSR-2
Date Thu, 28 Nov 2013 16:04:01 GMT
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/Appenders/FileAppenderTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Appenders/FileAppenderTest.php b/tests/src/Appenders/FileAppenderTest.php
index e8ed539..2a0021d 100644
--- a/tests/src/Appenders/FileAppenderTest.php
+++ b/tests/src/Appenders/FileAppenderTest.php
@@ -30,110 +30,118 @@ use Apache\Log4php\Tests\TestHelper;
 /**
  * @group appenders
  */
-class FileAppenderTest extends \PHPUnit_Framework_TestCase {
-
-	private $config1 = array(
-		'rootLogger' => array(
-			'appenders' => array('default'),
-		),
-		'appenders' => array(
-			'default' => array(
-				'class' => 'FileAppender',
-				'layout' => array(
-					'class' => 'SimpleLayout'
-				),
-				'params' => array()
-			)
-		)
-	);
-
-	private $testPath;
-
-	public function __construct() {
-		$this->testPath = PHPUNIT_TEMP_DIR . '/TEST.txt';
-	}
-
-	public function setUp() {
-		Logger::resetConfiguration();
-		if(file_exists($this->testPath)) {
-			unlink($this->testPath);
-		}
-	}
-
-	public function tearDown() {
-		Logger::resetConfiguration();
-		if(file_exists($this->testPath)) {
-			unlink($this->testPath);
-		}
-	}
-
-	public function testRequiresLayout() {
-		$appender = new FileAppender();
-		self::assertTrue($appender->requiresLayout());
-	}
-
-	public function testActivationDoesNotCreateTheFile() {
-		$path = PHPUNIT_TEMP_DIR . "/doesnotexisthopefully.log";
-		@unlink($path);
-		$appender = new FileAppender();
-		$appender->setFile($path);
-		$appender->activateOptions();
-
-		self::assertFalse(file_exists($path));
-
-		$event = TestHelper::getInfoEvent('bla');
-		$appender->append($event);
-
-		self::assertTrue(file_exists($path));
-	}
-
-	public function testSimpleLogging() {
-		$config = $this->config1;
-		$config['appenders']['default']['params']['file'] = $this->testPath;
-
-		Logger::configure($config);
-
-		$logger = Logger::getRootLogger();
-		$logger->info('This is a test');
-
-		$expected = "INFO - This is a test" . PHP_EOL;
-		$actual = file_get_contents($this->testPath);
-		$this->assertSame($expected, $actual);
-	}
-
-	public function testAppendFlagTrue() {
-		$config = $this->config1;
-		$config['appenders']['default']['params']['file'] = $this->testPath;
-		$config['appenders']['default']['params']['append'] = true;
-
-		Logger::configure($config);
-		$logger = Logger::getRootLogger();
-		$logger->info('This is a test');
-
-		Logger::configure($config);
-		$logger = Logger::getRootLogger();
-		$logger->info('This is a test');
-
-		$expected = "INFO - This is a test" . PHP_EOL . "INFO - This is a test" . PHP_EOL;
-		$actual = file_get_contents($this->testPath);
-		$this->assertSame($expected, $actual);
-	}
-
-	public function testAppendFlagFalse() {
-		$config = $this->config1;
-		$config['appenders']['default']['params']['file'] = $this->testPath;
-		$config['appenders']['default']['params']['append'] = false;
-
-		Logger::configure($config);
-		$logger = Logger::getRootLogger();
-		$logger->info('This is a test');
-
-		Logger::configure($config);
-		$logger = Logger::getRootLogger();
-		$logger->info('This is a test');
-
-		$expected = "INFO - This is a test" . PHP_EOL;
-		$actual = file_get_contents($this->testPath);
-		$this->assertSame($expected, $actual);
-	}
+class FileAppenderTest extends \PHPUnit_Framework_TestCase
+{
+    private $config1 = array(
+        'rootLogger' => array(
+            'appenders' => array('default'),
+        ),
+        'appenders' => array(
+            'default' => array(
+                'class' => 'FileAppender',
+                'layout' => array(
+                    'class' => 'SimpleLayout'
+                ),
+                'params' => array()
+            )
+        )
+    );
+
+    private $testPath;
+
+    public function __construct()
+    {
+        $this->testPath = PHPUNIT_TEMP_DIR . '/TEST.txt';
+    }
+
+    public function setUp()
+    {
+        Logger::resetConfiguration();
+        if (file_exists($this->testPath)) {
+            unlink($this->testPath);
+        }
+    }
+
+    public function tearDown()
+    {
+        Logger::resetConfiguration();
+        if (file_exists($this->testPath)) {
+            unlink($this->testPath);
+        }
+    }
+
+    public function testRequiresLayout()
+    {
+        $appender = new FileAppender();
+        self::assertTrue($appender->requiresLayout());
+    }
+
+    public function testActivationDoesNotCreateTheFile()
+    {
+        $path = PHPUNIT_TEMP_DIR . "/doesnotexisthopefully.log";
+        @unlink($path);
+        $appender = new FileAppender();
+        $appender->setFile($path);
+        $appender->activateOptions();
+
+        self::assertFalse(file_exists($path));
+
+        $event = TestHelper::getInfoEvent('bla');
+        $appender->append($event);
+
+        self::assertTrue(file_exists($path));
+    }
+
+    public function testSimpleLogging()
+    {
+        $config = $this->config1;
+        $config['appenders']['default']['params']['file'] = $this->testPath;
+
+        Logger::configure($config);
+
+        $logger = Logger::getRootLogger();
+        $logger->info('This is a test');
+
+        $expected = "INFO - This is a test" . PHP_EOL;
+        $actual = file_get_contents($this->testPath);
+        $this->assertSame($expected, $actual);
+    }
+
+    public function testAppendFlagTrue()
+    {
+        $config = $this->config1;
+        $config['appenders']['default']['params']['file'] = $this->testPath;
+        $config['appenders']['default']['params']['append'] = true;
+
+        Logger::configure($config);
+        $logger = Logger::getRootLogger();
+        $logger->info('This is a test');
+
+        Logger::configure($config);
+        $logger = Logger::getRootLogger();
+        $logger->info('This is a test');
+
+        $expected = "INFO - This is a test" . PHP_EOL . "INFO - This is a test" . PHP_EOL;
+        $actual = file_get_contents($this->testPath);
+        $this->assertSame($expected, $actual);
+    }
+
+    public function testAppendFlagFalse()
+    {
+        $config = $this->config1;
+        $config['appenders']['default']['params']['file'] = $this->testPath;
+        $config['appenders']['default']['params']['append'] = false;
+
+        Logger::configure($config);
+        $logger = Logger::getRootLogger();
+        $logger->info('This is a test');
+
+        Logger::configure($config);
+        $logger = Logger::getRootLogger();
+        $logger->info('This is a test');
+
+        $expected = "INFO - This is a test" . PHP_EOL;
+        $actual = file_get_contents($this->testPath);
+        $this->assertSame($expected, $actual);
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/Appenders/MailAppenderTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Appenders/MailAppenderTest.php b/tests/src/Appenders/MailAppenderTest.php
index 73c7e83..c317b66 100644
--- a/tests/src/Appenders/MailAppenderTest.php
+++ b/tests/src/Appenders/MailAppenderTest.php
@@ -31,34 +31,36 @@ use Apache\Log4php\LoggingEvent;
 /**
  * @group appenders
  */
-class MailAppenderTest extends \PHPUnit_Framework_TestCase {
-
-	public function testRequiresLayout() {
-		$appender = new MailAppender();
-		self::assertTrue($appender->requiresLayout());
-	}
+class MailAppenderTest extends \PHPUnit_Framework_TestCase
+{
+    public function testRequiresLayout()
+    {
+        $appender = new MailAppender();
+        self::assertTrue($appender->requiresLayout());
+    }
 
-	public function testMail() {
-		$appender = new MailAppender("myname ");
+    public function testMail()
+    {
+        $appender = new MailAppender("myname ");
 
-		$layout = new SimpleLayout();
-		$appender->setLayout($layout);
-		$appender->setDry(true);
-		$appender->setTo('test@example.com');
-		$appender->setFrom('Testsender');
+        $layout = new SimpleLayout();
+        $appender->setLayout($layout);
+        $appender->setDry(true);
+        $appender->setTo('test@example.com');
+        $appender->setFrom('Testsender');
 
-		$appender->activateOptions();
-		$event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
-		$event2 = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage2");
+        $appender->activateOptions();
+        $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+        $event2 = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage2");
 
-		ob_start();
-		$appender->append($event);
-		$appender->append($event2);
-		$appender->close();
-		$v = ob_get_contents();
-		ob_end_clean();
+        ob_start();
+        $appender->append($event);
+        $appender->append($event2);
+        $appender->close();
+        $v = ob_get_contents();
+        ob_end_clean();
 
-		$e = "DRY MODE OF MAIL APP.: Send mail to: test@example.com with content: ERROR - testmessage".PHP_EOL."ERROR - testmessage2".PHP_EOL;
-		self::assertEquals($e, $v);
+        $e = "DRY MODE OF MAIL APP.: Send mail to: test@example.com with content: ERROR - testmessage".PHP_EOL."ERROR - testmessage2".PHP_EOL;
+        self::assertEquals($e, $v);
     }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/Appenders/MailEventAppenderTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Appenders/MailEventAppenderTest.php b/tests/src/Appenders/MailEventAppenderTest.php
index 2199f83..51f1957 100644
--- a/tests/src/Appenders/MailEventAppenderTest.php
+++ b/tests/src/Appenders/MailEventAppenderTest.php
@@ -31,56 +31,60 @@ use Apache\Log4php\LoggingEvent;
 /**
  * @group appenders
  */
-class MailEventAppenderTest extends \PHPUnit_Framework_TestCase {
+class MailEventAppenderTest extends \PHPUnit_Framework_TestCase
+{
+    public function testRequiresLayout()
+    {
+        $appender = new MailEventAppender();
+        self::assertTrue($appender->requiresLayout());
+    }
 
-	public function testRequiresLayout() {
-		$appender = new MailEventAppender();
-		self::assertTrue($appender->requiresLayout());
-	}
+    public function testMail()
+    {
+        $appender = new MailEventAppender("myname");
 
-	public function testMail() {
-		$appender = new MailEventAppender("myname");
+        $layout = new SimpleLayout();
+        $appender->setLayout($layout);
+        $appender->setDry(true);
+        $appender->setTo('test@example.com');
+        $appender->setFrom('Testsender');
 
-		$layout = new SimpleLayout();
-		$appender->setLayout($layout);
-		$appender->setDry(true);
-		$appender->setTo('test@example.com');
-		$appender->setFrom('Testsender');
+        $appender->activateOptions();
+        $event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
 
-		$appender->activateOptions();
-		$event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+        ob_start();
+        $appender->append($event);
+        $v = ob_get_contents();
+        ob_end_clean();
 
-		ob_start();
-		$appender->append($event);
-		$v = ob_get_contents();
-		ob_end_clean();
+        $e = "DRY MODE OF MAIL APP.: Send mail to: test@example.com with additional headers 'From: Testsender' and content: ERROR - testmessage".PHP_EOL;
+        self::assertEquals($e, $v);
+        $appender->close();
+    }
 
-		$e = "DRY MODE OF MAIL APP.: Send mail to: test@example.com with additional headers 'From: Testsender' and content: ERROR - testmessage".PHP_EOL;
-		self::assertEquals($e, $v);
-		$appender->close();
-	}
+    /**
+     * Check an error is reported if 'to' is not set.
+     * @expectedException PHPUnit_Framework_Error
+     * @expectedExceptionMessage Required parameter 'to' not set.
+     */
+    public function testEmptyTo()
+    {
+        $appender = new MailEventAppender("myname");
+        $appender->setLayout(new SimpleLayout());
+        $appender->setFrom('info@example.com');
+        $appender->activateOptions();
+    }
 
-	/**
-	 * Check an error is reported if 'to' is not set.
-	 * @expectedException PHPUnit_Framework_Error
-	 * @expectedExceptionMessage Required parameter 'to' not set.
-	 */
-	public function testEmptyTo() {
-		$appender = new MailEventAppender("myname");
-		$appender->setLayout(new SimpleLayout());
-		$appender->setFrom('info@example.com');
-		$appender->activateOptions();
-	}
-
-	/**
-	 * Check an error is reported if 'from' is not set.
-	 * @expectedException PHPUnit_Framework_Error
-	 * @expectedExceptionMessage Required parameter 'from' not set.
-	 */
-	public function testEmptyFrom() {
-		$appender = new MailEventAppender("myname");
-		$appender->setLayout(new SimpleLayout());
-		$appender->setTo('info@example.com');
-		$appender->activateOptions();
-	}
+    /**
+     * Check an error is reported if 'from' is not set.
+     * @expectedException PHPUnit_Framework_Error
+     * @expectedExceptionMessage Required parameter 'from' not set.
+     */
+    public function testEmptyFrom()
+    {
+        $appender = new MailEventAppender("myname");
+        $appender->setLayout(new SimpleLayout());
+        $appender->setTo('info@example.com');
+        $appender->activateOptions();
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/Appenders/MongoDBAppenderTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Appenders/MongoDBAppenderTest.php b/tests/src/Appenders/MongoDBAppenderTest.php
index e4622dd..6194ff0 100644
--- a/tests/src/Appenders/MongoDBAppenderTest.php
+++ b/tests/src/Appenders/MongoDBAppenderTest.php
@@ -36,178 +36,192 @@ use Apache\Log4php\Tests\TestHelper;
  *
  * @group appenders
  */
-class MongoDBAppenderTest extends \PHPUnit_Framework_TestCase {
-
-	protected $appender;
-	protected $event;
-
-	protected function setUp() {
-		if (!extension_loaded('mongo')) {
-			$this->markTestSkipped(
-				'The Mongo extension is not available.'
-			);
-		} else {
-			$this->appender = new MongoDBAppender('mongo_appender');
-			$this->event = TestHelper::getErrorEvent('mongo logging event', 'test_mongo');
-		}
-	}
-
-	protected function tearDown() {
-		unset($this->appender);
-	}
-
-	public function testHost() {
-		$expected = 'mongodb://localhost';
-		$this->appender->setHost($expected);
-		$result = $this->appender->getHost();
-		$this->assertEquals($expected, $result);
-	}
-
-	public function testPort() {
-		$expected = 27017;
-		$this->appender->setPort($expected);
-		$result = $this->appender->getPort();
-		$this->assertEquals($expected, $result);
-	}
-
-	public function testDatabaseName() {
-		$expected = 'log4php_mongodb';
-		$this->appender->setDatabaseName($expected);
-		$result	= $this->appender->getDatabaseName();
-		$this->assertEquals($expected, $result);
-	}
-
-	public function testCollectionName() {
-		$expected = 'logs';
-		$this->appender->setCollectionName($expected);
-		$result = $this->appender->getCollectionName();
-		$this->assertEquals($expected, $result);
-	}
-
-	public function testUserName() {
-		$expected = 'char0n';
-		$this->appender->setUserName($expected);
-		$result = $this->appender->getUserName();
-		$this->assertEquals($expected, $result);
-	}
-
-	public function testPassword() {
-		$expected = 'secret pass';
-		$this->appender->setPassword($expected);
-		$result	= $this->appender->getPassword();
-		$this->assertEquals($expected, $result);
-	}
-
-	public function testTimeout() {
-		$expected = 4000;
-		$this->appender->setTimeout($expected);
-		$result	= $this->appender->getTimeout();
-		$this->assertEquals($expected, $result);
-	}
-
-	public function testActivateOptions() {
-		$this->appender->activateOptions();
-		$this->assertInstanceOf('Mongo', $this->appender->getConnection());
-		$this->assertInstanceOf('MongoCollection', $this->appender->getCollection());
-	}
-
-	public function testActivateOptionsNoCredentials() {
-		$this->appender->setUserName(null);
-		$this->appender->setPassword(null);
-		$this->appender->activateOptions();
-		$this->assertInstanceOf('Mongo', $this->appender->getConnection());
-		$this->assertInstanceOf('MongoCollection', $this->appender->getCollection());
-	}
-
-	public function testFormat() {
-		$this->appender->activateOptions();
-		$record = $this->logOne($this->event);
-
-		$this->assertEquals('ERROR', $record['level']);
-		$this->assertEquals('mongo logging event', $record['message']);
-		$this->assertEquals('test_mongo', $record['loggerName']);
-
-		$this->assertEquals('NA', $record['fileName']);
-		$this->assertEquals('getLocationInformation', $record['method']);
-		$this->assertEquals('NA', $record['lineNumber']);
-		$this->assertEquals('Apache\\Log4php\\LoggingEvent', $record['className']);
-
-		$this->assertTrue(is_int($record['thread']));
-		$this->assertSame(getmypid(), $record['thread']);
-		$this->assertTrue(is_int($record['lineNumber']) || $record['lineNumber'] == 'NA');
-	}
-
-	public function testFormatThrowableInfo() {
-		$this->appender->activateOptions();
-		$event = new LoggingEvent(
-			'testFqcn',
-			new Logger('test.Logger'),
-			Level::getLevelWarn(),
-			'test message',
-			microtime(true),
-			new \Exception('test exception', 1)
-		);
-
-		$record = $this->logOne($event);
-
-		$this->assertArrayHasKey('exception', $record);
-		$this->assertEquals(1, $record['exception']['code']);
-		$this->assertEquals('test exception', $record['exception']['message']);
-
-		$this->assertContains('[internal function]: ' . __CLASS__, $record['exception']['stackTrace']);
-	}
-
-	 public function testFormatThrowableInfoWithInnerException() {
-
-		 // Skip test if PHP version is lower than 5.3.0 (no inner exception support)
-		 if (version_compare(PHP_VERSION, '5.3.0') < 0) {
-			 $this->markTestSkipped();
-		 }
-
-		 $this->appender->activateOptions();
-		 $event = new LoggingEvent(
-			 'testFqcn',
-			 new Logger('test.Logger'),
-			 Level::getLevelWarn(),
-			 'test message',
-			 microtime(true),
-			 new \Exception('test exception', 1, new \Exception('test exception inner', 2))
-		 );
-
-		 $record = $this->logOne($event);
-
-		 $this->assertArrayHasKey('exception', $record);
-		 $this->assertEquals(1, $record['exception']['code']);
-		 $this->assertEquals('test exception', $record['exception']['message']);
-		 $this->assertContains('[internal function]: ' . __CLASS__, $record['exception']['stackTrace']);
-
-		 $this->assertArrayHasKey('innerException', $record['exception']);
-		 $this->assertEquals(2, $record['exception']['innerException']['code']);
-		 $this->assertEquals('test exception inner', $record['exception']['innerException']['message']);
-	 }
-
-
-	 public function testClose() {
-		 $this->appender->activateOptions();
-		 $this->assertInstanceOf('Mongo', $this->appender->getConnection());
-		 $this->assertInstanceOf('MongoCollection', $this->appender->getCollection());
-		 $this->appender->close();
-		 $this->assertNull($this->appender->getConnection());
-		 $this->assertNull($this->appender->getCollection());
-	 }
-
-	/**
-	 * Logs the event and returns the record from the database.
-	 * @param LoggingEvent $event
-	 * @return array
-	 */
-	private function logOne($event)
-	{
-		$collection = $this->appender->getCollection();
-		$collection->drop();
-		$this->appender->append($event);
-		$record = $collection->findOne();
-		$this->assertNotNull($record, 'Could not read the record from the database.');
-		return $record;
-	}
+class MongoDBAppenderTest extends \PHPUnit_Framework_TestCase
+{
+    protected $appender;
+    protected $event;
+
+    protected function setUp()
+    {
+        if (!extension_loaded('mongo')) {
+            $this->markTestSkipped(
+                'The Mongo extension is not available.'
+            );
+        } else {
+            $this->appender = new MongoDBAppender('mongo_appender');
+            $this->event = TestHelper::getErrorEvent('mongo logging event', 'test_mongo');
+        }
+    }
+
+    protected function tearDown()
+    {
+        unset($this->appender);
+    }
+
+    public function testHost()
+    {
+        $expected = 'mongodb://localhost';
+        $this->appender->setHost($expected);
+        $result = $this->appender->getHost();
+        $this->assertEquals($expected, $result);
+    }
+
+    public function testPort()
+    {
+        $expected = 27017;
+        $this->appender->setPort($expected);
+        $result = $this->appender->getPort();
+        $this->assertEquals($expected, $result);
+    }
+
+    public function testDatabaseName()
+    {
+        $expected = 'log4php_mongodb';
+        $this->appender->setDatabaseName($expected);
+        $result	= $this->appender->getDatabaseName();
+        $this->assertEquals($expected, $result);
+    }
+
+    public function testCollectionName()
+    {
+        $expected = 'logs';
+        $this->appender->setCollectionName($expected);
+        $result = $this->appender->getCollectionName();
+        $this->assertEquals($expected, $result);
+    }
+
+    public function testUserName()
+    {
+        $expected = 'char0n';
+        $this->appender->setUserName($expected);
+        $result = $this->appender->getUserName();
+        $this->assertEquals($expected, $result);
+    }
+
+    public function testPassword()
+    {
+        $expected = 'secret pass';
+        $this->appender->setPassword($expected);
+        $result	= $this->appender->getPassword();
+        $this->assertEquals($expected, $result);
+    }
+
+    public function testTimeout()
+    {
+        $expected = 4000;
+        $this->appender->setTimeout($expected);
+        $result	= $this->appender->getTimeout();
+        $this->assertEquals($expected, $result);
+    }
+
+    public function testActivateOptions()
+    {
+        $this->appender->activateOptions();
+        $this->assertInstanceOf('Mongo', $this->appender->getConnection());
+        $this->assertInstanceOf('MongoCollection', $this->appender->getCollection());
+    }
+
+    public function testActivateOptionsNoCredentials()
+    {
+        $this->appender->setUserName(null);
+        $this->appender->setPassword(null);
+        $this->appender->activateOptions();
+        $this->assertInstanceOf('Mongo', $this->appender->getConnection());
+        $this->assertInstanceOf('MongoCollection', $this->appender->getCollection());
+    }
+
+    public function testFormat()
+    {
+        $this->appender->activateOptions();
+        $record = $this->logOne($this->event);
+
+        $this->assertEquals('ERROR', $record['level']);
+        $this->assertEquals('mongo logging event', $record['message']);
+        $this->assertEquals('test_mongo', $record['loggerName']);
+
+        $this->assertEquals('NA', $record['fileName']);
+        $this->assertEquals('getLocationInformation', $record['method']);
+        $this->assertEquals('NA', $record['lineNumber']);
+        $this->assertEquals('Apache\\Log4php\\LoggingEvent', $record['className']);
+
+        $this->assertTrue(is_int($record['thread']));
+        $this->assertSame(getmypid(), $record['thread']);
+        $this->assertTrue(is_int($record['lineNumber']) || $record['lineNumber'] == 'NA');
+    }
+
+    public function testFormatThrowableInfo()
+    {
+        $this->appender->activateOptions();
+        $event = new LoggingEvent(
+            'testFqcn',
+            new Logger('test.Logger'),
+            Level::getLevelWarn(),
+            'test message',
+            microtime(true),
+            new \Exception('test exception', 1)
+        );
+
+        $record = $this->logOne($event);
+
+        $this->assertArrayHasKey('exception', $record);
+        $this->assertEquals(1, $record['exception']['code']);
+        $this->assertEquals('test exception', $record['exception']['message']);
+
+        $this->assertContains('[internal function]: ' . __CLASS__, $record['exception']['stackTrace']);
+    }
+
+     public function testFormatThrowableInfoWithInnerException()
+     {
+         // Skip test if PHP version is lower than 5.3.0 (no inner exception support)
+         if (version_compare(PHP_VERSION, '5.3.0') < 0) {
+             $this->markTestSkipped();
+         }
+
+         $this->appender->activateOptions();
+         $event = new LoggingEvent(
+             'testFqcn',
+             new Logger('test.Logger'),
+             Level::getLevelWarn(),
+             'test message',
+             microtime(true),
+             new \Exception('test exception', 1, new \Exception('test exception inner', 2))
+         );
+
+         $record = $this->logOne($event);
+
+         $this->assertArrayHasKey('exception', $record);
+         $this->assertEquals(1, $record['exception']['code']);
+         $this->assertEquals('test exception', $record['exception']['message']);
+         $this->assertContains('[internal function]: ' . __CLASS__, $record['exception']['stackTrace']);
+
+         $this->assertArrayHasKey('innerException', $record['exception']);
+         $this->assertEquals(2, $record['exception']['innerException']['code']);
+         $this->assertEquals('test exception inner', $record['exception']['innerException']['message']);
+     }
+
+     public function testClose()
+     {
+         $this->appender->activateOptions();
+         $this->assertInstanceOf('Mongo', $this->appender->getConnection());
+         $this->assertInstanceOf('MongoCollection', $this->appender->getCollection());
+         $this->appender->close();
+         $this->assertNull($this->appender->getConnection());
+         $this->assertNull($this->appender->getCollection());
+     }
+
+    /**
+     * Logs the event and returns the record from the database.
+     * @param  LoggingEvent $event
+     * @return array
+     */
+    private function logOne($event)
+    {
+        $collection = $this->appender->getCollection();
+        $collection->drop();
+        $this->appender->append($event);
+        $record = $collection->findOne();
+        $this->assertNotNull($record, 'Could not read the record from the database.');
+
+        return $record;
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/Appenders/NullAppenderTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Appenders/NullAppenderTest.php b/tests/src/Appenders/NullAppenderTest.php
index 5c7a96e..dfde21f 100644
--- a/tests/src/Appenders/NullAppenderTest.php
+++ b/tests/src/Appenders/NullAppenderTest.php
@@ -30,22 +30,25 @@ use Apache\Log4php\LoggingEvent;
 /**
  * @group appenders
  */
-class NullAppenderTest extends \PHPUnit_Framework_TestCase {
-	/**
-	 * The Null appender does nothing - nothing to assert.
-	 * Just here for the sake of completness and a good testing ratio :-)
-	 */
-	public function testActivateOptions() {
+class NullAppenderTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * The Null appender does nothing - nothing to assert.
+     * Just here for the sake of completness and a good testing ratio :-)
+     */
+    public function testActivateOptions()
+    {
         $event = new LoggingEvent("LoggerAppenderNullTest", new Logger("TEST"), Level::getLevelInfo(), "testmessage");
 
-		$appender = new NullAppender("TEST");
-		$appender->activateOptions();
-		$appender->append($event);
-		$appender->close();
+        $appender = new NullAppender("TEST");
+        $appender->activateOptions();
+        $appender->append($event);
+        $appender->close();
     }
 
-	public function testRequiresLayout() {
-		$appender = new NullAppender();
-		self::assertFalse($appender->requiresLayout());
-	}
+    public function testRequiresLayout()
+    {
+        $appender = new NullAppender();
+        self::assertFalse($appender->requiresLayout());
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/Appenders/PDOAppenderTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Appenders/PDOAppenderTest.php b/tests/src/Appenders/PDOAppenderTest.php
index b325e04..2f82ee6 100644
--- a/tests/src/Appenders/PDOAppenderTest.php
+++ b/tests/src/Appenders/PDOAppenderTest.php
@@ -32,139 +32,144 @@ use PDO;
 /**
  * @group appenders
  */
-class PDOAppenderTest extends \PHPUnit_Framework_TestCase {
-
-	const FILENAME = 'pdotest.sqlite';
-	private static $dsn;
-	private static $file;
-
-	public static function setUpBeforeClass() {
-
-		self::$file = PHPUNIT_TEMP_DIR . '/' . self::FILENAME;
-		self::$dsn = 'sqlite:' . self::$file;
-
-		if(extension_loaded('pdo_sqlite')) {
-			$drop = 'DROP TABLE IF EXISTS log4php_log;';
-			$create = 'CREATE TABLE log4php_log (
-				timestamp VARCHAR(256),
-				logger VARCHAR(256),
-				level VARCHAR(32),
-				message VARCHAR(4000),
-				thread INTEGER,
-				file VARCHAR(255),
-				line VARCHAR(10)
-			);';
-
-			$pdo = new PDO(self::$dsn);
-			$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-			$pdo->exec($drop);
-			$pdo->exec($create);
-		}
-	}
-
-	/** To start with an empty database for each single test. */
-	public function setUp() {
-		if(!extension_loaded('pdo_sqlite')) {
-			self::markTestSkipped("Please install 'pdo_sqlite' in order to run this test");
-		}
-	}
-
-	/** Clean up after the last test was run. */
-	public static function tearDownAfterClass() {
-		@unlink(self::$file);
-	}
-
-	public function testRequiresLayout() {
-		$appender = new PDOAppender();
-		self::assertFalse($appender->requiresLayout());
-	}
-
-	/** Tests new-style logging using prepared statements and the default SQL definition. */
-	public function testSimpleWithDefaults() {
-		// Log event
-		$event = new LoggingEvent("LoggerAppenderPDOTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
-		$appender = new PDOAppender("myname");
-		$appender->setDSN(self::$dsn);
-		$appender->activateOptions();
-		$appender->append($event);
-		$appender->close();
-
-		// Test the default pattern
-		$db = new PDO(self::$dsn);
-		$query = "SELECT * FROM log4php_log";
-		$sth = $db->query($query);
-		$row = $sth->fetch(PDO::FETCH_NUM);
-
-		self::assertTrue(is_array($row), "No rows found.");
-		self::assertEquals(7, count($row));
-		self::assertEquals(1, preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/', $row[0])); // datetime
-		self::assertEquals('TEST', $row[1]); // logger name
-		self::assertEquals('ERROR', $row[2]); // level
-		self::assertEquals('testmessage', $row[3]); // message
-		if (function_exists('posix_getpid')) {
-			self::assertEquals(posix_getpid(), $row[4]); // process id
-		}
-		self::assertEquals('NA', $row[5]); // file, NA due to phpunit magic
-		self::assertEquals('NA', $row[6]); // line, NA due to phpunit magic
-	}
-
-
-	/** Tests new style prepared statment logging with customized SQL. */
-	public function testCustomizedSql() {
-
-		$dateFormat = "Y-m-d H:i:s";
-
-		// Prepare appender
-		$appender = new PDOAppender("myname");
-		$appender->setDSN(self::$dsn);
-		$appender->setInsertSql("INSERT INTO log4php_log (file, line, thread, timestamp, logger, level, message) VALUES (?,?,?,?,?,?,?)");
-		$appender->setInsertPattern("%F,%L,%t,%d\{$dateFormat\},%c,%p,%m");
-		$appender->activateOptions();
-
-		// Action!
-		$event = new LoggingEvent("LoggerAppenderPDOTest2", new Logger("TEST"), Level::getLevelError(), "testmessage");
-		$appender->append($event);
-
-		// Check
-		$db = new PDO(self::$dsn);
-		$result = $db->query("SELECT * FROM log4php_log");
-		$row = $result->fetch(PDO::FETCH_OBJ);
-		self::assertTrue(is_object($row));
-		self::assertEquals("NA", $row->file); // "NA" due to phpunit magic
-		self::assertEquals("NA", $row->line); // "NA" due to phpunit magic
-		if (function_exists('posix_getpid')) {
-			self::assertEquals(posix_getpid(), $row->thread);
-		}
-		self::assertEquals(1, preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/', $row->timestamp));
-		self::assertEquals('TEST', $row->logger);
-		self::assertEquals('ERROR', $row->level);
-		self::assertEquals('testmessage', $row->message);
-	}
-
-	/**
-	 * Tests a warning is shown when connecting to invalid dns.
- 	 * @expectedException PHPUnit_Framework_Error
- 	 * @expectedExceptionMessage invalid data source name
-	 */
-	public function testException() {
-		$dsn = 'doenotexist';
-		$appender = new PDOAppender("myname");
-		$appender->setDSN($dsn);
-		$appender->activateOptions();
-	}
-
-	/**
-	 * Check whether close() actually closes the database connection.
-	 */
-	public function testClose() {
-		$event = new LoggingEvent("LoggerAppenderPDOTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
-
-		$appender = new PDOAppender("myname");
-		$appender->setDSN(self::$dsn);
-		$appender->activateOptions();
-		$appender->append($event);
-		$appender->close();
-
-		self::assertNull($appender->getDatabaseHandle());
-	}
+class PDOAppenderTest extends \PHPUnit_Framework_TestCase
+{
+    const FILENAME = 'pdotest.sqlite';
+    private static $dsn;
+    private static $file;
+
+    public static function setUpBeforeClass()
+    {
+        self::$file = PHPUNIT_TEMP_DIR . '/' . self::FILENAME;
+        self::$dsn = 'sqlite:' . self::$file;
+
+        if (extension_loaded('pdo_sqlite')) {
+            $drop = 'DROP TABLE IF EXISTS log4php_log;';
+            $create = 'CREATE TABLE log4php_log (
+                timestamp VARCHAR(256),
+                logger VARCHAR(256),
+                level VARCHAR(32),
+                message VARCHAR(4000),
+                thread INTEGER,
+                file VARCHAR(255),
+                line VARCHAR(10)
+            );';
+
+            $pdo = new PDO(self::$dsn);
+            $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+            $pdo->exec($drop);
+            $pdo->exec($create);
+        }
+    }
+
+    /** To start with an empty database for each single test. */
+    public function setUp()
+    {
+        if (!extension_loaded('pdo_sqlite')) {
+            self::markTestSkipped("Please install 'pdo_sqlite' in order to run this test");
+        }
+    }
+
+    /** Clean up after the last test was run. */
+    public static function tearDownAfterClass()
+    {
+        @unlink(self::$file);
+    }
+
+    public function testRequiresLayout()
+    {
+        $appender = new PDOAppender();
+        self::assertFalse($appender->requiresLayout());
+    }
+
+    /** Tests new-style logging using prepared statements and the default SQL definition. */
+    public function testSimpleWithDefaults()
+    {
+        // Log event
+        $event = new LoggingEvent("LoggerAppenderPDOTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+        $appender = new PDOAppender("myname");
+        $appender->setDSN(self::$dsn);
+        $appender->activateOptions();
+        $appender->append($event);
+        $appender->close();
+
+        // Test the default pattern
+        $db = new PDO(self::$dsn);
+        $query = "SELECT * FROM log4php_log";
+        $sth = $db->query($query);
+        $row = $sth->fetch(PDO::FETCH_NUM);
+
+        self::assertTrue(is_array($row), "No rows found.");
+        self::assertEquals(7, count($row));
+        self::assertEquals(1, preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/', $row[0])); // datetime
+        self::assertEquals('TEST', $row[1]); // logger name
+        self::assertEquals('ERROR', $row[2]); // level
+        self::assertEquals('testmessage', $row[3]); // message
+        if (function_exists('posix_getpid')) {
+            self::assertEquals(posix_getpid(), $row[4]); // process id
+        }
+        self::assertEquals('NA', $row[5]); // file, NA due to phpunit magic
+        self::assertEquals('NA', $row[6]); // line, NA due to phpunit magic
+    }
+
+    /** Tests new style prepared statment logging with customized SQL. */
+    public function testCustomizedSql()
+    {
+        $dateFormat = "Y-m-d H:i:s";
+
+        // Prepare appender
+        $appender = new PDOAppender("myname");
+        $appender->setDSN(self::$dsn);
+        $appender->setInsertSql("INSERT INTO log4php_log (file, line, thread, timestamp, logger, level, message) VALUES (?,?,?,?,?,?,?)");
+        $appender->setInsertPattern("%F,%L,%t,%d\{$dateFormat\},%c,%p,%m");
+        $appender->activateOptions();
+
+        // Action!
+        $event = new LoggingEvent("LoggerAppenderPDOTest2", new Logger("TEST"), Level::getLevelError(), "testmessage");
+        $appender->append($event);
+
+        // Check
+        $db = new PDO(self::$dsn);
+        $result = $db->query("SELECT * FROM log4php_log");
+        $row = $result->fetch(PDO::FETCH_OBJ);
+        self::assertTrue(is_object($row));
+        self::assertEquals("NA", $row->file); // "NA" due to phpunit magic
+        self::assertEquals("NA", $row->line); // "NA" due to phpunit magic
+        if (function_exists('posix_getpid')) {
+            self::assertEquals(posix_getpid(), $row->thread);
+        }
+        self::assertEquals(1, preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/', $row->timestamp));
+        self::assertEquals('TEST', $row->logger);
+        self::assertEquals('ERROR', $row->level);
+        self::assertEquals('testmessage', $row->message);
+    }
+
+    /**
+     * Tests a warning is shown when connecting to invalid dns.
+      * @expectedException PHPUnit_Framework_Error
+      * @expectedExceptionMessage invalid data source name
+     */
+    public function testException()
+    {
+        $dsn = 'doenotexist';
+        $appender = new PDOAppender("myname");
+        $appender->setDSN($dsn);
+        $appender->activateOptions();
+    }
+
+    /**
+     * Check whether close() actually closes the database connection.
+     */
+    public function testClose()
+    {
+        $event = new LoggingEvent("LoggerAppenderPDOTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+
+        $appender = new PDOAppender("myname");
+        $appender->setDSN(self::$dsn);
+        $appender->activateOptions();
+        $appender->append($event);
+        $appender->close();
+
+        self::assertNull($appender->getDatabaseHandle());
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/Appenders/PhpAppenderTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Appenders/PhpAppenderTest.php b/tests/src/Appenders/PhpAppenderTest.php
index 0653f65..7fb0ddc 100644
--- a/tests/src/Appenders/PhpAppenderTest.php
+++ b/tests/src/Appenders/PhpAppenderTest.php
@@ -28,71 +28,74 @@ use Apache\Log4php\Logger;
 /**
  * @group appenders
  */
-class PhpAppenderTest extends \PHPUnit_Framework_TestCase {
-
-	public static $expectedMessage;
-
-	public static $expectedError;
-
-	private $config = array(
-		'rootLogger' => array(
-			'appenders' => array('default'),
-			'level' => 'trace'
-		),
-		'appenders' => array(
-			'default' => array(
-				'class' => 'PhpAppender',
-				'layout' => array(
-					'class' => 'SimpleLayout'
-				),
-			)
-		)
-	);
-
-    protected function setUp() {
-    	$that = $this; // hack for PHP 5.3
-		set_error_handler(function ($errno, $errstr, $errfile, $errline) use ($that) {
-			$that::assertEquals($that::$expectedError, $errno);
-			$that::assertEquals($that::$expectedMessage, $errstr);
-		});
-	}
-
-	public function testRequiresLayout() {
-		$appender = new PhpAppender();
-		$this->assertTrue($appender->requiresLayout());
-	}
+class PhpAppenderTest extends \PHPUnit_Framework_TestCase
+{
+    public static $expectedMessage;
+
+    public static $expectedError;
+
+    private $config = array(
+        'rootLogger' => array(
+            'appenders' => array('default'),
+            'level' => 'trace'
+        ),
+        'appenders' => array(
+            'default' => array(
+                'class' => 'PhpAppender',
+                'layout' => array(
+                    'class' => 'SimpleLayout'
+                ),
+            )
+        )
+    );
+
+    protected function setUp()
+    {
+        $that = $this; // hack for PHP 5.3
+        set_error_handler(function ($errno, $errstr, $errfile, $errline) use ($that) {
+            $that::assertEquals($that::$expectedError, $errno);
+            $that::assertEquals($that::$expectedMessage, $errstr);
+        });
+    }
 
-	public function testPhp() {
-		Logger::configure($this->config);
-		$logger = Logger::getRootLogger();
+    public function testRequiresLayout()
+    {
+        $appender = new PhpAppender();
+        $this->assertTrue($appender->requiresLayout());
+    }
 
+    public function testPhp()
+    {
+        Logger::configure($this->config);
+        $logger = Logger::getRootLogger();
 
-		self::$expectedError = E_USER_ERROR;
-		self::$expectedMessage = "FATAL - This is a test" . PHP_EOL;
-		$logger->fatal("This is a test");
+        self::$expectedError = E_USER_ERROR;
+        self::$expectedMessage = "FATAL - This is a test" . PHP_EOL;
+        $logger->fatal("This is a test");
 
-		self::$expectedError = E_USER_ERROR;
-		self::$expectedMessage = "ERROR - This is a test" . PHP_EOL;
-		$logger->error("This is a test");
+        self::$expectedError = E_USER_ERROR;
+        self::$expectedMessage = "ERROR - This is a test" . PHP_EOL;
+        $logger->error("This is a test");
 
-		self::$expectedError = E_USER_WARNING;
-		self::$expectedMessage = "WARN - This is a test" . PHP_EOL;
-		$logger->warn("This is a test");
+        self::$expectedError = E_USER_WARNING;
+        self::$expectedMessage = "WARN - This is a test" . PHP_EOL;
+        $logger->warn("This is a test");
 
-		self::$expectedError = E_USER_NOTICE;
-		self::$expectedMessage = "INFO - This is a test" . PHP_EOL;
-		$logger->info("This is a test");
+        self::$expectedError = E_USER_NOTICE;
+        self::$expectedMessage = "INFO - This is a test" . PHP_EOL;
+        $logger->info("This is a test");
 
-		self::$expectedError = E_USER_NOTICE;
-		self::$expectedMessage = "DEBUG - This is a test" . PHP_EOL;
-		$logger->debug("This is a test");
+        self::$expectedError = E_USER_NOTICE;
+        self::$expectedMessage = "DEBUG - This is a test" . PHP_EOL;
+        $logger->debug("This is a test");
 
-		self::$expectedError = E_USER_NOTICE;
-		self::$expectedMessage = "TRACE - This is a test" . PHP_EOL;
-		$logger->trace("This is a test");
+        self::$expectedError = E_USER_NOTICE;
+        self::$expectedMessage = "TRACE - This is a test" . PHP_EOL;
+        $logger->trace("This is a test");
     }
 
-    protected function tearDown() {
-		restore_error_handler();
-	}
+    protected function tearDown()
+    {
+        restore_error_handler();
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/Appenders/RollingFileAppenderTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Appenders/RollingFileAppenderTest.php b/tests/src/Appenders/RollingFileAppenderTest.php
index d284f3c..725abc8 100644
--- a/tests/src/Appenders/RollingFileAppenderTest.php
+++ b/tests/src/Appenders/RollingFileAppenderTest.php
@@ -25,188 +25,196 @@ namespace Apache\Log4php\Tests\Appenders;
 use Apache\Log4php\Appenders\RollingFileAppender;
 use Apache\Log4php\Layouts\SimpleLayout;
 use Apache\Log4php\Tests\TestHelper;
-use Apache\Log4php\LoggingEvent;
 use Apache\Log4php\Logger;
-use Apache\Log4php\Level;
 
 /**
  * @group appenders
  */
-class RollingFileAppenderTest extends \PHPUnit_Framework_TestCase {
+class RollingFileAppenderTest extends \PHPUnit_Framework_TestCase
+{
+    const WARNING_MASSAGE = 'WARN - my messageXYZ';
 
-	const WARNING_MASSAGE = 'WARN - my messageXYZ';
+    protected function setUp()
+    {
+        @unlink(PHPUNIT_TEMP_DIR . '/TEST-rolling.txt');
+        @unlink(PHPUNIT_TEMP_DIR . '/TEST-rolling.txt.1');
+        @unlink(PHPUNIT_TEMP_DIR . '/TEST-rolling.txt.2');
+    }
 
-	protected function setUp() {
-		@unlink(PHPUNIT_TEMP_DIR . '/TEST-rolling.txt');
-		@unlink(PHPUNIT_TEMP_DIR . '/TEST-rolling.txt.1');
-		@unlink(PHPUNIT_TEMP_DIR . '/TEST-rolling.txt.2');
-	}
+    public function testRequiresLayout()
+    {
+        $appender = new RollingFileAppender();
+        self::assertTrue($appender->requiresLayout());
+    }
 
-	public function testRequiresLayout() {
-		$appender = new RollingFileAppender();
-		self::assertTrue($appender->requiresLayout());
-	}
+    public function testMaxFileSize()
+    {
+        $appender = new RollingFileAppender("mylogger");
 
-	public function testMaxFileSize() {
-		$appender = new RollingFileAppender("mylogger");
+        $appender->setMaxFileSize('1KB');
+        self::assertEquals(1024, $appender->getMaxFileSize());
 
-		$appender->setMaxFileSize('1KB');
-		self::assertEquals(1024, $appender->getMaxFileSize());
+        $appender->setMaxFileSize('2KB');
+        self::assertEquals(2048, $appender->getMaxFileSize());
 
-		$appender->setMaxFileSize('2KB');
-		self::assertEquals(2048, $appender->getMaxFileSize());
+        $appender->setMaxFileSize('1MB');
+        self::assertEquals(1048576, $appender->getMaxFileSize());
 
-		$appender->setMaxFileSize('1MB');
-		self::assertEquals(1048576, $appender->getMaxFileSize());
+        $appender->setMaxFileSize('3MB');
+        self::assertEquals(3145728, $appender->getMaxFileSize());
 
-		$appender->setMaxFileSize('3MB');
-		self::assertEquals(3145728, $appender->getMaxFileSize());
+        $appender->setMaxFileSize('1GB');
+        self::assertEquals(1073741824, $appender->getMaxFileSize());
 
-		$appender->setMaxFileSize('1GB');
-		self::assertEquals(1073741824, $appender->getMaxFileSize());
+        $appender->setMaxFileSize('10000');
+        self::assertEquals(10000, $appender->getMaxFileSize());
 
-		$appender->setMaxFileSize('10000');
-		self::assertEquals(10000, $appender->getMaxFileSize());
+        $appender->setMaxFileSize('100.5');
+        self::assertEquals(100, $appender->getMaxFileSize());
 
-		$appender->setMaxFileSize('100.5');
-		self::assertEquals(100, $appender->getMaxFileSize());
+        $appender->setMaxFileSize('1000.6');
+        self::assertEquals(1000, $appender->getMaxFileSize());
 
-		$appender->setMaxFileSize('1000.6');
-		self::assertEquals(1000, $appender->getMaxFileSize());
+        $appender->setMaxFileSize('1.5MB');
+        self::assertEquals(1572864, $appender->getMaxFileSize());
+    }
 
-		$appender->setMaxFileSize('1.5MB');
-		self::assertEquals(1572864, $appender->getMaxFileSize());
-	}
+    /**
+     * @return RollingFileAppender
+     */
+    private function createRolloverAppender()
+    {
+        $layout = new SimpleLayout();
 
-	/**
-	 * @return RollingFileAppender
-	 */
-	private function createRolloverAppender() {
-		$layout = new SimpleLayout();
+        $appender = new RollingFileAppender("mylogger");
+        $appender->setFile(PHPUNIT_TEMP_DIR . '/TEST-rolling.txt');
+        $appender->setLayout($layout);
+        $appender->setMaxFileSize('1KB');
+        $appender->setMaxBackupIndex(2);
+        $appender->activateOptions();
 
-		$appender = new RollingFileAppender("mylogger");
-		$appender->setFile(PHPUNIT_TEMP_DIR . '/TEST-rolling.txt');
-		$appender->setLayout($layout);
-		$appender->setMaxFileSize('1KB');
-		$appender->setMaxBackupIndex(2);
-		$appender->activateOptions();
+        return $appender;
+    }
 
-		return $appender;
-	}
+    public function testSimpleLogging()
+    {
+        $appender = $this->createRolloverAppender();
 
-	public function testSimpleLogging() {
-		$appender = $this->createRolloverAppender();
+        $event = TestHelper::getWarnEvent("my message123");
 
-		$event = TestHelper::getWarnEvent("my message123");
+        for ($i = 0; $i < 1000; $i++) {
+            $appender->append($event);
+        }
 
-		for($i = 0; $i < 1000; $i++) {
-			$appender->append($event);
-		}
+        $appender->append(TestHelper::getWarnEvent("my messageXYZ"));
 
-		$appender->append(TestHelper::getWarnEvent("my messageXYZ"));
+        $appender->close();
 
-		$appender->close();
+        $file = PHPUNIT_TEMP_DIR . '/TEST-rolling.txt';
+        $data = file($file);
+        $line = $data[count($data)-1];
+        $e = "WARN - my messageXYZ".PHP_EOL;
+        self::assertEquals($e, $line);
 
-		$file = PHPUNIT_TEMP_DIR . '/TEST-rolling.txt';
-		$data = file($file);
-		$line = $data[count($data)-1];
-		$e = "WARN - my messageXYZ".PHP_EOL;
-		self::assertEquals($e, $line);
+        $file = PHPUNIT_TEMP_DIR . '/TEST-rolling.txt.1';
+        $this->checkFileContent($file);
 
-		$file = PHPUNIT_TEMP_DIR . '/TEST-rolling.txt.1';
-		$this->checkFileContent($file);
+        $file = PHPUNIT_TEMP_DIR . '/TEST-rolling.txt.2';
+        $this->checkFileContent($file);
 
-		$file = PHPUNIT_TEMP_DIR . '/TEST-rolling.txt.2';
-		$this->checkFileContent($file);
+        // Should not roll over three times
+        $this->assertFalse(file_exists(PHPUNIT_TEMP_DIR.'/TEST-rolling.txt.3'));
+    }
 
-		// Should not roll over three times
-		$this->assertFalse(file_exists(PHPUNIT_TEMP_DIR.'/TEST-rolling.txt.3'));
-	}
+    public function testLoggingViaLogger()
+    {
+        $logger = Logger::getLogger('mycat');
+        $logger->setAdditivity(false);
 
-	public function testLoggingViaLogger() {
-		$logger = Logger::getLogger('mycat');
-		$logger->setAdditivity(false);
+        $appender = $this->createRolloverAppender();
 
-		$appender = $this->createRolloverAppender();
+        $logger->addAppender($appender);
 
-		$logger->addAppender($appender);
+        for ($i = 0; $i < 1000; $i++) {
+            $logger->warn("my message123");
+        }
 
-		for($i = 0; $i < 1000; $i++) {
-			$logger->warn("my message123");
-		}
+        $logger->warn("my messageXYZ");
 
-		$logger->warn("my messageXYZ");
+        $file = PHPUNIT_TEMP_DIR.'/TEST-rolling.txt';
+        $data = file($file);
 
-		$file = PHPUNIT_TEMP_DIR.'/TEST-rolling.txt';
-		$data = file($file);
+        $line = $data[count($data)-1];
+        $e = "WARN - my messageXYZ".PHP_EOL;
+        self::assertEquals($e, $line);
 
-		$line = $data[count($data)-1];
-		$e = "WARN - my messageXYZ".PHP_EOL;
-		self::assertEquals($e, $line);
+        $file = PHPUNIT_TEMP_DIR.'/TEST-rolling.txt.1';
+        $this->checkFileContent($file);
 
-		$file = PHPUNIT_TEMP_DIR.'/TEST-rolling.txt.1';
-		$this->checkFileContent($file);
+        $file = PHPUNIT_TEMP_DIR.'/TEST-rolling.txt.2';
+        $this->checkFileContent($file);
 
-		$file = PHPUNIT_TEMP_DIR.'/TEST-rolling.txt.2';
-		$this->checkFileContent($file);
+        $this->assertFalse(file_exists(PHPUNIT_TEMP_DIR.'/TEST-rolling.txt.3'), 'should not roll over three times');
+    }
 
-		$this->assertFalse(file_exists(PHPUNIT_TEMP_DIR.'/TEST-rolling.txt.3'), 'should not roll over three times');
-	}
+    public function testRolloverWithCompression()
+    {
+        $logger = Logger::getLogger('mycat');
+        $logger->setAdditivity(false);
 
-	public function testRolloverWithCompression() {
-		$logger = Logger::getLogger('mycat');
-		$logger->setAdditivity(false);
+        $appender = $this->createRolloverAppender();
+        $appender->setCompress(true);
 
-		$appender = $this->createRolloverAppender();
-		$appender->setCompress(true);
+        $logger->addAppender($appender);
 
-		$logger->addAppender($appender);
+        for ($i = 0; $i < 1000; $i++) {
+            $logger->warn(self::WARNING_MASSAGE. $i);
+        }
 
-		for($i = 0; $i < 1000; $i++) {
-			$logger->warn(self::WARNING_MASSAGE. $i);
-		}
+        $logger->warn("my messageXYZ");
 
-		$logger->warn("my messageXYZ");
+        $file = PHPUNIT_TEMP_DIR . '/TEST-rolling.txt';
+        $data = file($file);
 
-		$file = PHPUNIT_TEMP_DIR . '/TEST-rolling.txt';
-		$data = file($file);
+        $line = $data[count($data)-1];
+        $e = self::WARNING_MASSAGE.PHP_EOL;
+        self::assertEquals($e, $line);
 
-		$line = $data[count($data)-1];
-		$e = self::WARNING_MASSAGE.PHP_EOL;
-		self::assertEquals($e, $line);
+        $firstCompressedRollingFile = PHPUNIT_TEMP_DIR . '/TEST-rolling.txt.1.gz';
+        $this->assertTrue(file_exists($firstCompressedRollingFile),'TEST-rolling.txt.1.gz not found');
 
-		$firstCompressedRollingFile = PHPUNIT_TEMP_DIR . '/TEST-rolling.txt.1.gz';
-		$this->assertTrue(file_exists($firstCompressedRollingFile),'TEST-rolling.txt.1.gz not found');
+        $firstUncompressedRollingField = PHPUNIT_TEMP_DIR . '/TEST-rolling.txt.1';
+        $this->assertFalse(file_exists($firstUncompressedRollingField),'TEST-rolling.txt.1 should be replaced by compressed');
 
-		$firstUncompressedRollingField = PHPUNIT_TEMP_DIR . '/TEST-rolling.txt.1';
-		$this->assertFalse(file_exists($firstUncompressedRollingField),'TEST-rolling.txt.1 should be replaced by compressed');
+        $secondCompressedRollingFile = PHPUNIT_TEMP_DIR . '/TEST-rolling.txt.2.gz';
+        $this->assertTrue(file_exists($secondCompressedRollingFile), 'TEST-rolling.txt.2.gz not found');
 
-		$secondCompressedRollingFile = PHPUNIT_TEMP_DIR . '/TEST-rolling.txt.2.gz';
-		$this->assertTrue(file_exists($secondCompressedRollingFile), 'TEST-rolling.txt.2.gz not found');
+        $secondUncompressedRollingField = PHPUNIT_TEMP_DIR . '/TEST-rolling.txt.2';
+        $this->assertFalse(file_exists($secondUncompressedRollingField),'TEST-rolling.txt.2 should be replaced by compressed');
 
-		$secondUncompressedRollingField = PHPUNIT_TEMP_DIR . '/TEST-rolling.txt.2';
-		$this->assertFalse(file_exists($secondUncompressedRollingField),'TEST-rolling.txt.2 should be replaced by compressed');
+    }
 
-	}
+    private function checkFileContent($file)
+    {
+        $data = file($file);
+        $this->checkText($data);
+    }
 
-	private function checkFileContent($file) {
-		$data = file($file);
-		$this->checkText($data);
-	}
+    private function checkText($text)
+    {
+        $line = $text[count($text)-1];
+        $e = "WARN - my message123".PHP_EOL;
+        foreach ($text as $r) {
+            self::assertEquals($e, $r);
+        }
+    }
 
-	private function checkText($text) {
-		$line = $text[count($text)-1];
-		$e = "WARN - my message123".PHP_EOL;
-		foreach($text as $r) {
-			self::assertEquals($e, $r);
-		}
-	}
-
-	protected function tearDown() {
-		@unlink(PHPUNIT_TEMP_DIR.'/TEST-rolling.txt');
-		@unlink(PHPUNIT_TEMP_DIR.'/TEST-rolling.txt.1');
-		@unlink(PHPUNIT_TEMP_DIR.'/TEST-rolling.txt.2');
-		@unlink(PHPUNIT_TEMP_DIR.'/TEST-rolling.txt.1.gz');
-		@unlink(PHPUNIT_TEMP_DIR.'/TEST-rolling.txt.2.gz');
-	}
+    protected function tearDown()
+    {
+        @unlink(PHPUNIT_TEMP_DIR.'/TEST-rolling.txt');
+        @unlink(PHPUNIT_TEMP_DIR.'/TEST-rolling.txt.1');
+        @unlink(PHPUNIT_TEMP_DIR.'/TEST-rolling.txt.2');
+        @unlink(PHPUNIT_TEMP_DIR.'/TEST-rolling.txt.1.gz');
+        @unlink(PHPUNIT_TEMP_DIR.'/TEST-rolling.txt.2.gz');
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/Appenders/SocketAppenderTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Appenders/SocketAppenderTest.php b/tests/src/Appenders/SocketAppenderTest.php
index 9cd1482..27c9ef1 100644
--- a/tests/src/Appenders/SocketAppenderTest.php
+++ b/tests/src/Appenders/SocketAppenderTest.php
@@ -28,124 +28,132 @@ use Apache\Log4php\Logger;
 /**
  * @group appenders
  */
-class SocketAppenderTest extends \PHPUnit_Framework_TestCase {
-
-	/** Port on which the socket server will run. */
-	const SOCKET_PORT = 12345;
-
-	/** The socket server process resource. */
-	private $server;
-
-	/** The pipes array for the server process. */
-	private $pipes;
-
-	public function setUp() {
-		Logger::clear();
-	}
-
-	public function tearDown() {
-		Logger::clear();
-	}
-
-	public function testRequiresLayout() {
-		$appender = new SocketAppender();
-		self::assertTrue($appender->requiresLayout());
-	}
-
-	public function testLogging()
-	{
-		Logger::configure(array(
-		    'appenders' => array(
-		        'default' => array(
-		            'class' => 'SocketAppender',
-		            'params' => array(
-		                'remoteHost' => 'localhost',
-		                'port' => self::SOCKET_PORT
-		            ),
-		            'layout' => array(
-		            	'class' => 'SimpleLayout'
-		            )
-		        ),
-		    ),
-		    'rootLogger' => array(
-		        'appenders' => array('default'),
-		    ),
-		));
-
-		$this->startServer();
-
-		$logger = Logger::getLogger("myLogger");
-		$logger->trace("This message is a test");
-		$logger->debug("This message is a test");
-		$logger->info("This message is a test");
-		$logger->warn("This message is a test");
-		$logger->error("This message is a test");
-		$logger->fatal("This message is a test");
-
-		$actual = $this->getPlayback();
-		$this->stopServer();
-
-		$expected = "DEBUG - This message is a test" .
-		            "INFO - This message is a test" .
-		            "WARN - This message is a test" .
-		            "ERROR - This message is a test" .
-		            "FATAL - This message is a test";
-
-		$this->assertEquals($expected, $actual);
-	}
-
-	/** Starts a socket server in a separate process. */
-	private function startServer() {
-		$serverLog = PHPUNIT_TEMP_DIR . '/socketServer.log';
-		$descriptorspec = array(
-			0 => array("pipe", "r"),  // stdin
-			1 => array("file", $serverLog, "a"),// stdout
-			2 => array("file", $serverLog, "a") // stderr
-		);
-
-		$cmd = "php " . dirname(__FILE__) . '/socketServer.php';
-		$this->server = proc_open($cmd, $descriptorspec, $this->pipes);
-		if ($this->server === false) {
-			throw new Exception("Failed starting the socket server process.");
-		}
-
-		// Sleep a bit to allow server to start
-		usleep(200000);
-
-		// Verify the server is running
-		$status = proc_get_status($this->server);
-		if (!$status['running']) {
-			throw new Exception("Socket server process failed to start. Check the log at [$serverLog].");
-		}
-	}
-
-	/** Sends a message to the socket server and returns the reply. */
-	private function socketSend($msg) {
-		$sock = fsockopen('localhost', self::SOCKET_PORT, $errno, $errstr);
-		if ($sock === false) {
-			throw new Exception("Unable to open socket. Error: [$errno] $errstr");
-		}
-
-		fputs($sock, "$msg\n");
-		$reply = '';
-		while(!feof($sock)) {
-			$reply .= fgets($sock);
-		}
-		fclose($sock);
-		return trim($reply);
-	}
-
-	/** Retrieves a playback of all sent messages from the socket server. */
-	private function getPlayback() {
-		return $this->socketSend('playback');
-	}
-
-	/** Stops the socket server and closes the process. */
-	private function stopServer() {
-		$this->socketSend('shutdown');
-		foreach($this->pipes as $pipe) {
-			fclose($pipe);
-		}
-		proc_close($this->server);
-	}
+class SocketAppenderTest extends \PHPUnit_Framework_TestCase
+{
+    /** Port on which the socket server will run. */
+    const SOCKET_PORT = 12345;
+
+    /** The socket server process resource. */
+    private $server;
+
+    /** The pipes array for the server process. */
+    private $pipes;
+
+    public function setUp()
+    {
+        Logger::clear();
+    }
+
+    public function tearDown()
+    {
+        Logger::clear();
+    }
+
+    public function testRequiresLayout()
+    {
+        $appender = new SocketAppender();
+        self::assertTrue($appender->requiresLayout());
+    }
+
+    public function testLogging()
+    {
+        Logger::configure(array(
+            'appenders' => array(
+                'default' => array(
+                    'class' => 'SocketAppender',
+                    'params' => array(
+                        'remoteHost' => 'localhost',
+                        'port' => self::SOCKET_PORT
+                    ),
+                    'layout' => array(
+                        'class' => 'SimpleLayout'
+                    )
+                ),
+            ),
+            'rootLogger' => array(
+                'appenders' => array('default'),
+            ),
+        ));
+
+        $this->startServer();
+
+        $logger = Logger::getLogger("myLogger");
+        $logger->trace("This message is a test");
+        $logger->debug("This message is a test");
+        $logger->info("This message is a test");
+        $logger->warn("This message is a test");
+        $logger->error("This message is a test");
+        $logger->fatal("This message is a test");
+
+        $actual = $this->getPlayback();
+        $this->stopServer();
+
+        $expected = "DEBUG - This message is a test" .
+                    "INFO - This message is a test" .
+                    "WARN - This message is a test" .
+                    "ERROR - This message is a test" .
+                    "FATAL - This message is a test";
+
+        $this->assertEquals($expected, $actual);
+    }
+
+    /** Starts a socket server in a separate process. */
+    private function startServer()
+    {
+        $serverLog = PHPUNIT_TEMP_DIR . '/socketServer.log';
+        $descriptorspec = array(
+            0 => array("pipe", "r"),  // stdin
+            1 => array("file", $serverLog, "a"),// stdout
+            2 => array("file", $serverLog, "a") // stderr
+        );
+
+        $cmd = "php " . dirname(__FILE__) . '/socketServer.php';
+        $this->server = proc_open($cmd, $descriptorspec, $this->pipes);
+        if ($this->server === false) {
+            throw new Exception("Failed starting the socket server process.");
+        }
+
+        // Sleep a bit to allow server to start
+        usleep(200000);
+
+        // Verify the server is running
+        $status = proc_get_status($this->server);
+        if (!$status['running']) {
+            throw new Exception("Socket server process failed to start. Check the log at [$serverLog].");
+        }
+    }
+
+    /** Sends a message to the socket server and returns the reply. */
+    private function socketSend($msg)
+    {
+        $sock = fsockopen('localhost', self::SOCKET_PORT, $errno, $errstr);
+        if ($sock === false) {
+            throw new Exception("Unable to open socket. Error: [$errno] $errstr");
+        }
+
+        fputs($sock, "$msg\n");
+        $reply = '';
+        while (!feof($sock)) {
+            $reply .= fgets($sock);
+        }
+        fclose($sock);
+
+        return trim($reply);
+    }
+
+    /** Retrieves a playback of all sent messages from the socket server. */
+    private function getPlayback()
+    {
+        return $this->socketSend('playback');
+    }
+
+    /** Stops the socket server and closes the process. */
+    private function stopServer()
+    {
+        $this->socketSend('shutdown');
+        foreach ($this->pipes as $pipe) {
+            fclose($pipe);
+        }
+        proc_close($this->server);
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/Appenders/SyslogAppenderTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Appenders/SyslogAppenderTest.php b/tests/src/Appenders/SyslogAppenderTest.php
index 91b1568..0d13108 100644
--- a/tests/src/Appenders/SyslogAppenderTest.php
+++ b/tests/src/Appenders/SyslogAppenderTest.php
@@ -38,216 +38,224 @@ use Apache\Log4php\LoggingEvent;
  *
  * @group appenders
  */
-class SyslogAppenderTest extends \PHPUnit_Framework_TestCase {
-
-	public function testSettersGetters() {
-
-		// Setters should accept any value, without validation
-		$expected = "Random string value";
-
-		$appender = new SyslogAppender();
-		$appender->setIdent($expected);
-		$appender->setFacility($expected);
-		$appender->setOverridePriority($expected);
-		$appender->setPriority($expected);
-		$appender->setOption($expected);
-
-		$actuals = array(
-			$appender->getIdent(),
-			$appender->getFacility(),
-			$appender->getOverridePriority(),
-			$appender->getPriority(),
-			$appender->getOption()
-		);
-
-		foreach($actuals as $actual) {
-			$this->assertSame($expected, $actual);
-		}
-	}
-
-	public function testRequiresLayout() {
-		$appender = new SyslogAppender();
-		$this->assertTrue($appender->requiresLayout());
-	}
-
-	public function testLogging() {
-		$appender = new SyslogAppender("myname");
-		$appender->setLayout(new SimpleLayout());
-		$appender->activateOptions();
-
-		$event = new LoggingEvent(__CLASS__, new Logger("TestLogger"), Level::getLevelError(), "testmessage");
-		$appender->append($event);
-	}
-
-	/** Tests parsing of "option" parameter. */
-	public function testOption() {
-		$options = array(
-			'CONS' => LOG_CONS,
-			'NDELAY' => LOG_NDELAY,
-			'ODELAY' => LOG_ODELAY,
-			'PERROR' => LOG_PERROR,
-			'PID' => LOG_PID,
-
-			// test some combinations
-			'CONS|NDELAY' => LOG_CONS | LOG_NDELAY,
-			'PID|PERROR' => LOG_PID | LOG_PERROR,
-			'CONS|PID|NDELAY' => LOG_CONS | LOG_PID | LOG_NDELAY
-		);
-
-		// Defaults
-		$defaultStr = "PID|CONS";
-		$default = LOG_PID | LOG_CONS;
-
-		// This makes reading of a private property possible
-		$property = new \ReflectionProperty('Apache\\Log4php\Appenders\\SyslogAppender', 'intOption');
-		$property->setAccessible(true);
-
-		// Check default value first
-		$appender = new SyslogAppender();
-		$appender->activateOptions();
-		$actual = $property->getValue($appender);
-		$this->assertSame($default, $actual, "Failed setting default option [$defaultStr]");
-
-		foreach($options as $option => $expected) {
-			$appender = new SyslogAppender();
-			$appender->setOption($option);
-			$appender->activateOptions();
-
-			$actual = $property->getValue($appender);
-			$this->assertSame($expected, $actual, "Failed setting option [$option].");
-		}
-	}
-
-	/** Tests parsing of "priority" parameter. */
-	public function testPriority() {
-		$default = null;
-		$defaultStr = 'null';
-
-		$priorities = array(
-			'EMERG' => LOG_EMERG,
-			'ALERT' => LOG_ALERT,
-			'CRIT' => LOG_CRIT,
-			'ERR' => LOG_ERR,
-			'WARNING' => LOG_WARNING,
-			'NOTICE' => LOG_NOTICE,
-			'INFO' => LOG_INFO,
-			'DEBUG' => LOG_DEBUG
-		);
-
-		// This makes reading of a private property possible
-		$property = new \ReflectionProperty('Apache\\Log4php\\Appenders\\SyslogAppender', 'intPriority');
-		$property->setAccessible(true);
-
-		// Check default value first
-		$appender = new SyslogAppender();
-		$appender->activateOptions();
-		$actual = $property->getValue($appender);
-		$this->assertSame($default, $actual, "Failed setting default priority [$defaultStr].");
-
-		foreach($priorities as $priority => $expected) {
-			$appender = new SyslogAppender();
-			$appender->setPriority($priority);
-			$appender->activateOptions();
-
-			$actual = $property->getValue($appender);
-			$this->assertSame($expected, $actual, "Failed setting priority [$priority].");
-		}
-	}
-
-	/** Tests parsing of "facility" parameter. */
-	public function testFacility() {
-		// Default value is the same on all OSs
-		$default = LOG_USER;
-		$defaultStr = 'USER';
-
-		// All possible facility strings (some of which might not exist depending on the OS)
-		$strings = array(
-			'KERN', 'USER', 'MAIL', 'DAEMON', 'AUTH',
-			'SYSLOG', 'LPR', 'NEWS', 'UUCP', 'CRON', 'AUTHPRIV',
-			'LOCAL0', 'LOCAL1', 'LOCAL2', 'LOCAL3', 'LOCAL4',
-			'LOCAL5', 'LOCAL6', 'LOCAL7',
-		);
-
-		// Only test facilities which exist on this OS
-		$facilities = array();
-		foreach($strings as $string) {
-			$const = "LOG_$string";
-			if (defined($const)) {
-				$facilities[$string] = constant($const);
-			}
-		}
-
-		// This makes reading of a private property possible
-		$property = new \ReflectionProperty('Apache\\Log4php\\Appenders\\SyslogAppender', 'intFacility');
-		$property->setAccessible(true);
-
-		// Check default value first
-		$appender = new SyslogAppender();
-		$appender->activateOptions();
-		$actual = $property->getValue($appender);
-		$this->assertSame($default, $default, "Failed setting default facility [$defaultStr].");
-
-		foreach($facilities as $facility => $expected) {
-			$appender = new SyslogAppender();
-			$appender->setFacility($facility);
-			$appender->activateOptions();
-
-			$actual = $property->getValue($appender);
-			$this->assertSame($expected, $actual, "Failed setting priority [$facility].");
-		}
-	}
-
-	/**
-	 * @expectedException PHPUnit_Framework_Error
-	 */
-	public function testInvalidOption() {
-		$appender = new SyslogAppender();
-		$appender->setOption('CONS|XYZ');
-		$appender->activateOptions();
-	}
-
-	/**
-	 * @expectedException PHPUnit_Framework_Error
-	 */
-	public function testInvalidPriority() {
-		$appender = new SyslogAppender();
-		$appender->setPriority('XYZ');
-		$appender->activateOptions();
-	}
-
-	/**
-	 * @expectedException PHPUnit_Framework_Error
-	 */
-	public function testInvalidFacility() {
-		$appender = new SyslogAppender();
-		$appender->setFacility('XYZ');
-		$appender->activateOptions();
-	}
-
-
-	public function testPriorityOverride() {
-		$appender = new SyslogAppender();
-		$appender->setPriority('EMERG');
-		$appender->setOverridePriority(true);
-		$appender->activateOptions();
-
-		$levels = array(
-			Level::getLevelTrace(),
-			Level::getLevelDebug(),
-			Level::getLevelInfo(),
-			Level::getLevelWarn(),
-			Level::getLevelError(),
-			Level::getLevelFatal(),
-		);
-
-		$expected = LOG_EMERG;
-
-		$method = new \ReflectionMethod('Apache\\Log4php\\Appenders\\SyslogAppender', 'getSyslogPriority');
-		$method->setAccessible(true);
-
-		foreach($levels as $level) {
-			$actual = $method->invoke($appender, $level);
-			$this->assertSame($expected, $actual);
-		}
-	}
+class SyslogAppenderTest extends \PHPUnit_Framework_TestCase
+{
+    public function testSettersGetters()
+    {
+        // Setters should accept any value, without validation
+        $expected = "Random string value";
+
+        $appender = new SyslogAppender();
+        $appender->setIdent($expected);
+        $appender->setFacility($expected);
+        $appender->setOverridePriority($expected);
+        $appender->setPriority($expected);
+        $appender->setOption($expected);
+
+        $actuals = array(
+            $appender->getIdent(),
+            $appender->getFacility(),
+            $appender->getOverridePriority(),
+            $appender->getPriority(),
+            $appender->getOption()
+        );
+
+        foreach ($actuals as $actual) {
+            $this->assertSame($expected, $actual);
+        }
+    }
+
+    public function testRequiresLayout()
+    {
+        $appender = new SyslogAppender();
+        $this->assertTrue($appender->requiresLayout());
+    }
+
+    public function testLogging()
+    {
+        $appender = new SyslogAppender("myname");
+        $appender->setLayout(new SimpleLayout());
+        $appender->activateOptions();
+
+        $event = new LoggingEvent(__CLASS__, new Logger("TestLogger"), Level::getLevelError(), "testmessage");
+        $appender->append($event);
+    }
+
+    /** Tests parsing of "option" parameter. */
+    public function testOption()
+    {
+        $options = array(
+            'CONS' => LOG_CONS,
+            'NDELAY' => LOG_NDELAY,
+            'ODELAY' => LOG_ODELAY,
+            'PERROR' => LOG_PERROR,
+            'PID' => LOG_PID,
+
+            // test some combinations
+            'CONS|NDELAY' => LOG_CONS | LOG_NDELAY,
+            'PID|PERROR' => LOG_PID | LOG_PERROR,
+            'CONS|PID|NDELAY' => LOG_CONS | LOG_PID | LOG_NDELAY
+        );
+
+        // Defaults
+        $defaultStr = "PID|CONS";
+        $default = LOG_PID | LOG_CONS;
+
+        // This makes reading of a private property possible
+        $property = new \ReflectionProperty('Apache\\Log4php\Appenders\\SyslogAppender', 'intOption');
+        $property->setAccessible(true);
+
+        // Check default value first
+        $appender = new SyslogAppender();
+        $appender->activateOptions();
+        $actual = $property->getValue($appender);
+        $this->assertSame($default, $actual, "Failed setting default option [$defaultStr]");
+
+        foreach ($options as $option => $expected) {
+            $appender = new SyslogAppender();
+            $appender->setOption($option);
+            $appender->activateOptions();
+
+            $actual = $property->getValue($appender);
+            $this->assertSame($expected, $actual, "Failed setting option [$option].");
+        }
+    }
+
+    /** Tests parsing of "priority" parameter. */
+    public function testPriority()
+    {
+        $default = null;
+        $defaultStr = 'null';
+
+        $priorities = array(
+            'EMERG' => LOG_EMERG,
+            'ALERT' => LOG_ALERT,
+            'CRIT' => LOG_CRIT,
+            'ERR' => LOG_ERR,
+            'WARNING' => LOG_WARNING,
+            'NOTICE' => LOG_NOTICE,
+            'INFO' => LOG_INFO,
+            'DEBUG' => LOG_DEBUG
+        );
+
+        // This makes reading of a private property possible
+        $property = new \ReflectionProperty('Apache\\Log4php\\Appenders\\SyslogAppender', 'intPriority');
+        $property->setAccessible(true);
+
+        // Check default value first
+        $appender = new SyslogAppender();
+        $appender->activateOptions();
+        $actual = $property->getValue($appender);
+        $this->assertSame($default, $actual, "Failed setting default priority [$defaultStr].");
+
+        foreach ($priorities as $priority => $expected) {
+            $appender = new SyslogAppender();
+            $appender->setPriority($priority);
+            $appender->activateOptions();
+
+            $actual = $property->getValue($appender);
+            $this->assertSame($expected, $actual, "Failed setting priority [$priority].");
+        }
+    }
+
+    /** Tests parsing of "facility" parameter. */
+    public function testFacility()
+    {
+        // Default value is the same on all OSs
+        $default = LOG_USER;
+        $defaultStr = 'USER';
+
+        // All possible facility strings (some of which might not exist depending on the OS)
+        $strings = array(
+            'KERN', 'USER', 'MAIL', 'DAEMON', 'AUTH',
+            'SYSLOG', 'LPR', 'NEWS', 'UUCP', 'CRON', 'AUTHPRIV',
+            'LOCAL0', 'LOCAL1', 'LOCAL2', 'LOCAL3', 'LOCAL4',
+            'LOCAL5', 'LOCAL6', 'LOCAL7',
+        );
+
+        // Only test facilities which exist on this OS
+        $facilities = array();
+        foreach ($strings as $string) {
+            $const = "LOG_$string";
+            if (defined($const)) {
+                $facilities[$string] = constant($const);
+            }
+        }
+
+        // This makes reading of a private property possible
+        $property = new \ReflectionProperty('Apache\\Log4php\\Appenders\\SyslogAppender', 'intFacility');
+        $property->setAccessible(true);
+
+        // Check default value first
+        $appender = new SyslogAppender();
+        $appender->activateOptions();
+        $actual = $property->getValue($appender);
+        $this->assertSame($default, $default, "Failed setting default facility [$defaultStr].");
+
+        foreach ($facilities as $facility => $expected) {
+            $appender = new SyslogAppender();
+            $appender->setFacility($facility);
+            $appender->activateOptions();
+
+            $actual = $property->getValue($appender);
+            $this->assertSame($expected, $actual, "Failed setting priority [$facility].");
+        }
+    }
+
+    /**
+     * @expectedException PHPUnit_Framework_Error
+     */
+    public function testInvalidOption()
+    {
+        $appender = new SyslogAppender();
+        $appender->setOption('CONS|XYZ');
+        $appender->activateOptions();
+    }
+
+    /**
+     * @expectedException PHPUnit_Framework_Error
+     */
+    public function testInvalidPriority()
+    {
+        $appender = new SyslogAppender();
+        $appender->setPriority('XYZ');
+        $appender->activateOptions();
+    }
+
+    /**
+     * @expectedException PHPUnit_Framework_Error
+     */
+    public function testInvalidFacility()
+    {
+        $appender = new SyslogAppender();
+        $appender->setFacility('XYZ');
+        $appender->activateOptions();
+    }
+
+    public function testPriorityOverride()
+    {
+        $appender = new SyslogAppender();
+        $appender->setPriority('EMERG');
+        $appender->setOverridePriority(true);
+        $appender->activateOptions();
+
+        $levels = array(
+            Level::getLevelTrace(),
+            Level::getLevelDebug(),
+            Level::getLevelInfo(),
+            Level::getLevelWarn(),
+            Level::getLevelError(),
+            Level::getLevelFatal(),
+        );
+
+        $expected = LOG_EMERG;
+
+        $method = new \ReflectionMethod('Apache\\Log4php\\Appenders\\SyslogAppender', 'getSyslogPriority');
+        $method->setAccessible(true);
+
+        foreach ($levels as $level) {
+            $actual = $method->invoke($appender, $level);
+            $this->assertSame($expected, $actual);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/tests/src/Appenders/socketServer.php
----------------------------------------------------------------------
diff --git a/tests/src/Appenders/socketServer.php b/tests/src/Appenders/socketServer.php
index 19a7b7c..07c464e 100644
--- a/tests/src/Appenders/socketServer.php
+++ b/tests/src/Appenders/socketServer.php
@@ -32,19 +32,19 @@ set_time_limit(0);
 // Create a socket
 $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
 if ($sock === false) {
-	die("Failed creating socket: " . socket_strerror(socket_last_error()));
+    die("Failed creating socket: " . socket_strerror(socket_last_error()));
 }
 
 if (socket_set_option($sock, SOL_SOCKET, SO_REUSEADDR, 1) === false) {
-	die("Failed setting socket options: " . socket_strerror(socket_last_error()));
+    die("Failed setting socket options: " . socket_strerror(socket_last_error()));
 }
 
 if (socket_bind($sock, 'localhost', SERVER_PORT) === false) {
-	die("Failed binding socket: " . socket_strerror(socket_last_error()));
+    die("Failed binding socket: " . socket_strerror(socket_last_error()));
 }
 
 if (socket_listen($sock, 100) === false) {
-	die("Failed binding socket: " . socket_strerror(socket_last_error()));
+    die("Failed binding socket: " . socket_strerror(socket_last_error()));
 }
 
 socket_getsockname($sock, $addr, $port);
@@ -53,43 +53,42 @@ myLog("Server Listening on $addr:$port");
 // Buffer which will store incoming messages
 $playback = "";
 
-while(true) {
-	myLog("Waiting for incoming connections...");
-
-	$msgsock = socket_accept($sock);
-	if ($msgsock === false) {
-		myLog("Failed accepting a connection: " . socket_strerror(socket_last_error()));
-		break;
-	}
-
-	$buf = socket_read($msgsock, 2048, PHP_NORMAL_READ);
-
-	myLog('Received: "' . trim($buf) . '"');
-
-	// Shutdown command
-	if (trim($buf) == 'shutdown') {
-		myLog("Shutting down.");
-		socket_close($msgsock);
-		break;
-	}
-	// Playback command
-	else if (trim($buf) == 'playback') {
-		myLog("Returning playback: \"$playback\"");
-		socket_write($msgsock, $playback);
-	}
-	// Default: add to playback buffer
-	else {
-		$playback .= trim($buf);
-	}
-
-	socket_close($msgsock);
+while (true) {
+    myLog("Waiting for incoming connections...");
+
+    $msgsock = socket_accept($sock);
+    if ($msgsock === false) {
+        myLog("Failed accepting a connection: " . socket_strerror(socket_last_error()));
+        break;
+    }
+
+    $buf = socket_read($msgsock, 2048, PHP_NORMAL_READ);
+
+    myLog('Received: "' . trim($buf) . '"');
+
+    // Shutdown command
+    if (trim($buf) == 'shutdown') {
+        myLog("Shutting down.");
+        socket_close($msgsock);
+        break;
+    }
+    // Playback command
+    else if (trim($buf) == 'playback') {
+        myLog("Returning playback: \"$playback\"");
+        socket_write($msgsock, $playback);
+    }
+    // Default: add to playback buffer
+    else {
+        $playback .= trim($buf);
+    }
+
+    socket_close($msgsock);
 }
 
 myLog("Closing socket.");
 socket_close($sock);
 
-function myLog($msg) {
-	echo date("Y-m-d H:i:s") . " $msg\n";
+function myLog($msg)
+{
+    echo date("Y-m-d H:i:s") . " $msg\n";
 }
-
-?>


Mime
View raw message