logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ihabu...@apache.org
Subject [02/43] LOG4PHP-121: Reorganized classes into namespaces
Date Thu, 28 Nov 2013 16:03:32 GMT
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/ConfiguratorTest.php
----------------------------------------------------------------------
diff --git a/tests/src/ConfiguratorTest.php b/tests/src/ConfiguratorTest.php
new file mode 100644
index 0000000..b6fb802
--- /dev/null
+++ b/tests/src/ConfiguratorTest.php
@@ -0,0 +1,453 @@
+<?php
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests;
+
+use Apache\Log4php\Level;
+use Apache\Log4php\Logger;
+use Apache\Log4php\Renderers\RendererInterface;
+use Apache\Log4php\Configuration\DefaultConfigurator;
+
+use Mockery as m;
+
+class CostumDefaultRenderer implements RendererInterface {
+	public function render($o) { }
+}
+
+/**
+ * @group configuration
+ */
+ class ConfiguratorTest extends \PHPUnit_Framework_TestCase
+ {
+ 	/** Reset configuration after each test. */
+ 	public function setUp() {
+ 		Logger::resetConfiguration();
+ 	}
+ 	/** Reset configuration after each test. */
+ 	public function tearDown() {
+ 		Logger::resetConfiguration();
+ 	}
+
+ 	/** Check default setup. */
+ 	public function testDefaultConfig() {
+ 		Logger::configure();
+
+ 		$actual = Logger::getCurrentLoggers();
+ 		$expected = array();
+		$this->assertSame($expected, $actual);
+
+ 		$appenders = Logger::getRootLogger()->getAllAppenders();
+ 		$this->assertInternalType('array', $appenders);
+ 		$this->assertEquals(count($appenders), 1);
+
+ 		$names = array_keys($appenders);
+ 		$this->assertSame('default', $names[0]);
+
+ 		$appender = array_shift($appenders);
+ 		$this->assertInstanceOf('Apache\\Log4php\\Appenders\\EchoAppender', $appender);
+ 		$this->assertSame('default', $appender->getName());
+
+ 		$layout = $appender->getLayout();
+ 		$this->assertInstanceOf('Apache\\Log4php\\Layouts\\SimpleLayout', $layout);
+
+ 		$root = Logger::getRootLogger();
+ 		$appenders = $root->getAllAppenders();
+ 		$this->assertInternalType('array', $appenders);
+ 		$this->assertEquals(count($appenders), 1);
+
+ 		$actual = $root->getLevel();
+ 		$expected = Level::getLevelDebug();
+ 		$this->assertEquals($expected, $actual);
+ 	}
+
+ 	/**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Invalid configuration param given. Reverting to default configuration.
+ 	 */
+ 	public function testInputIsInteger() {
+ 		Logger::configure(12345);
+ 	}
+
+ 	/**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage log4php: Configuration failed. Unsupported configuration file extension: yml
+ 	 */
+ 	public function testYAMLFile() {
+		Logger::configure(PHPUNIT_CONFIG_DIR . '/config.yml');
+ 	}
+
+ 	/**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Invalid configuration provided for appender
+ 	 */
+ 	public function testAppenderConfigNotArray() {
+        $config = array(
+            'appenders' => array(
+                'default',
+            ),
+        );
+
+        $hierachyMock = m::mock("Apache\\Log4php\\Hierarchy");
+        $configurator = new DefaultConfigurator();
+        $configurator->configure($hierachyMock, $config);
+ 	}
+
+  	/**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage No class given for appender
+ 	 */
+ 	public function testNoAppenderClassSet() {
+ 		Logger::configure(PHPUNIT_CONFIG_DIR . '/appenders/config_no_class.xml');
+ 	}
+
+  	/**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Invalid class [unknownClass] given for appender [foo]. Class does not exist. Skipping appender definition.
+ 	 */
+ 	public function testNotExistingAppenderClassSet() {
+ 		Logger::configure(PHPUNIT_CONFIG_DIR . '/appenders/config_not_existing_class.xml');
+ 	}
+
+   	/**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Invalid class [stdClass] given for appender [foo]. Not a valid Appender class. Skipping appender definition.
+ 	 */
+ 	public function testInvalidAppenderClassSet() {
+ 		Logger::configure(PHPUNIT_CONFIG_DIR . '/appenders/config_invalid_appender_class.xml');
+ 	}
+
+    /**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Nonexistant filter class [Foo] specified on appender [foo]. Skipping filter definition.
+ 	 */
+ 	public function testNotExistingAppenderFilterClassSet() {
+ 		Logger::configure(PHPUNIT_CONFIG_DIR . '/appenders/config_not_existing_filter_class.xml');
+ 	}
+
+    /**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Nonexistant option [fooParameter] specified on [Apache\Log4php\Filters\StringMatchFilter]. Skipping.
+ 	 */
+ 	public function testInvalidAppenderFilterParamter() {
+ 		Logger::configure(PHPUNIT_CONFIG_DIR . '/appenders/config_invalid_filter_parameters.xml');
+ 	}
+
+    /**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Invalid filter class [stdClass] sepcified on appender [foo]. Skipping filter definition.
+ 	 */
+ 	public function testInvalidAppenderFilterClassSet() {
+ 		Logger::configure(PHPUNIT_CONFIG_DIR . '/appenders/config_invalid_filter_class.xml');
+ 	}
+
+    /**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Nonexistant layout class [Foo] specified for appender [foo]. Reverting to default layout.
+ 	 */
+ 	public function testNotExistingAppenderLayoutClassSet() {
+ 		Logger::configure(PHPUNIT_CONFIG_DIR . '/appenders/config_not_existing_layout_class.xml');
+ 	}
+
+    /**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Invalid layout class [stdClass] sepcified for appender [foo]. Reverting to default layout.
+ 	 */
+ 	public function testInvalidAppenderLayoutClassSet() {
+ 		Logger::configure(PHPUNIT_CONFIG_DIR . '/appenders/config_invalid_layout_class.xml');
+ 	}
+
+    /**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Layout class not specified for appender [foo]. Reverting to default layout.
+ 	 */
+ 	public function testNoAppenderLayoutClassSet() {
+ 		Logger::configure(PHPUNIT_CONFIG_DIR . '/appenders/config_no_layout_class.xml');
+ 	}
+
+    /**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Failed adding renderer. Rendering class [stdClass] does not implement the RendererInterface interface.
+ 	 */
+ 	public function testInvalidRenderingClassSet() {
+ 		Logger::configure(PHPUNIT_CONFIG_DIR . '/renderers/config_invalid_rendering_class.xml');
+ 	}
+
+    /**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Rendering class not specified. Skipping renderer definition.
+ 	 */
+ 	public function testNoRenderingClassSet() {
+ 		Logger::configure(PHPUNIT_CONFIG_DIR . '/renderers/config_no_rendering_class.xml');
+ 	}
+
+    /**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Rendered class not specified. Skipping renderer definition.
+ 	 */
+ 	public function testNoRenderedClassSet() {
+ 		Logger::configure(PHPUNIT_CONFIG_DIR . '/renderers/config_no_rendered_class.xml');
+ 	}
+
+ 	/**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Failed adding renderer. Rendering class [DoesNotExistRenderer] not found.
+ 	 */
+ 	public function testNotExistingRenderingClassSet() {
+ 		Logger::configure(PHPUNIT_CONFIG_DIR . '/renderers/config_not_existing_rendering_class.xml');
+ 	}
+
+ 	/**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Invalid additivity value [4711] specified for logger [myLogger].
+ 	 */
+ 	public function testInvalidLoggerAddivity() {
+ 		Logger::configure(PHPUNIT_CONFIG_DIR . '/loggers/config_invalid_additivity.xml');
+ 	}
+
+ 	/**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Nonexistnant appender [unknownAppender] linked to logger [myLogger].
+ 	 */
+ 	public function testNotExistingLoggerAppendersClass() {
+ 		Logger::configure(PHPUNIT_CONFIG_DIR . '/loggers/config_not_existing_appenders.xml');
+ 	}
+
+ 	/**
+ 	 * Test that an error is reported when config file is not found.
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage log4php: Configuration failed. File not found
+ 	 */
+ 	public function testNonexistantFile() {
+ 		Logger::configure('hopefully/this/path/doesnt/exist/config.xml');
+
+ 	}
+
+ 	/** Test correct fallback to the default configuration. */
+ 	public function testNonexistantFileFallback() {
+ 		@Logger::configure('hopefully/this/path/doesnt/exist/config.xml');
+ 		$this->testDefaultConfig();
+ 	}
+
+ 	public function testAppendersWithLayout() {
+ 		$config = Logger::configure(array(
+ 			'rootLogger' => array(
+ 				'appenders' => array('app1', 'app2')
+ 			),
+ 			'loggers' => array(
+ 				'myLogger' => array(
+ 					'appenders' => array('app1'),
+ 					'additivity'=> true
+ 				)
+ 			),
+ 			'renderers' => array(
+ 				array('renderedClass' => 'stdClass', 'renderingClass' => 'DefaultRenderer')
+ 			),
+ 			'appenders' => array(
+ 				'app1' => array(
+ 					'class' => 'EchoAppender',
+ 					'layout' => array(
+ 						'class' => 'SimpleLayout'
+ 					),
+ 					'params' => array(
+ 						'htmlLineBreaks' => false
+ 					)
+ 				),
+		 		'app2' => array(
+		 		 	'class' => 'EchoAppender',
+		 		 	'layout' => array(
+		 		 		'class' => 'PatternLayout',
+		 		 		'params' => array(
+		 		 			'conversionPattern' => 'message: %m%n'
+		 		 		)
+		 			),
+		 			'filters' => array(
+		 				array(
+		 					'class'	=> 'StringMatchFilter',
+		 					'params'=> array(
+		 						'stringToMatch'	=> 'foo',
+		 						'acceptOnMatch'	=> false
+		 					)
+		 				)
+		 			)
+		 		),
+ 			)
+ 		));
+
+ 		ob_start();
+ 		Logger::getRootLogger()->info('info');
+ 		$actual = ob_get_contents();
+ 		ob_end_clean();
+
+ 		$expected = "INFO - info" . PHP_EOL . "message: info" . PHP_EOL;
+  		$this->assertSame($expected, $actual);
+ 	}
+
+  	public function testThreshold()
+ 	{
+ 		Logger::configure(array(
+ 			'threshold' => 'WARN',
+ 			'rootLogger' => array(
+ 				'appenders' => array('default')
+ 			),
+ 			'appenders' => array(
+ 				'default' => array(
+ 					'class' => 'EchoAppender',
+ 				),
+ 			)
+ 		));
+
+ 		$actual = Logger::getHierarchy()->getThreshold();
+ 		$expected = Level::getLevelWarn();
+
+ 		self::assertSame($expected, $actual);
+ 	}
+
+ 	/**
+ 	* @expectedException PHPUnit_Framework_Error
+ 	* @expectedExceptionMessage Invalid threshold value [FOO] specified. Ignoring threshold definition.
+ 	*/
+  	public function testInvalidThreshold()
+ 	{
+ 		Logger::configure(array(
+ 			'threshold' => 'FOO',
+ 			'rootLogger' => array(
+ 				'appenders' => array('default')
+ 			),
+ 			'appenders' => array(
+ 				'default' => array(
+ 					'class' => 'EchoAppender',
+ 				),
+ 			)
+ 		));
+ 	}
+
+ 	public function testAppenderThreshold()
+ 	{
+ 		Logger::configure(array(
+ 			'rootLogger' => array(
+ 				'appenders' => array('default')
+ 			),
+ 			'appenders' => array(
+ 				'default' => array(
+ 					'class' => 'EchoAppender',
+ 					'threshold' => 'INFO'
+ 				),
+ 			)
+ 		));
+
+ 		$actual = Logger::getRootLogger()->getAppender('default')->getThreshold();
+ 		$expected = Level::getLevelInfo();
+
+ 		self::assertSame($expected, $actual);
+ 	}
+
+ 	/**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Invalid threshold value [FOO] specified for appender [default]. Ignoring threshold definition.
+ 	 */
+ 	public function testAppenderInvalidThreshold()
+ 	{
+ 		Logger::configure(array(
+ 			'rootLogger' => array(
+ 				'appenders' => array('default')
+ 			),
+ 			'appenders' => array(
+ 				'default' => array(
+ 					'class' => 'EchoAppender',
+ 					'threshold' => 'FOO'
+ 				),
+ 			)
+ 		));
+ 	}
+
+ 	public function testLoggerThreshold()
+ 	{
+ 		Logger::configure(array(
+ 			'rootLogger' => array(
+ 				'appenders' => array('default'),
+ 				'level' => 'ERROR'
+ 			),
+ 			'loggers' => array(
+ 				'default' => array(
+ 					'appenders' => array('default'),
+ 		 			'level' => 'WARN'
+ 				)
+ 			),
+ 			'appenders' => array(
+ 				'default' => array(
+ 					'class' => 'EchoAppender',
+ 				),
+ 			)
+ 		));
+
+ 		// Check root logger
+ 		$actual = Logger::getRootLogger()->getLevel();
+ 		$expected = Level::getLevelError();
+ 		self::assertSame($expected, $actual);
+
+ 		// Check default logger
+ 		$actual = Logger::getLogger('default')->getLevel();
+ 		$expected = Level::getLevelWarn();
+ 		self::assertSame($expected, $actual);
+ 	}
+
+ 	/**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Invalid level value [FOO] specified for logger [default]. Ignoring level definition.
+ 	 */
+ 	public function testInvalidLoggerThreshold()
+ 	{
+ 		Logger::configure(array(
+ 			'loggers' => array(
+ 				'default' => array(
+ 					'appenders' => array('default'),
+ 		 			'level' => 'FOO'
+ 				)
+ 			),
+ 			'appenders' => array(
+ 				'default' => array(
+ 					'class' => 'EchoAppender',
+ 				),
+ 			)
+ 		));
+ 	}
+
+ 	/**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Invalid level value [FOO] specified for logger [root]. Ignoring level definition.
+ 	 */
+  	public function testInvalidRootLoggerThreshold()
+ 	{
+ 		Logger::configure(array(
+ 			'rootLogger' => array(
+ 				'appenders' => array('default'),
+ 				'level' => 'FOO'
+ 			),
+ 			'appenders' => array(
+ 				'default' => array(
+ 					'class' => 'EchoAppender',
+ 				),
+ 			)
+ 		));
+ 	}
+ }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/Configurators/INIAdapterTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Configurators/INIAdapterTest.php b/tests/src/Configurators/INIAdapterTest.php
new file mode 100644
index 0000000..92d2380
--- /dev/null
+++ b/tests/src/Configurators/INIAdapterTest.php
@@ -0,0 +1,177 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *	   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @package	   log4php
+ * @license	   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests\Configuration;
+
+use Apache\Log4php\Configuration\Adapters\IniAdapter;
+use Apache\Log4php\Helpers\OptionConverter;
+use Apache\Log4php\LoggerException;
+
+/**
+ * @group configuration
+ */
+class INIAdapterTest extends \PHPUnit_Framework_TestCase {
+
+	/** Expected output of parsing config1.ini. */
+	private $expected1 = array(
+		'threshold' => 'debug',
+		'rootLogger' => array(
+			'level' => 'DEBUG',
+			'appenders' => array('default'),
+		),
+		'appenders' => array(
+			'default' => array(
+				'class' => 'EchoAppender',
+				'layout' => array(
+					'class' => 'LoggerLayoutTTCC',
+				),
+			),
+			'file' => array(
+				'class' => 'DailyFileAppender',
+				'layout' => array(
+					'class' => 'PatternLayout',
+					'params' => array(
+						'conversionPattern' => '%d{ISO8601} [%p] %c: %m (at %F line %L)%n',
+					),
+				),
+				'params' => array(
+					'datePattern' => 'Ymd',
+					'file' => 'target/examples/daily_%s.log',
+				),
+				'threshold' => 'warn'
+			),
+		),
+		'loggers' => array(
+			'foo' => array(
+				'level' => 'warn',
+				'appenders' => array('default'),
+			),
+			'foo.bar' => array(
+				'level' => 'debug',
+				'appenders' => array('file'),
+				'additivity' => 'true',
+			),
+			'foo.bar.baz' => array(
+				'level' => 'trace',
+				'appenders' => array('default', 'file'),
+				'additivity' => 'false',
+			),
+		),
+		'renderers' => array(
+			array(
+				'renderedClass' => 'Fruit',
+				'renderingClass' => 'FruitRenderer',
+			),
+			array(
+				'renderedClass' => 'Beer',
+				'renderingClass' => 'BeerRenderer',
+			),
+		),
+	);
+
+	public function testConfig() {
+		$url = PHPUNIT_CONFIG_DIR . '/adapters/ini/config_valid.ini';
+		$adapter = new IniAdapter();
+		$actual = $adapter->convert($url);
+
+		$this->assertSame($this->expected1, $actual);
+	}
+
+	/**
+	 * Test exception is thrown when file cannot be found.
+ 	 * @expectedException Apache\Log4php\LoggerException
+ 	 * @expectedExceptionMessage File [you/will/never/find/me.ini] does not exist.
+	 */
+	public function testNonExistantFileException() {
+		$adapter = new IniAdapter();
+		$adapter->convert('you/will/never/find/me.ini');
+	}
+
+	/**
+	 * Test exception is thrown when file is not a valid ini file.
+	 * @expectedException Apache\Log4php\LoggerException
+	 * @expectedExceptionMessage Error parsing configuration file
+	 */
+	public function testInvalidFileException() {
+		$url =  PHPUNIT_CONFIG_DIR . '/adapters/ini/config_invalid_syntax.ini';
+		$adapter = new IniAdapter();
+		$adapter->convert($url);
+	}
+
+	/**
+	 * Test a warning is triggered when configurator doesn't understand a line.
+	 * @expectedException PHPUnit_Framework_Error
+	 * @expectedExceptionMessage log4php: Don't know how to parse the following line: "log4php.appender.default.layout.param.bla = LoggerLayoutTTCC". Skipping.
+	 */
+	public function testInvalidLineWarning1() {
+		$url =  PHPUNIT_CONFIG_DIR . '/adapters/ini/config_invalid_appender_declaration_1.ini';
+		$adapter = new IniAdapter();
+		$adapter->convert($url);
+	}
+
+	/**
+	 * Test a warning is triggered when configurator doesn't understand a line.
+	 * @expectedException PHPUnit_Framework_Error
+	 * @expectedExceptionMessage log4php: Don't know how to parse the following line: "log4php.appender.default.not-layout.param = LoggerLayoutTTCC". Skipping.
+	 */
+	public function testInvalidLineWarning2() {
+		$url =  PHPUNIT_CONFIG_DIR . '/adapters/ini/config_invalid_appender_declaration_2.ini';
+		$adapter = new IniAdapter();
+		$adapter->convert($url);
+	}
+
+	/**
+	 * Check that various boolean equivalents from ini file convert properly
+	 * to boolean.
+	 */
+	public function testBooleanValues() {
+		$values = parse_ini_file(PHPUNIT_CONFIG_DIR . '/adapters/ini/values.ini');
+
+		$actual = OptionConverter::toBooleanEx($values['unquoted_true']);
+		self::assertTrue($actual);
+
+		$actual = OptionConverter::toBooleanEx($values['unquoted_yes']);
+		self::assertTrue($actual);
+
+		$actual = OptionConverter::toBooleanEx($values['unquoted_false']);
+		self::assertFalse($actual);
+
+		$actual = OptionConverter::toBooleanEx($values['unquoted_no']);
+		self::assertFalse($actual);
+
+		$actual = OptionConverter::toBooleanEx($values['quoted_true']);
+		self::assertTrue($actual);
+
+		$actual = OptionConverter::toBooleanEx($values['quoted_false']);
+		self::assertFalse($actual);
+
+		$actual = OptionConverter::toBooleanEx($values['unquoted_one']);
+		self::assertTrue($actual);
+
+		$actual = OptionConverter::toBooleanEx($values['unquoted_zero']);
+		self::assertFalse($actual);
+	}
+
+}
+
+?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/Configurators/PHPAdapterTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Configurators/PHPAdapterTest.php b/tests/src/Configurators/PHPAdapterTest.php
new file mode 100644
index 0000000..2b79826
--- /dev/null
+++ b/tests/src/Configurators/PHPAdapterTest.php
@@ -0,0 +1,101 @@
+<?php
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *	   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @package	   log4php
+ * @license	   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests\Configuration;
+
+use Apache\Log4php\Configuration\Adapters\PhpAdapter;
+
+/**
+ * @group configuration
+ */
+class PHPAdapterTest extends \PHPUnit_Framework_TestCase {
+
+	private $expected1 = array(
+		'rootLogger' => array(
+			'level' => 'info',
+			'appenders' => array('default')
+		),
+		'appenders' => array(
+			'default' => array(
+				'class' => 'EchoAppender',
+				'layout' => array(
+					'class' => 'SimpleLayout'
+				 )
+			)
+		)
+	);
+
+	public function testConfig() {
+		$url = PHPUNIT_CONFIG_DIR . '/adapters/php/config_valid.php';
+		$adapter = new PhpAdapter();
+		$actual = $adapter->convert($url);
+
+		$this->assertSame($this->expected1, $actual);
+	}
+
+	/**
+	 * Test exception is thrown when file cannot be found.
+ 	 * @expectedException Apache\Log4php\LoggerException
+ 	 * @expectedExceptionMessage File [you/will/never/find/me.conf] does not exist.
+	 */
+	public function testNonExistantFileWarning() {
+		$adapter = new PhpAdapter();
+		$adapter->convert('you/will/never/find/me.conf');
+	}
+
+	/**
+	 * Test exception is thrown when file is not valid.
+	 * @expectedException Apache\Log4php\LoggerException
+	 * @expectedExceptionMessage Error parsing configuration: syntax error
+	 */
+	public function testInvalidFileWarning() {
+		$url = PHPUNIT_CONFIG_DIR . '/adapters/php/config_invalid_syntax.php';
+		$adapter = new PhpAdapter();
+		$adapter->convert($url);
+	}
+
+	/**
+	 * Test exception is thrown when the configuration is empty.
+	 * @expectedException Apache\Log4php\LoggerException
+	 * @expectedExceptionMessage Invalid configuration: empty configuration array.
+	 */
+	public function testEmptyConfigWarning() {
+		$url = PHPUNIT_CONFIG_DIR . '/adapters/php/config_empty.php';
+		$adapter = new PhpAdapter();
+		$adapter->convert($url);
+	}
+
+	/**
+	 * Test exception is thrown when the configuration does not contain an array.
+	 * @expectedException Apache\Log4php\LoggerException
+	 * @expectedExceptionMessage Invalid configuration: not an array.
+	 */
+	public function testInvalidConfigWarning() {
+		$url = PHPUNIT_CONFIG_DIR . '/adapters/php/config_not_an_array.php';
+		$adapter = new PhpAdapter();
+		$adapter->convert($url);
+	}
+}
+
+?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/Configurators/XMLAdapterTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Configurators/XMLAdapterTest.php b/tests/src/Configurators/XMLAdapterTest.php
new file mode 100644
index 0000000..3c4dbe2
--- /dev/null
+++ b/tests/src/Configurators/XMLAdapterTest.php
@@ -0,0 +1,178 @@
+<?php
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *	   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @package	   log4php
+ * @license	   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests\Configuration;
+
+use Apache\Log4php\Logger;
+use Apache\Log4php\Configuration\Adapters\XmlAdapter;
+
+/**
+ * @group configuration
+ */
+class XMLAdapterTest extends \PHPUnit_Framework_TestCase {
+
+	/** Expected output of parsing config1.xml.*/
+	private $expected1 = array(
+		'appenders' => array(
+			'default' => array(
+				'class' => 'EchoAppender',
+				'layout' => array(
+					'class' => 'LoggerLayoutTTCC',
+				),
+				'filters' => array(
+					array(
+						'class' => 'LevelRangeFilter',
+						'params' => array(
+							'levelMin' => 'ERROR',
+							'levelMax' => 'FATAL',
+							'acceptOnMatch' => 'false',
+						),
+					),
+					array(
+						'class' => 'DenyAllFilter',
+					),
+				),
+			),
+			'file' => array(
+				'class' => 'DailyFileAppender',
+				'layout' => array(
+					'class' => 'PatternLayout',
+					'params' => array(
+						'conversionPattern' => '%d{ISO8601} [%p] %c: %m (at %F line %L)%n',
+					),
+				),
+				'params' => array(
+					'datePattern' => 'Ymd',
+					'file' => 'target/examples/daily_%s.log',
+				),
+				'threshold' => 'warn'
+			),
+		),
+		'loggers' => array(
+			'foo.bar.baz' => array(
+				'level' => 'trace',
+				'additivity' => 'false',
+				'appenders' => array('default'),
+			),
+			'foo.bar' => array(
+				'level' => 'debug',
+				'additivity' => 'true',
+				'appenders' => array('file'),
+			),
+			'foo' => array(
+				'level' => 'warn',
+				'appenders' => array('default', 'file'),
+			),
+		),
+		'renderers' => array(
+			array(
+				'renderedClass' => 'Fruit',
+				'renderingClass' => 'FruitRenderer',
+			),
+			array(
+				'renderedClass' => 'Beer',
+				'renderingClass' => 'BeerRenderer',
+			),
+		),
+		'threshold' => 'debug',
+		'rootLogger' => array(
+			'level' => 'DEBUG',
+			'appenders' => array('default'),
+		),
+	);
+
+	public function setUp() {
+		Logger::resetConfiguration();
+	}
+
+	public function tearDown() {
+		Logger::resetConfiguration();
+	}
+
+	public function testConversion() {
+		$url =  PHPUNIT_CONFIG_DIR . '/adapters/xml/config_valid.xml';
+		$adapter = new XmlAdapter();
+		$actual = $adapter->convert($url);
+		$this->assertEquals($this->expected1, $actual);
+	}
+
+	public function testConversion2() {
+		$url =  PHPUNIT_CONFIG_DIR . '/adapters/xml/config_valid_underscore.xml';
+		$adapter = new XmlAdapter();
+		$actual = $adapter->convert($url);
+
+		$this->assertEquals($this->expected1, $actual);
+	}
+
+	/**
+	 * Test exception is thrown when file cannot be found.
+ 	 * @expectedException Apache\Log4php\LoggerException
+ 	 * @expectedExceptionMessage File [you/will/never/find/me.conf] does not exist.
+	 */
+	public function testNonExistantFile() {
+		$adapter = new XmlAdapter();
+		$adapter->convert('you/will/never/find/me.conf');
+	}
+
+	/**
+	 * Test exception is thrown when file contains invalid XML.
+	 * @expectedException Apache\Log4php\LoggerException
+	 * @expectedExceptionMessage Error loading configuration file: Premature end of data in tag configuration line
+	 */
+	public function testInvalidXMLFile() {
+		$url =  PHPUNIT_CONFIG_DIR . '/adapters/xml/config_invalid_syntax.xml';
+		$adapter = new XmlAdapter();
+		$adapter->convert($url);
+	}
+
+	/**
+	 * Test that a warning is triggered when two loggers with the same name
+	 * are defined.
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage log4php: Duplicate logger definition [foo]. Overwriting
+	 */
+	public function testDuplicateLoggerWarning() {
+		$url =  PHPUNIT_CONFIG_DIR . '/adapters/xml/config_duplicate_logger.xml';
+		$adapter = new XmlAdapter();
+		$adapter->convert($url);
+	}
+
+
+	/**
+	 * Test that when two loggers with the same name are defined, the second
+	 * one will overwrite the first.
+	 */
+	public function testDuplicateLoggerConfig() {
+		$url =  PHPUNIT_CONFIG_DIR . '/adapters/xml/config_duplicate_logger.xml';
+		$adapter = new XmlAdapter();
+
+		// Supress the warning so that test can continue
+		$config = @$adapter->convert($url);
+
+		// Second definition of foo has level set to warn (the first to info)
+		$this->assertEquals('warn', $config['loggers']['foo']['level']);
+	}
+}
+
+?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/ExceptionTest.php
----------------------------------------------------------------------
diff --git a/tests/src/ExceptionTest.php b/tests/src/ExceptionTest.php
new file mode 100644
index 0000000..5b56f9e
--- /dev/null
+++ b/tests/src/ExceptionTest.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests;
+
+use Apache\Log4php\LoggerException;
+
+/**
+ * @group main
+ */
+class ExceptionTest extends \PHPUnit_Framework_TestCase {
+  	/**
+	 * @expectedException Apache\Log4php\LoggerException
+	 */
+	public function testMessage() {
+		try {
+			throw new LoggerException("TEST");
+    	} catch (LoggerException $e) {
+			self::assertEquals("TEST", $e->getMessage());
+			throw $e;
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/FilterTest.php
----------------------------------------------------------------------
diff --git a/tests/src/FilterTest.php b/tests/src/FilterTest.php
new file mode 100644
index 0000000..e54d01b
--- /dev/null
+++ b/tests/src/FilterTest.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests;
+
+use Apache\Log4php\Filters\AbstractFilter;
+use Apache\Log4php\Logger;
+use Apache\Log4php\LoggingEvent;
+use Apache\Log4php\Level;
+
+class MyFilter extends AbstractFilter {}
+
+/**
+ * @group filters
+ */
+class FilterTest extends \PHPUnit_Framework_TestCase {
+
+	public function testDecide() {
+		$filter = new MyFilter();
+		// activateOptions is empty, but should at least throw no exeception
+		$filter->activateOptions();
+		$eventError = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+		$eventDebug = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelDebug(), "testmessage");
+		$eventWarn = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelWarn(), "testmessage");
+
+		$result = $filter->decide($eventError);
+		self::assertEquals($result, AbstractFilter::NEUTRAL);
+
+		$result = $filter->decide($eventDebug);
+		self::assertEquals($result, AbstractFilter::NEUTRAL);
+
+		$result = $filter->decide($eventWarn);
+		self::assertEquals($result, AbstractFilter::NEUTRAL);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/Filters/FilterDenyAllTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Filters/FilterDenyAllTest.php b/tests/src/Filters/FilterDenyAllTest.php
new file mode 100644
index 0000000..ac41f3b
--- /dev/null
+++ b/tests/src/Filters/FilterDenyAllTest.php
@@ -0,0 +1,75 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests;
+
+use Apache\Log4php\Configuration\DefaultConfigurator;
+use Apache\Log4php\Filters\AbstractFilter;
+use Apache\Log4php\Filters\DenyAllFilter;
+use Apache\Log4php\Logger;
+
+/**
+ * @group filters
+ */
+class FilterDenyAllTest extends \PHPUnit_Framework_TestCase {
+
+	public function testDecide() {
+		$filter = new DenyAllFilter();
+
+		$events = array(
+			TestHelper::getTraceEvent(),
+			TestHelper::getDebugEvent(),
+			TestHelper::getInfoEvent(),
+			TestHelper::getWarnEvent(),
+			TestHelper::getErrorEvent(),
+			TestHelper::getFatalEvent(),
+		);
+
+		foreach($events as $event) {
+			$actual = $filter->decide($event);
+			self::assertEquals(AbstractFilter::DENY, $actual);
+		}
+    }
+
+    public function testConfiguration() {
+    	$config = DefaultConfigurator::getDefaultConfiguration();
+    	$config['appenders']['default']['filters'] = array(
+    		array(
+    			'class' => 'DenyAllFilter'
+    		)
+    	);
+
+    	Logger::configure($config);
+    	$logger = Logger::getRootLogger();
+
+    	ob_start();
+    	$logger->trace('Test');
+    	$logger->debug('Test');
+    	$logger->info('Test');
+    	$logger->warn('Test');
+    	$logger->error('Test');
+    	$logger->fatal('Test');
+    	$actual = ob_get_clean();
+
+    	$this->assertEmpty($actual);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/Filters/FilterLevelMatchTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Filters/FilterLevelMatchTest.php b/tests/src/Filters/FilterLevelMatchTest.php
new file mode 100644
index 0000000..28f5601
--- /dev/null
+++ b/tests/src/Filters/FilterLevelMatchTest.php
@@ -0,0 +1,184 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests;
+
+use Apache\Log4php\Filters\AbstractFilter;
+use Apache\Log4php\Filters\LevelMatchFilter;
+use Apache\Log4php\Logger;
+
+/**
+ * @group filters
+ */
+class FilterLevelMatchTest extends \PHPUnit_Framework_TestCase {
+
+	/**
+	 * Tests all possible combinations of event level and filter levelToMatch
+	 * option, with acceptOnMatch set to TRUE.
+	 */
+	public function testDecideAccept() {
+		$filter = new LevelMatchFilter();
+		$filter->setAcceptOnMatch("true");
+
+		$levels = TestHelper::getAllLevels();
+		$events = TestHelper::getAllEvents();
+
+		foreach($levels as $level) {
+			$filter->setLevelToMatch($level);
+
+			foreach($events as $event) {
+				// Expecting given level to be accepted, neutral for others
+				$expected = ($event->getLevel() == $level) ? AbstractFilter::ACCEPT : AbstractFilter::NEUTRAL;
+				$actual = $filter->decide($event);
+
+				// Get string represenations for logging
+				$sExpected = TestHelper::decisionToString($expected);
+				$sActual = TestHelper::decisionToString($actual);
+
+				$this->assertSame($expected, $actual, "Failed asserting filter decision for event level <$level>. Expected <$sExpected>, found <$sActual>.");
+			}
+		}
+	}
+
+	/**
+	 * Tests all possible combinations of event level and filter levelToMatch
+	 * option, with acceptOnMatch set to TRUE.
+	 */
+	public function testDecideDeny() {
+		$filter = new LevelMatchFilter();
+		$filter->setAcceptOnMatch("false");
+
+		$levels = TestHelper::getAllLevels();
+		$events = TestHelper::getAllEvents();
+
+		foreach($levels as $level) {
+			$filter->setLevelToMatch($level);
+
+			foreach($events as $event) {
+				// Expecting given level to be denied, neutral for others
+				$expected = ($event->getLevel() == $level) ? AbstractFilter::DENY : AbstractFilter::NEUTRAL;
+				$actual = $filter->decide($event);
+
+				// Get string represenations for logging
+				$sExpected = TestHelper::decisionToString($expected);
+				$sActual = TestHelper::decisionToString($actual);
+
+				$this->assertSame($expected, $actual, "Failed asserting filter decision for event level <$level>. Expected <$sExpected>, found <$sActual>.");
+			}
+		}
+	}
+
+	/** Test that filter always decides NEUTRAL when levelToMatch is not set. */
+	public function testDecideNull() {
+		$filter = new LevelMatchFilter();
+		$events = TestHelper::getAllEvents();
+
+		foreach($events as $event) {
+			$expected = AbstractFilter::NEUTRAL;
+			$actual = $filter->decide($event);
+
+			// Get string represenations for logging
+			$sExpected = TestHelper::decisionToString($expected);
+			$sActual = TestHelper::decisionToString($actual);
+			$level = $event->getLevel();
+
+			$this->assertSame($expected, $actual, "Failed asserting filter decision for event level <$level>. Expected <$sExpected>, found <$sActual>.");
+		}
+	}
+
+	/** Test logger configuration. */
+	public function testAcceptConfig() {
+		$config = TestHelper::getEchoConfig();
+
+		// Add filters to default appender
+		$config['appenders']['default']['filters'] = array(
+
+			// Accepts only INFO events
+			array(
+				'class' => 'LevelMatchFilter',
+				'params' => array(
+					'levelToMatch' => 'info',
+					'acceptOnMatch' => true
+				)
+			),
+
+			// Denies all events not accepted by first filter
+			array(
+				'class' => 'DenyAllFilter',
+			)
+		);
+
+		Logger::configure($config);
+		$logger = Logger::getRootLogger();
+
+		ob_start();
+		$logger->trace('Test');
+		$logger->debug('Test');
+		$logger->info('Test');
+		$logger->warn('Test');
+		$logger->error('Test');
+		$logger->fatal('Test');
+
+		$actual = ob_get_clean();
+
+
+		$expected = "INFO - Test" . PHP_EOL;
+	}
+
+	public function testDenyConfig() {
+		$config = TestHelper::getEchoConfig();
+
+		// Add filter which denies INFO events
+		$config['appenders']['default']['filters'] = array(
+			array(
+				'class' => 'LevelMatchFilter',
+				'params' => array(
+					'levelToMatch' => 'info',
+					'acceptOnMatch' => false
+				)
+			)
+		);
+
+		Logger::configure($config);
+		$logger = Logger::getRootLogger();
+
+		ob_start();
+		$logger->trace('Test');
+		$logger->debug('Test');
+		$logger->info('Test');
+		$logger->warn('Test');
+		$logger->error('Test');
+		$logger->fatal('Test');
+
+		$actual = ob_get_clean();
+
+		// Should log all except info
+		$expected =
+			"TRACE - Test" . PHP_EOL .
+			"DEBUG - Test" . PHP_EOL .
+			"WARN - Test"  . PHP_EOL .
+			"ERROR - Test" . PHP_EOL .
+			"FATAL - Test" . PHP_EOL;
+
+		$this->assertSame($expected, $actual);
+	}
+}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/Filters/FilterLevelRangeTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Filters/FilterLevelRangeTest.php b/tests/src/Filters/FilterLevelRangeTest.php
new file mode 100644
index 0000000..31999eb
--- /dev/null
+++ b/tests/src/Filters/FilterLevelRangeTest.php
@@ -0,0 +1,75 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests;
+
+use Apache\Log4php\Filters\AbstractFilter;
+use Apache\Log4php\Filters\LevelRangeFilter;
+use Apache\Log4php\Level;
+use Apache\Log4php\Logger;
+use Apache\Log4php\LoggingEvent;
+
+/**
+ * @group filters
+ */
+class FilterLevelRangeTest extends \PHPUnit_Framework_TestCase {
+
+	public function testDecide() {
+		$filter = new LevelRangeFilter();
+		$filter->setAcceptOnMatch("true");
+		$filter->setLevelMin(Level::getLevelWarn());
+		$filter->setLevelMax(Level::getLevelError());
+
+		$eventError = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+		$eventDebug = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelDebug(), "testmessage");
+		$eventWarn = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelWarn(), "testmessage");
+
+		$result = $filter->decide($eventError);
+		self::assertEquals($result, AbstractFilter::ACCEPT);
+
+		$result = $filter->decide($eventDebug);
+		self::assertEquals($result, AbstractFilter::DENY);
+
+		$result = $filter->decide($eventWarn);
+		self::assertEquals($result, AbstractFilter::ACCEPT);
+    }
+
+    public function testDecideAcceptFalse() {
+		$filter = new LevelRangeFilter();
+		$filter->setAcceptOnMatch("false");
+		$filter->setLevelMin(Level::getLevelWarn());
+		$filter->setLevelMax(Level::getLevelError());
+
+		$eventError = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+		$eventDebug = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelDebug(), "testmessage");
+		$eventWarn = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelWarn(), "testmessage");
+
+		$result = $filter->decide($eventError);
+		self::assertEquals($result, AbstractFilter::NEUTRAL);
+
+		$result = $filter->decide($eventDebug);
+		self::assertEquals($result, AbstractFilter::DENY);
+
+		$result = $filter->decide($eventWarn);
+		self::assertEquals($result, AbstractFilter::NEUTRAL);
+    }
+ }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/Filters/FilterStringMatchTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Filters/FilterStringMatchTest.php b/tests/src/Filters/FilterStringMatchTest.php
new file mode 100644
index 0000000..5618412
--- /dev/null
+++ b/tests/src/Filters/FilterStringMatchTest.php
@@ -0,0 +1,118 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests;
+
+use Apache\Log4php\Filters\AbstractFilter;
+use Apache\Log4php\Filters\StringMatchFilter;
+use Apache\Log4php\Level;
+use Apache\Log4php\Logger;
+use Apache\Log4php\LoggingEvent;
+
+/**
+ * @group filters
+ */
+class FilterStringMatchTest extends \PHPUnit_Framework_TestCase {
+
+	public function testDecideAccept() {
+		$filter = new StringMatchFilter();
+		$filter->setAcceptOnMatch("true");
+		$filter->setStringToMatch("testmessage");
+
+		$eventError = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+		$eventError2 = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "xyz");
+		$eventDebug = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+		$eventDebug2 = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelDebug(), "xyz");
+		$eventWarn = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelWarn(), "testmessage");
+		$eventWarn2 = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelWarn(), "xyz");
+
+		$result = $filter->decide($eventError);
+		self::assertEquals($result, AbstractFilter::ACCEPT);
+
+		$result = $filter->decide($eventError2);
+		self::assertEquals($result, AbstractFilter::NEUTRAL);
+
+		$result = $filter->decide($eventDebug);
+		self::assertEquals($result, AbstractFilter::ACCEPT);
+
+		$result = $filter->decide($eventDebug2);
+		self::assertEquals($result, AbstractFilter::NEUTRAL);
+
+		$result = $filter->decide($eventWarn);
+		self::assertEquals($result, AbstractFilter::ACCEPT);
+
+		$result = $filter->decide($eventWarn2);
+		self::assertEquals($result, AbstractFilter::NEUTRAL);
+	}
+
+	public function testDecideDeny() {
+		$filter = new StringMatchFilter();
+		$filter->setAcceptOnMatch("false");
+		$filter->setStringToMatch("testmessage");
+
+		$eventError = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+		$eventError2 = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "xyz");
+		$eventDebug = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+		$eventDebug2 = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelDebug(), "xyz");
+		$eventWarn = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelWarn(), "testmessage");
+		$eventWarn2 = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelWarn(), "xyz");
+
+		$result = $filter->decide($eventError);
+		self::assertEquals($result, AbstractFilter::DENY);
+
+		$result = $filter->decide($eventError2);
+		self::assertEquals($result, AbstractFilter::NEUTRAL);
+
+		$result = $filter->decide($eventDebug);
+		self::assertEquals($result, AbstractFilter::DENY);
+
+		$result = $filter->decide($eventDebug2);
+		self::assertEquals($result, AbstractFilter::NEUTRAL);
+
+		$result = $filter->decide($eventWarn);
+		self::assertEquals($result, AbstractFilter::DENY);
+
+		$result = $filter->decide($eventWarn2);
+		self::assertEquals($result, AbstractFilter::NEUTRAL);
+	}
+
+	public function testDecideNullMessage() {
+		$filter = new StringMatchFilter();
+		$filter->setAcceptOnMatch("false");
+		$filter->setStringToMatch("testmessage");
+
+		$event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), null);
+
+		$result = $filter->decide($event);
+		self::assertEquals($result, AbstractFilter::NEUTRAL);
+	}
+
+	public function testDecideNullMatch() {
+		$filter = new StringMatchFilter();
+		$filter->setAcceptOnMatch("false");
+
+		$event = new LoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+
+		$result = $filter->decide($event);
+		self::assertEquals($result, AbstractFilter::NEUTRAL);
+	}
+}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/Helpers/OptionConverterTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Helpers/OptionConverterTest.php b/tests/src/Helpers/OptionConverterTest.php
new file mode 100644
index 0000000..6c00e43
--- /dev/null
+++ b/tests/src/Helpers/OptionConverterTest.php
@@ -0,0 +1,149 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests\Helpers;
+
+use Apache\Log4php\Helpers\OptionConverter;
+use Apache\Log4php\Appenders\FileAppender;
+
+define('MY_CONSTANT_CONSTANT', 'DEFINE');
+define('MY_CONSTANT_CONSTANT_OTHER', 'DEFINE_OTHER');
+
+/**
+ * @group helpers
+ */
+class OptionConverterTest extends \PHPUnit_Framework_TestCase {
+
+    public function testToBoolean() {
+        self::assertTrue(OptionConverter::toBooleanEx(1));
+        self::assertTrue(OptionConverter::toBooleanEx("1"));
+        self::assertTrue(OptionConverter::toBooleanEx(true));
+        self::assertTrue(OptionConverter::toBooleanEx("true"));
+        self::assertTrue(OptionConverter::toBooleanEx("on"));
+        self::assertTrue(OptionConverter::toBooleanEx("yes"));
+
+        self::assertFalse(OptionConverter::toBooleanEx(0));
+        self::assertFalse(OptionConverter::toBooleanEx("0"));
+        self::assertFalse(OptionConverter::toBooleanEx(false));
+        self::assertFalse(OptionConverter::toBooleanEx("false"));
+        self::assertFalse(OptionConverter::toBooleanEx("off"));
+        self::assertFalse(OptionConverter::toBooleanEx("no"));
+    }
+
+    /**
+     * Test fail on NULL.
+ 	 * @expectedException Apache\Log4php\LoggerException
+ 	 * @expectedExceptionMessage Given value [NULL] cannot be converted to boolean.
+     */
+    public function testToBooleanFailure1() {
+    	OptionConverter::toBooleanEx(null);
+    }
+
+    /**
+     * Test fail on invalid string.
+     * @expectedException Apache\Log4php\LoggerException
+     * @expectedExceptionMessage Given value ['foo'] cannot be converted to boolean.
+     */
+    public function testToBooleanFailure2() {
+    	OptionConverter::toBooleanEx('foo');
+    }
+
+    public function testToInteger() {
+    	self::assertSame(1, OptionConverter::toIntegerEx('1'));
+    	self::assertSame(1, OptionConverter::toIntegerEx(1));
+    	self::assertSame(0, OptionConverter::toIntegerEx('0'));
+    	self::assertSame(0, OptionConverter::toIntegerEx(0));
+    	self::assertSame(-1, OptionConverter::toIntegerEx('-1'));
+    	self::assertSame(-1, OptionConverter::toIntegerEx(-1));
+    }
+
+    /**
+    * Test fail on NULL.
+    * @expectedException Apache\Log4php\LoggerException
+    * @expectedExceptionMessage Given value [NULL] cannot be converted to integer.
+    */
+    public function testToIntegerFailure1() {
+    	OptionConverter::toIntegerEx(null);
+    }
+
+    /**
+     * Test fail on empty string.
+     * @expectedException Apache\Log4php\LoggerException
+     * @expectedExceptionMessage Given value [''] cannot be converted to integer.
+     */
+    public function testToIntegerFailure2() {
+    	OptionConverter::toIntegerEx('');
+    }
+
+    /**
+     * Test fail on invalid string.
+     * @expectedException Apache\Log4php\LoggerException
+     * @expectedExceptionMessage Given value ['foo'] cannot be converted to integer.
+     */
+    public function testToIntegerFailure3() {
+    	OptionConverter::toIntegerEx('foo');
+    }
+
+    /**
+     * Test fail on boolean.
+     * @expectedException Apache\Log4php\LoggerException
+     * @expectedExceptionMessage Given value [true] cannot be converted to integer.
+     */
+    public function testToIntegerFailure4() {
+    	OptionConverter::toIntegerEx(true);
+    }
+
+    /**
+     * Test fail on boolean.
+     * @expectedException Apache\Log4php\LoggerException
+     * @expectedExceptionMessage Given value [false] cannot be converted to integer.
+     */
+    public function testToIntegerFailure5() {
+    	OptionConverter::toIntegerEx(false);
+    }
+
+    public function testSubstituteConstants() {
+    	define('OTHER_CONSTANT', 'OTHER');
+    	define('MY_CONSTANT', 'TEST');
+    	define('NEXT_CONSTANT', 'NEXT');
+
+        $result = OptionConverter::substConstants('Value of key is ${MY_CONSTANT}.');
+        self::assertEquals('Value of key is TEST.', $result);
+
+        $result = OptionConverter::substConstants('Value of key is ${MY_CONSTANT} or ${OTHER_CONSTANT}.');
+        self::assertEquals('Value of key is TEST or OTHER.', $result);
+
+        $result = OptionConverter::substConstants('Value of key is ${MY_CONSTANT_CONSTANT}.');
+        self::assertEquals('Value of key is DEFINE.', $result);
+
+        $result = OptionConverter::substConstants('Value of key is ${MY_CONSTANT_CONSTANT} or ${MY_CONSTANT_CONSTANT_OTHER}.');
+        self::assertEquals('Value of key is DEFINE or DEFINE_OTHER.', $result);
+    }
+
+    public function testActualSubstituteConstants() {
+    	$a = new FileAppender();
+    	$a->setFile('${PHPUNIT_TEMP_DIR}/log.txt');
+    	$actual = $a->getFile();
+    	$expected = PHPUNIT_TEMP_DIR . '/log.txt';
+    	self::assertSame($expected, $actual);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/Helpers/PatternParserTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Helpers/PatternParserTest.php b/tests/src/Helpers/PatternParserTest.php
new file mode 100644
index 0000000..f849c2d
--- /dev/null
+++ b/tests/src/Helpers/PatternParserTest.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests\Helpers;
+
+/**
+ * @group helpers
+ *
+ * TODO: Should also test complex patterns like: "%d{Y-m-d H:i:s} %-5p %c %X{username}: %m in %F at %L%n"
+ */
+class LoggerPatternParserTest extends \PHPUnit_Framework_TestCase {
+
+    public function testErrorLayout() {
+// 		$event = new LoggingEvent("XmlLayout", new Logger("TEST"), Level::getLevelError(), "testmessage");
+// 		$expected = 'ERROR TEST : testmessage in NA at NA'.PHP_EOL;
+
+// 		$patternParser = new PatternParser("%-5p %c %X{username}: %m in %F at %L%n");
+// 		$c = $patternParser->parse();
+
+// 		$actual = '';
+// 		$c->format($actual, $event);
+//		self::assertEquals($expected, $actual);
+
+    }
+
+    public function testClassname() {
+// 		$event = new LoggingEvent("MyClass", new Logger("TEST"), Level::getLevelError(), "testmessage");
+// 		$expected = 'MyClass';
+// 		$patternParser = new PatternParser("%C");
+// 		$c = $patternParser->parse();
+// 		$actual = '';
+// 		$c->format($actual, $event);
+// 		self::assertEquals($expected, $actual);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/Helpers/UtilsTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Helpers/UtilsTest.php b/tests/src/Helpers/UtilsTest.php
new file mode 100644
index 0000000..38ac597
--- /dev/null
+++ b/tests/src/Helpers/UtilsTest.php
@@ -0,0 +1,89 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests\Helpers;
+
+use Apache\Log4php\Helpers\Utils;
+
+/**
+ * @group helpers
+ */
+class LoggerUtilsTest extends \PHPUnit_Framework_TestCase {
+
+	public function testShorten() {
+		$name = 'org\\apache\\logging\\log4php\\Foo';
+
+		$actual = Utils::shortenClassName($name, null);
+		self::assertSame($name, $actual);
+
+		$actual = Utils::shortenClassName($name, 0);
+		self::assertSame('Foo', $actual);
+
+		$actual = Utils::shortenClassName($name, 5);
+		self::assertSame('o\\a\\l\\l\\Foo', $actual);
+
+		$actual = Utils::shortenClassName($name, 16);
+		self::assertSame('o\\a\\l\\l\\Foo', $actual);
+
+		$actual = Utils::shortenClassName($name, 17);
+		self::assertSame('o\\a\\l\\log4php\\Foo', $actual);
+
+		$actual = Utils::shortenClassName($name, 25);
+		self::assertSame('o\\a\\logging\\log4php\\Foo', $actual);
+
+		$actual = Utils::shortenClassName($name, 28);
+		self::assertSame('o\\apache\\logging\\log4php\\Foo', $actual);
+
+		$actual = Utils::shortenClassName($name, 30);
+		self::assertSame('org\\apache\\logging\\log4php\\Foo', $actual);
+	}
+
+	/** Dot separated notation must be supported for legacy reasons. */
+	public function testShortenWithDots() {
+		$name = 'org.apache.logging.log4php.Foo';
+
+		$actual = Utils::shortenClassName($name, null);
+		self::assertSame($name, $actual);
+
+		$actual = Utils::shortenClassName($name, 0);
+		self::assertSame('Foo', $actual);
+
+		$actual = Utils::shortenClassName($name, 5);
+		self::assertSame('o\a\l\l\Foo', $actual);
+
+		$actual = Utils::shortenClassName($name, 16);
+		self::assertSame('o\a\l\l\Foo', $actual);
+
+		$actual = Utils::shortenClassName($name, 17);
+		self::assertSame('o\a\l\log4php\Foo', $actual);
+
+		$actual = Utils::shortenClassName($name, 25);
+		self::assertSame('o\a\logging\log4php\Foo', $actual);
+
+		$actual = Utils::shortenClassName($name, 28);
+		self::assertSame('o\apache\logging\log4php\Foo', $actual);
+
+		$actual = Utils::shortenClassName($name, 30);
+		self::assertSame('org\apache\logging\log4php\Foo', $actual);
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/HierarchyTest.php
----------------------------------------------------------------------
diff --git a/tests/src/HierarchyTest.php b/tests/src/HierarchyTest.php
new file mode 100644
index 0000000..d9f5b49
--- /dev/null
+++ b/tests/src/HierarchyTest.php
@@ -0,0 +1,105 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests;
+
+use Apache\Log4php\Appenders\ConsoleAppender;
+use Apache\Log4php\Hierarchy;
+use Apache\Log4php\Level;
+use Apache\Log4php\RootLogger;
+
+/**
+ * @group main
+ */
+class HierarchyTest extends \PHPUnit_Framework_TestCase {
+
+	private $hierarchy;
+
+	protected function setUp() {
+		$this->hierarchy = new Hierarchy(new RootLogger());
+	}
+
+	public function testResetConfiguration() {
+		$root = $this->hierarchy->getRootLogger();
+		$appender = new ConsoleAppender('A1');
+		$root->addAppender($appender);
+
+		$logger = $this->hierarchy->getLogger('test');
+		self::assertEquals(1, count($this->hierarchy->getCurrentLoggers()));
+
+		$this->hierarchy->resetConfiguration();
+		self::assertEquals(Level::getLevelDebug(), $root->getLevel());
+		self::assertEquals(Level::getLevelAll(), $this->hierarchy->getThreshold());
+		self::assertEquals(1, count($this->hierarchy->getCurrentLoggers()));
+
+		foreach($this->hierarchy->getCurrentLoggers() as $logger) {
+			self::assertNull($logger->getLevel());
+			self::assertTrue($logger->getAdditivity());
+			self::assertEquals(0, count($logger->getAllAppenders()), 0);
+		}
+	}
+
+	public function testSettingParents() {
+		$hierarchy = $this->hierarchy;
+		$loggerDE = $hierarchy->getLogger("de");
+		$root = $loggerDE->getParent();
+		self::assertEquals('root', $root->getName());
+
+		$loggerDEBLUB = $hierarchy->getLogger("de.blub");
+		self::assertEquals('de.blub', $loggerDEBLUB->getName());
+		$p = $loggerDEBLUB->getParent();
+		self::assertEquals('de', $p->getName());
+
+		$loggerDEBLA = $hierarchy->getLogger("de.bla");
+		$p = $loggerDEBLA->getParent();
+		self::assertEquals('de', $p->getName());
+
+		$logger3 = $hierarchy->getLogger("de.bla.third");
+		$p = $logger3->getParent();
+		self::assertEquals('de.bla', $p->getName());
+
+		$p = $p->getParent();
+		self::assertEquals('de', $p->getName());
+	}
+
+	public function testExists() {
+		$hierarchy = $this->hierarchy;
+		$logger = $hierarchy->getLogger("de");
+
+		self::assertTrue($hierarchy->exists("de"));
+
+		$logger = $hierarchy->getLogger("de.blub");
+		self::assertTrue($hierarchy->exists("de.blub"));
+		self::assertTrue($hierarchy->exists("de"));
+
+		$logger = $hierarchy->getLogger("de.de");
+		self::assertTrue($hierarchy->exists("de.de"));
+	}
+
+	public function testClear() {
+		$hierarchy = $this->hierarchy;
+		$logger = $hierarchy->getLogger("de");
+		self::assertTrue($hierarchy->exists("de"));
+		$hierarchy->clear();
+		self::assertFalse($hierarchy->exists("de"));
+	}
+}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/Layouts/HtmlLayoutTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Layouts/HtmlLayoutTest.php b/tests/src/Layouts/HtmlLayoutTest.php
new file mode 100644
index 0000000..902d3fc
--- /dev/null
+++ b/tests/src/Layouts/HtmlLayoutTest.php
@@ -0,0 +1,99 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests\Layouts;
+
+use Apache\Log4php\LoggingEvent;
+use Apache\Log4php\Logger;
+use Apache\Log4php\Level;
+use Apache\Log4php\Layouts\HtmlLayout;
+
+/**
+ * @group layouts
+ */
+class HtmlLayoutTest extends \PHPUnit_Framework_TestCase {
+
+	public function testErrorLayout() {
+		$event = new LoggingEvent("HtmlLayoutTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+
+		$layout = new HtmlLayout();
+		$v = $layout->format($event);
+
+		$e = PHP_EOL."<tr>".PHP_EOL.
+			"<td>".round(1000*$event->getRelativeTime())."</td>".PHP_EOL.
+			"<td title=\"".$event->getThreadName()." thread\">".$event->getThreadName()."</td>".PHP_EOL.
+			"<td title=\"Level\">ERROR</td>".PHP_EOL.
+			"<td title=\"TEST category\">TEST</td>".PHP_EOL.
+			"<td title=\"Message\">testmessage</td>".PHP_EOL.
+			"</tr>".PHP_EOL;
+
+		self::assertEquals($v, $e);
+    }
+
+    public function testWarnLayout() {
+		$event = new LoggingEvent("HtmlLayoutTest", new Logger("TEST"), Level::getLevelWarn(), "testmessage");
+
+		$layout = new HtmlLayout();
+		$v = $layout->format($event);
+
+		$e = PHP_EOL."<tr>".PHP_EOL.
+			"<td>".round(1000*$event->getRelativeTime())."</td>".PHP_EOL.
+			"<td title=\"".$event->getThreadName()." thread\">".$event->getThreadName()."</td>".PHP_EOL.
+			"<td title=\"Level\"><font color=\"#993300\"><strong>WARN</strong></font></td>".PHP_EOL.
+			"<td title=\"TEST category\">TEST</td>".PHP_EOL.
+			"<td title=\"Message\">testmessage</td>".PHP_EOL.
+			"</tr>".PHP_EOL;
+
+		self::assertEquals($v, $e);
+    }
+
+    public function testContentType() {
+        $layout = new HtmlLayout();
+        $v = $layout->getContentType();
+        $e = "text/html";
+        self::assertEquals($v, $e);
+    }
+
+    public function testTitle() {
+        $layout = new HtmlLayout();
+        $v = $layout->getTitle();
+        $e = "Log4php Log Messages";
+        self::assertEquals($v, $e);
+
+        $layout->setTitle("test");
+        $v = $layout->getTitle();
+        $e = "test";
+        self::assertEquals($v, $e);
+    }
+
+     public function testHeader() {
+        $layout = new HtmlLayout();
+        $v = $layout->getHeader();
+        self::assertTrue(strpos($v, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">") === 0);
+    }
+
+    public function testFooter() {
+        $layout = new HtmlLayout();
+        $v = $layout->getFooter();
+        self::assertTrue(strpos($v, "</table>") === 0);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/Layouts/PatternLayoutTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Layouts/PatternLayoutTest.php b/tests/src/Layouts/PatternLayoutTest.php
new file mode 100644
index 0000000..71d331d
--- /dev/null
+++ b/tests/src/Layouts/PatternLayoutTest.php
@@ -0,0 +1,56 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests\Layouts;
+
+use Apache\Log4php\Tests\TestHelper;
+use Apache\Log4php\Logger;
+
+/**
+ * @group layouts
+ */
+class PatternLayoutTest extends \PHPUnit_Framework_TestCase {
+
+	/** Pattern used for testing. */
+	private $pattern = "%-6level %logger: %msg from %class::%method() in %file at %line%n";
+
+	public function testComplexLayout() {
+
+		$config = TestHelper::getEchoPatternConfig($this->pattern);
+		Logger::configure($config);
+
+		ob_start();
+		$log = Logger::getLogger('LoggerTest');
+		$log->error("my message"); $line = __LINE__;
+		$actual = ob_get_contents();
+		ob_end_clean();
+
+		$file = __FILE__;
+		$class = __CLASS__;
+		$method = __FUNCTION__;
+
+		$expected = "ERROR  LoggerTest: my message from $class::$method() in $file at $line" . PHP_EOL;
+		self::assertSame($expected, $actual);
+
+		Logger::resetConfiguration();
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/Layouts/SerializedLayoutTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Layouts/SerializedLayoutTest.php b/tests/src/Layouts/SerializedLayoutTest.php
new file mode 100644
index 0000000..257fde2
--- /dev/null
+++ b/tests/src/Layouts/SerializedLayoutTest.php
@@ -0,0 +1,110 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests\Layouts;
+
+use Apache\Log4php\Layouts\SerializedLayout;
+use Apache\Log4php\Level;
+use Apache\Log4php\Logger;
+
+/**
+ * @group layouts
+ */
+class SerializedLayoutTest extends \PHPUnit_Framework_TestCase {
+
+	public function testLocationInfo() {
+		$layout = new SerializedLayout();
+		self::assertFalse($layout->getLocationInfo());
+		$layout->setLocationInfo(true);
+		self::assertTrue($layout->getLocationInfo());
+		$layout->setLocationInfo(false);
+		self::assertFalse($layout->getLocationInfo());
+	}
+
+	/**
+ 	 * @expectedException PHPUnit_Framework_Error
+ 	 * @expectedExceptionMessage Invalid value given for 'locationInfo' property: ['foo']. Expected a boolean value. Property not changed.
+	 */
+	public function testLocationInfoFail() {
+		$layout = new SerializedLayout();
+		$layout->setLocationInfo('foo');
+	}
+
+	public function testLayout() {
+		Logger::configure(array(
+			'appenders' => array(
+				'default' => array(
+					'class' => 'EchoAppender',
+					'layout' => array(
+						'class' => 'SerializedLayout'
+					)
+				)
+			),
+			'rootLogger' => array(
+				'appenders' => array('default')
+			)
+		));
+
+		ob_start();
+		$foo = Logger::getLogger('foo');
+		$foo->info("Interesting message.");
+		$actual = ob_get_contents();
+		ob_end_clean();
+
+		$event = unserialize($actual);
+
+		self::assertInstanceOf('Apache\\Log4php\\LoggingEvent', $event);
+		self::assertEquals('Interesting message.', $event->getMessage());
+		self::assertEquals(Level::getLevelInfo(), $event->getLevel());
+	}
+
+	public function testLayoutWithLocationInfo() {
+		Logger::configure(array(
+			'appenders' => array(
+				'default' => array(
+					'class' => 'EchoAppender',
+					'layout' => array(
+						'class' => 'SerializedLayout',
+						'params' => array(
+							'locationInfo' => true
+						)
+					)
+				)
+			),
+			'rootLogger' => array(
+				'appenders' => array('default')
+			)
+		));
+
+		ob_start();
+		$foo = Logger::getLogger('foo');
+		$foo->info("Interesting message.");
+		$actual = ob_get_contents();
+		ob_end_clean();
+
+		$event = unserialize($actual);
+
+		self::assertInstanceOf('Apache\\Log4php\\LoggingEvent', $event);
+		self::assertEquals('Interesting message.', $event->getMessage());
+		self::assertEquals(Level::getLevelInfo(), $event->getLevel());
+	}
+}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/Layouts/SimpleLayoutTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Layouts/SimpleLayoutTest.php b/tests/src/Layouts/SimpleLayoutTest.php
new file mode 100644
index 0000000..f33057d
--- /dev/null
+++ b/tests/src/Layouts/SimpleLayoutTest.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests\Layouts;
+
+use Apache\Log4php\LoggingEvent;
+use Apache\Log4php\Logger;
+use Apache\Log4php\Level;
+use Apache\Log4php\Layouts\SimpleLayout;
+
+/**
+ * @group layouts
+ */
+class SimpleLayoutTest extends \PHPUnit_Framework_TestCase {
+
+	public function testSimpleLayout() {
+		$event = new LoggingEvent("SimpleLayoutTest", new Logger("TEST"), Level::getLevelError(), "testmessage");
+
+		$layout = new SimpleLayout();
+		$actual = $layout->format($event);
+		$expected = "ERROR - testmessage" . PHP_EOL;
+		self::assertEquals($expected, $actual);
+	}
+}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/Layouts/XmlLayoutTest.php
----------------------------------------------------------------------
diff --git a/tests/src/Layouts/XmlLayoutTest.php b/tests/src/Layouts/XmlLayoutTest.php
new file mode 100644
index 0000000..bbcb7dd
--- /dev/null
+++ b/tests/src/Layouts/XmlLayoutTest.php
@@ -0,0 +1,153 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests\Layouts;
+
+use Apache\Log4php\Tests\TestHelper;
+
+use Apache\Log4php\Layouts\XmlLayout;
+use Apache\Log4php\NDC;
+use Apache\Log4php\MDC;
+
+/**
+ * @group layouts
+ */
+class XmlLayoutTest extends \PHPUnit_Framework_TestCase {
+
+	public function testErrorLayout() {
+		$event = TestHelper::getErrorEvent("testmessage");
+
+		$layout = new XmlLayout();
+		$layout->activateOptions();
+
+		$actual = $layout->format($event);
+
+		$thread = $event->getThreadName();
+		$timestamp = number_format(($event->getTimeStamp() * 1000), 0, '', '');
+
+		$expected = "<log4php:event logger=\"test\" level=\"ERROR\" thread=\"$thread\" timestamp=\"$timestamp\">" . PHP_EOL .
+			"<log4php:message><![CDATA[testmessage]]></log4php:message>" . PHP_EOL .
+			"<log4php:locationInfo class=\"Apache\\Log4php\\LoggingEvent\" file=\"NA\" line=\"NA\" " .
+			"method=\"getLocationInformation\" />" . PHP_EOL .
+			"</log4php:event>" . PHP_EOL;
+
+		self::assertEquals($expected, $actual);
+	}
+
+	public function testWarnLayout() {
+		$event = TestHelper::getWarnEvent("testmessage");
+
+		$layout = new XmlLayout();
+		$layout->activateOptions();
+
+		$actual = $layout->format($event);
+
+		$thread = $event->getThreadName();
+		$timestamp = number_format(($event->getTimeStamp() * 1000), 0, '', '');
+
+		$expected = "<log4php:event logger=\"test\" level=\"WARN\" thread=\"$thread\" timestamp=\"$timestamp\">" . PHP_EOL .
+			"<log4php:message><![CDATA[testmessage]]></log4php:message>" . PHP_EOL .
+			"<log4php:locationInfo class=\"Apache\\Log4php\\LoggingEvent\" file=\"NA\" line=\"NA\" "  .
+			"method=\"getLocationInformation\" />" . PHP_EOL .
+			"</log4php:event>" . PHP_EOL;
+
+		self::assertEquals($expected, $actual);
+	}
+
+	public function testLog4JNamespaceErrorLayout() {
+		$event = TestHelper::getErrorEvent("testmessage");
+
+		$layout = new XmlLayout();
+		$layout->setLog4jNamespace(true);
+		$layout->activateOptions();
+
+		$actual = $layout->format($event);
+
+		$thread = $event->getThreadName();
+		$timestamp = number_format(($event->getTimeStamp() * 1000), 0, '', '');
+
+		$expected = "<log4j:event logger=\"test\" level=\"ERROR\" thread=\"$thread\" timestamp=\"$timestamp\">" . PHP_EOL .
+			"<log4j:message><![CDATA[testmessage]]></log4j:message>" . PHP_EOL .
+			"<log4j:locationInfo class=\"Apache\\Log4php\\LoggingEvent\" file=\"NA\" line=\"NA\" "  .
+			"method=\"getLocationInformation\" />" . PHP_EOL .
+			"</log4j:event>" . PHP_EOL;
+
+		self::assertEquals($expected, $actual);
+	}
+
+	public function testNDC()
+	{
+		NDC::push('foo');
+		NDC::push('bar');
+
+		$event = TestHelper::getErrorEvent("testmessage");
+
+		$layout = new XmlLayout();
+		$layout->activateOptions();
+
+		$actual = $layout->format($event);
+
+		$thread = $event->getThreadName();
+		$timestamp = number_format(($event->getTimeStamp() * 1000), 0, '', '');
+
+		$expected = "<log4php:event logger=\"test\" level=\"ERROR\" thread=\"$thread\" timestamp=\"$timestamp\">" . PHP_EOL .
+			"<log4php:message><![CDATA[testmessage]]></log4php:message>" . PHP_EOL .
+			"<log4php:NDC><![CDATA[<![CDATA[foo bar]]>]]></log4php:NDC>"  .  PHP_EOL  .
+			"<log4php:locationInfo class=\"Apache\\Log4php\\LoggingEvent\" file=\"NA\" line=\"NA\" "  .
+			"method=\"getLocationInformation\" />" . PHP_EOL .
+			"</log4php:event>" . PHP_EOL;
+
+		self::assertEquals($expected, $actual);
+
+		NDC::clear();
+	}
+
+	public function testMDC()
+	{
+		MDC::put('foo', 'bar');
+		MDC::put('bla', 'tra');
+
+		$event = TestHelper::getErrorEvent("testmessage");
+
+		$layout = new XmlLayout();
+		$layout->activateOptions();
+
+		$actual = $layout->format($event);
+
+		$thread = $event->getThreadName();
+		$timestamp = number_format(($event->getTimeStamp() * 1000), 0, '', '');
+
+		$expected = "<log4php:event logger=\"test\" level=\"ERROR\" thread=\"$thread\" timestamp=\"$timestamp\">" . PHP_EOL .
+				"<log4php:message><![CDATA[testmessage]]></log4php:message>" . PHP_EOL .
+				"<log4php:properties>" . PHP_EOL .
+				"<log4php:data name=\"foo\" value=\"bar\" />" . PHP_EOL .
+				"<log4php:data name=\"bla\" value=\"tra\" />" . PHP_EOL .
+				"</log4php:properties>" . PHP_EOL .
+				"<log4php:locationInfo class=\"Apache\\Log4php\\LoggingEvent\" file=\"NA\" line=\"NA\" "  .
+				"method=\"getLocationInformation\" />" . PHP_EOL .
+				"</log4php:event>" . PHP_EOL;
+
+		self::assertEquals($expected, $actual);
+
+		MDC::clear();
+	}
+}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/tests/src/LevelTest.php
----------------------------------------------------------------------
diff --git a/tests/src/LevelTest.php b/tests/src/LevelTest.php
new file mode 100644
index 0000000..29ece9b
--- /dev/null
+++ b/tests/src/LevelTest.php
@@ -0,0 +1,86 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @category   tests
+ * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @link       http://logging.apache.org/log4php
+ */
+
+namespace Apache\Log4php\Tests;
+
+use Apache\Log4php\Level;
+
+/**
+ * @group main
+ */
+class LevelTest extends \PHPUnit_Framework_TestCase {
+
+	protected function doTestLevel($level, $code, $str, $syslog) {
+		self::assertTrue($level instanceof Level);
+		self::assertEquals($level->toInt(), $code);
+		self::assertEquals($level->toString(), $str);
+		self::assertEquals($level->getSyslogEquivalent(), $syslog);
+	}
+
+	public function testLevelOff() {
+		$this->doTestLevel(Level::getLevelOff(), Level::OFF, 'OFF', LOG_ALERT);
+		$this->doTestLevel(Level::toLevel(Level::OFF), Level::OFF, 'OFF', LOG_ALERT);
+		$this->doTestLevel(Level::toLevel('OFF'), Level::OFF, 'OFF', LOG_ALERT);
+    }
+
+	public function testLevelFatal() {
+		$this->doTestLevel(Level::getLevelFatal(), Level::FATAL, 'FATAL', LOG_ALERT);
+		$this->doTestLevel(Level::toLevel(Level::FATAL), Level::FATAL, 'FATAL', LOG_ALERT);
+		$this->doTestLevel(Level::toLevel('FATAL'), Level::FATAL, 'FATAL', LOG_ALERT);
+    }
+
+	public function testLevelError() {
+		$this->doTestLevel(Level::getLevelError(), Level::ERROR, 'ERROR', LOG_ERR);
+		$this->doTestLevel(Level::toLevel(Level::ERROR), Level::ERROR, 'ERROR', LOG_ERR);
+		$this->doTestLevel(Level::toLevel('ERROR'), Level::ERROR, 'ERROR', LOG_ERR);
+    }
+
+	public function testLevelWarn() {
+		$this->doTestLevel(Level::getLevelWarn(), Level::WARN, 'WARN', LOG_WARNING);
+		$this->doTestLevel(Level::toLevel(Level::WARN), Level::WARN, 'WARN', LOG_WARNING);
+		$this->doTestLevel(Level::toLevel('WARN'), Level::WARN, 'WARN', LOG_WARNING);
+    }
+
+	public function testLevelInfo() {
+		$this->doTestLevel(Level::getLevelInfo(), Level::INFO, 'INFO', LOG_INFO);
+		$this->doTestLevel(Level::toLevel(Level::INFO), Level::INFO, 'INFO', LOG_INFO);
+		$this->doTestLevel(Level::toLevel('INFO'), Level::INFO, 'INFO', LOG_INFO);
+    }
+
+	public function testLevelDebug() {
+		$this->doTestLevel(Level::getLevelDebug(), Level::DEBUG, 'DEBUG', LOG_DEBUG);
+		$this->doTestLevel(Level::toLevel(Level::DEBUG), Level::DEBUG, 'DEBUG', LOG_DEBUG);
+		$this->doTestLevel(Level::toLevel('DEBUG'), Level::DEBUG, 'DEBUG', LOG_DEBUG);
+	}
+
+    public function testLevelTrace() {
+		$this->doTestLevel(Level::getLevelTrace(), Level::TRACE, 'TRACE', LOG_DEBUG);
+		$this->doTestLevel(Level::toLevel(Level::TRACE), Level::TRACE, 'TRACE', LOG_DEBUG);
+		$this->doTestLevel(Level::toLevel('TRACE'), Level::TRACE, 'TRACE', LOG_DEBUG);
+    }
+
+	public function testLevelAll() {
+		$this->doTestLevel(Level::getLevelAll(), Level::ALL, 'ALL', LOG_DEBUG);
+		$this->doTestLevel(Level::toLevel(Level::ALL), Level::ALL, 'ALL', LOG_DEBUG);
+		$this->doTestLevel(Level::toLevel('ALL'), Level::ALL, 'ALL', LOG_DEBUG);
+    }
+}


Mime
View raw message