logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ihabu...@apache.org
Subject [06/43] LOG4PHP-121: Reorganized classes into namespaces
Date Thu, 28 Nov 2013 16:03:36 GMT
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/php/appenders/LoggerAppenderFirephpTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/appenders/LoggerAppenderFirephpTest.php b/src/test/php/appenders/LoggerAppenderFirephpTest.php
deleted file mode 100644
index 6a2918a..0000000
--- a/src/test/php/appenders/LoggerAppenderFirephpTest.php
+++ /dev/null
@@ -1,201 +0,0 @@
-<?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
- * @subpackage appenders
- * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- * @internal   Phpmd clean.
- */
-
-@include_once('FirePHPCore/FirePHP.class.php');
-
-/**
- * @group appenders
- */
-class LoggerAppenderFirePHPTest extends PHPUnit_Framework_TestCase {
-
-	private $config = array(
-		'rootLogger' => array(
-			'appenders' => array('default'),
-		),
-		'appenders' => array(
-			'default' => array(
-				'class' => 'LoggerAppenderFirePHP',
-				'layout' => array(
-					'class' => 'LoggerLayoutPattern',
-				),
-				'params' => array('target' => 'page')
-			)
-		)
-	);
-
-	public function setUp() {
-		if(!method_exists('FirePHP', 'to')) {
-			self::markTestSkipped("Please install 'FirePHP' in order to run this test");
-		}
-	}
-	
-	private function createEvent($message, $level) {
-		$eventMock = new LoggerLoggingEvent("LoggerAppenderFirePHPTest", new Logger("TEST"), LoggerLevel::toLevel($level), $message);
-	
-		return $eventMock;
-	}	
-	
-	public function testSetTarget() {
-		$appender = new LoggerAppenderFirePHP();
-		$appender->setTarget('page');
-		self::assertSame('page', $appender->getTarget());
-	}
-
-	public function testAppend_HandleDebug() {
-		$console = new FirePHPSpy();
-		
-		$appender = new TestableLoggerAppenderFirePhp();
-		$appender->setConsole($console);
-		
-		$expectedMessage = 'trace message';
-		$expectedLevel = 'debug';
-		
-		$appender->append($this->createEvent($expectedMessage, $expectedLevel));
-		
-		$this->assertLog($console, $expectedMessage, $expectedLevel, 'log');
-	}
-	
-	public function testAppend_HandleWarn() {
-		$console = new FirePHPSpy();
-	
-		$appender = new TestableLoggerAppenderFirePhp();
-		$appender->setConsole($console);
-	
-		$expectedMessage = 'debug message';
-		$expectedLevel = 'warn';
-	
-		$appender->append($this->createEvent($expectedMessage, $expectedLevel));
-		
-		$this->assertLog($console, $expectedMessage, $expectedLevel, 'warn');
-	}
-	
-	public function testAppend_HandleError() {
-		$console = new FirePHPSpy();
-	
-		$appender = new TestableLoggerAppenderFirePhp();
-		$appender->setConsole($console);
-	
-		$expectedMessage = 'error message';
-		$expectedLevel = 'error';
-	
-		$appender->append($this->createEvent($expectedMessage, $expectedLevel));
-		
-		$this->assertLog($console, $expectedMessage, $expectedLevel, 'error');
-	}	
-	
-	public function testAppend_HandleFatal() {
-		$console = new FirePHPSpy();
-	
-		$appender = new TestableLoggerAppenderFirePhp();
-		$appender->setConsole($console);
-	
-		$expectedMessage = "fatal message";
-		$expectedLevel = 'fatal';
-	
-		$appender->append($this->createEvent($expectedMessage, $expectedLevel));
-
-		$this->assertLog($console, $expectedMessage, $expectedLevel, 'error');
-	}
-	
-	public function testAppend_HandleDefault() {
-		$console = new FirePHPSpy();
-	
-		$appender = new TestableLoggerAppenderFirePhp();
-		$appender->setConsole($console);
-		
-		$expectedMessage = 'info message';
-		$expectedLevel = 'info';
-	
-		$appender->append($this->createEvent($expectedMessage, $expectedLevel));
-	
-		$this->assertLog($console, $expectedMessage, $expectedLevel, 'info');
-	}
-	
-	public function assertLog($console, $expectedMessage, $logLevel, $calledMethod) {
-		$event = $this->createEvent($expectedMessage, $logLevel);
-		
-		$layout = new LoggerLayoutSimple();
-		$message = $layout->format($event);
-		
-		$this->assertEquals($message, $console->getMessage(), 'log message is wrong');
-		$this->assertEquals(1, $console->getCalls(), 'wasn\'t called once');
-		$this->assertEquals($calledMethod, $console->getCalledMethod(), 'wrong log-method was called');
-	}
-}
-
-class TestableLoggerAppenderFirePhp extends LoggerAppenderFirePHP {
-	public function setConsole($console) {
-		$this->console = $console;
-	}
-}
-
-class FirePHPSpy {
-	private $calls = 0;
-	private $message = '';
-	private $calledMethod = '';
-	
-	public function getCalls() {
-		return $this->calls;
-	}
-	
-	public function getMessage() {
-		return $this->message;
-	}
-	
-	public function log($message) {
-		$this->calls++;
-		$this->calledMethod = 'log';
-		$this->message = $message;
-	}
-	
-	public function debug($message) {
-		$this->calls++;
-		$this->calledMethod = 'debug';
-		$this->message = $message;		
-	}
-	
-	public function warn($message) {
-		$this->calls++;
-		$this->calledMethod = 'warn';
-		$this->message = $message;		
-	}
-	
-	public function error($message) {
-		$this->calls++;
-		$this->calledMethod = 'error';
-		$this->message = $message;
-	}
-	
-	public function info($message) {
-		$this->calls++;
-		$this->calledMethod = 'info';
-		$this->message = $message;
-	}
-	
-	public function getCalledMethod() {
-		return $this->calledMethod;
-	}
-}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/php/appenders/LoggerAppenderMailEventTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/appenders/LoggerAppenderMailEventTest.php b/src/test/php/appenders/LoggerAppenderMailEventTest.php
deleted file mode 100644
index 7a19244..0000000
--- a/src/test/php/appenders/LoggerAppenderMailEventTest.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?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
- * @subpackage appenders
- * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- */
-
-/**
- * @group appenders
- */
-class LoggerAppenderMailEventTest extends PHPUnit_Framework_TestCase {
-	
-	public function testRequiresLayout() {
-		$appender = new LoggerAppenderMailEvent();
-		self::assertTrue($appender->requiresLayout());
-	}
-	
-	public function testMail() {
-		$appender = new LoggerAppenderMailEvent("myname");
-		
-		$layout = new LoggerLayoutSimple();
-		$appender->setLayout($layout);
-		$appender->setDry(true);
-		$appender->setTo('test@example.com');
-		$appender->setFrom('Testsender');
-		
-		$appender->activateOptions();
-		$event = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
-		 
-		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();
-	}
-
-	/** 
-	 * 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 LoggerAppenderMailEvent("myname");
-		$appender->setLayout(new LoggerLayoutSimple());
-		$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 LoggerAppenderMailEvent("myname");
-		$appender->setLayout(new LoggerLayoutSimple());
-		$appender->setTo('info@example.com');
-		$appender->activateOptions();
-	}
-}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/php/appenders/LoggerAppenderMailTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/appenders/LoggerAppenderMailTest.php b/src/test/php/appenders/LoggerAppenderMailTest.php
deleted file mode 100644
index eeb0500..0000000
--- a/src/test/php/appenders/LoggerAppenderMailTest.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?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
- * @subpackage appenders
- * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- */
-
-/**
- * @group appenders
- */
-class LoggerAppenderMailTest extends PHPUnit_Framework_TestCase {
-        
-	public function testRequiresLayout() {
-		$appender = new LoggerAppenderMail(); 
-		self::assertTrue($appender->requiresLayout());
-	}
-	
-	public function testMail() {
-		$appender = new LoggerAppenderMail("myname ");
-		
-		$layout = new LoggerLayoutSimple();
-		$appender->setLayout($layout);
-		$appender->setDry(true);
-		$appender->setTo('test@example.com');
-		$appender->setFrom('Testsender');
-		
-		$appender->activateOptions();
-		$event = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
-		$event2 = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage2");
-		 
-		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);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/php/appenders/LoggerAppenderMongoDBTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/appenders/LoggerAppenderMongoDBTest.php b/src/test/php/appenders/LoggerAppenderMongoDBTest.php
deleted file mode 100644
index 7d62fe5..0000000
--- a/src/test/php/appenders/LoggerAppenderMongoDBTest.php
+++ /dev/null
@@ -1,207 +0,0 @@
-<?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
- * @subpackage appenders
- * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- */
-
-/**
- * Testclass for the MongoDB appender.
- * 
- * This class has been originally contributed from Vladimir Gorej 
- * (http://github.com/log4mongo/log4mongo-php).
- * 
- * @group appenders
- */
-class LoggerAppenderMongoDBTest 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 LoggerAppenderMongoDB('mongo_appender');
-			$this->event = LoggerTestHelper::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('LoggerLoggingEvent', $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 LoggerLoggingEvent(
-			'testFqcn',
-			new Logger('test.Logger'),
-			LoggerLevel::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]: LoggerAppenderMongoDBTest', $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 LoggerLoggingEvent(
-			 'testFqcn',
-			 new Logger('test.Logger'),
-			 LoggerLevel::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]: LoggerAppenderMongoDBTest', $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 LoggerLoggingEvent $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/79ed2d0d/src/test/php/appenders/LoggerAppenderNullTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/appenders/LoggerAppenderNullTest.php b/src/test/php/appenders/LoggerAppenderNullTest.php
deleted file mode 100644
index 2a30797..0000000
--- a/src/test/php/appenders/LoggerAppenderNullTest.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?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
- * @subpackage appenders
- * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- */
-
-/**
- * @group appenders
- */
-class LoggerAppenderNullTest 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 LoggerLoggingEvent("LoggerAppenderNullTest", new Logger("TEST"), LoggerLevel::getLevelInfo(), "testmessage");
-	    
-		$appender = new LoggerAppenderNull("TEST");
-		$appender->activateOptions();
-		$appender->append($event);
-		$appender->close();
-    }
-    
-	public function testRequiresLayout() {
-		$appender = new LoggerAppenderNull();
-		self::assertFalse($appender->requiresLayout());
-	}
-}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/php/appenders/LoggerAppenderPDOTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/appenders/LoggerAppenderPDOTest.php b/src/test/php/appenders/LoggerAppenderPDOTest.php
deleted file mode 100644
index 567134e..0000000
--- a/src/test/php/appenders/LoggerAppenderPDOTest.php
+++ /dev/null
@@ -1,164 +0,0 @@
-<?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
- * @subpackage appenders
- * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- */
-
-/**
- * @group appenders
- */
-class LoggerAppenderPDOTest 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 LoggerAppenderPDO();
-		self::assertFalse($appender->requiresLayout());
-	}
-
-	/** Tests new-style logging using prepared statements and the default SQL definition. */
-	public function testSimpleWithDefaults() {
-		// Log event
-		$event = new LoggerLoggingEvent("LoggerAppenderPDOTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
-		$appender = new LoggerAppenderPDO("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 LoggerAppenderPDO("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 LoggerLoggingEvent("LoggerAppenderPDOTest2", new Logger("TEST"), LoggerLevel::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 LoggerAppenderPDO("myname");
-		$appender->setDSN($dsn);
-		$appender->activateOptions();
-	}
-	
-	/**
-	 * Check whether close() actually closes the database connection. 
-	 */
-	public function testClose() {
-		$event = new LoggerLoggingEvent("LoggerAppenderPDOTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
-		
-		$appender = new LoggerAppenderPDO("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/79ed2d0d/src/test/php/appenders/LoggerAppenderPhpTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/appenders/LoggerAppenderPhpTest.php b/src/test/php/appenders/LoggerAppenderPhpTest.php
deleted file mode 100644
index 953315f..0000000
--- a/src/test/php/appenders/LoggerAppenderPhpTest.php
+++ /dev/null
@@ -1,97 +0,0 @@
-<?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
- * @subpackage appenders
- * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- */
- 
-function errorHandler($errno, $errstr, $errfile, $errline) {
-	PHPUnit_Framework_TestCase::assertEquals(LoggerAppenderPhpTest::$expectedError, $errno);
-	PHPUnit_Framework_TestCase::assertEquals(LoggerAppenderPhpTest::$expectedMessage, $errstr);
-}
-
-/**
- * @group appenders
- */
-class LoggerAppenderPhpTest 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' => 'LoggerAppenderPHP',
-				'layout' => array(
-					'class' => 'LoggerLayoutSimple'
-				),
-			)
-		)
-	);
-	
-    protected function setUp() {
-		set_error_handler("errorHandler");
-	}
-		
-	public function testRequiresLayout() {
-		$appender = new LoggerAppenderPhp();
-		$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 = "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_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 = "TRACE - This is a test" . PHP_EOL;
-		$logger->trace("This is a test");
-    }
-    
-    protected function tearDown() {
-		restore_error_handler();
-	}
-}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/php/appenders/LoggerAppenderRollingFileTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/appenders/LoggerAppenderRollingFileTest.php b/src/test/php/appenders/LoggerAppenderRollingFileTest.php
deleted file mode 100644
index 2ae1289..0000000
--- a/src/test/php/appenders/LoggerAppenderRollingFileTest.php
+++ /dev/null
@@ -1,206 +0,0 @@
-<?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
- * @subpackage appenders
- * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- */
-
-/**
- * @group appenders
- */
-class LoggerAppenderRollingFileTest extends PHPUnit_Framework_TestCase {
-
-	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');
-	}
-	
-	public function testRequiresLayout() {
-		$appender = new LoggerAppenderRollingFile();
-		self::assertTrue($appender->requiresLayout());
-	}
-
-	public function testMaxFileSize() {
-		$appender = new LoggerAppenderRollingFile("mylogger");
-
-		$appender->setMaxFileSize('1KB');
-		self::assertEquals(1024, $appender->getMaxFileSize());
-
-		$appender->setMaxFileSize('2KB');
-		self::assertEquals(2048, $appender->getMaxFileSize());
-
-		$appender->setMaxFileSize('1MB');
-		self::assertEquals(1048576, $appender->getMaxFileSize());
-
-		$appender->setMaxFileSize('3MB');
-		self::assertEquals(3145728, $appender->getMaxFileSize());
-
-		$appender->setMaxFileSize('1GB');
-		self::assertEquals(1073741824, $appender->getMaxFileSize());
-
-		$appender->setMaxFileSize('10000');
-		self::assertEquals(10000, $appender->getMaxFileSize());
-
-		$appender->setMaxFileSize('100.5');
-		self::assertEquals(100, $appender->getMaxFileSize());
-
-		$appender->setMaxFileSize('1000.6');
-		self::assertEquals(1000, $appender->getMaxFileSize());
-
-		$appender->setMaxFileSize('1.5MB');
-		self::assertEquals(1572864, $appender->getMaxFileSize());
-	}
-
-	/**
-	 * @return LoggerAppenderRollingFile
-	 */
-	private function createRolloverAppender() {
-		$layout = new LoggerLayoutSimple();
-		
-		$appender = new LoggerAppenderRollingFile("mylogger");
-		$appender->setFile(PHPUNIT_TEMP_DIR . '/TEST-rolling.txt');
-		$appender->setLayout($layout);
-		$appender->setMaxFileSize('1KB');
-		$appender->setMaxBackupIndex(2);
-		$appender->activateOptions();
-		
-		return $appender;
-	}
-
-	public function testSimpleLogging() {
-		$appender = $this->createRolloverAppender();
-		
-		$event = LoggerTestHelper::getWarnEvent("my message123");
-		
-		for($i = 0; $i < 1000; $i++) {
-			$appender->append($event);
-		}
-
-		$appender->append(LoggerTestHelper::getWarnEvent("my messageXYZ"));
-
-		$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.1';
-		$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'));
-	}
-	
-	public function testLoggingViaLogger() {
-		$logger = Logger::getLogger('mycat');
-		$logger->setAdditivity(false);
-		
-		$appender = $this->createRolloverAppender();
-
-		$logger->addAppender($appender);
-		
-		for($i = 0; $i < 1000; $i++) {
-			$logger->warn("my message123");
-		}
-		
-		$logger->warn("my messageXYZ");
-		
-		$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.2';
-		$this->checkFileContent($file);
-
-		$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);
-
-		$appender = $this->createRolloverAppender();
-		$appender->setCompress(true);
-		
-		$logger->addAppender($appender);
-		
-		for($i = 0; $i < 1000; $i++) {
-			$logger->warn(self::WARNING_MASSAGE. $i);
-		}
-		
-		$logger->warn("my messageXYZ");
-
-		$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);
-
-		$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');
-		
-		$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');
-		
-	}	
-
-	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);
-		}
-	}
-	
-	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/79ed2d0d/src/test/php/appenders/LoggerAppenderSocketTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/appenders/LoggerAppenderSocketTest.php b/src/test/php/appenders/LoggerAppenderSocketTest.php
deleted file mode 100644
index 5b9430a..0000000
--- a/src/test/php/appenders/LoggerAppenderSocketTest.php
+++ /dev/null
@@ -1,149 +0,0 @@
-<?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
- * @subpackage appenders
- * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- */
-
-/**
- * @group appenders
- */
-class LoggerAppenderSocketTest 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 LoggerAppenderSocket();
-		self::assertTrue($appender->requiresLayout());
-	}
-	
-	public function testLogging()
-	{
-		Logger::configure(array(
-		    'appenders' => array(
-		        'default' => array(
-		            'class' => 'LoggerAppenderSocket',
-		            'params' => array(
-		                'remoteHost' => 'localhost',
-		                'port' => self::SOCKET_PORT
-		            ),
-		            'layout' => array(
-		            	'class' => 'LoggerLayoutSimple'
-		            )
-		        ),
-		    ),
-		    '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/79ed2d0d/src/test/php/appenders/LoggerAppenderSyslogTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/appenders/LoggerAppenderSyslogTest.php b/src/test/php/appenders/LoggerAppenderSyslogTest.php
deleted file mode 100644
index 36d16b0..0000000
--- a/src/test/php/appenders/LoggerAppenderSyslogTest.php
+++ /dev/null
@@ -1,264 +0,0 @@
-<?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
- * @subpackage appenders
- * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- */
-
-/**
- * Tests the syslog appender.
- * 
- * Many of these tests rely on reflection features introduced in 5.3 and 
- * will be skipped if run on a lower version. 
- * 
- * This test will only write a single entry to the syslog.
- * 
- * @group appenders
- */
-class LoggerAppenderSyslogTest extends PHPUnit_Framework_TestCase {
-
-	public function testSettersGetters() {
-		
-		// Setters should accept any value, without validation 
-		$expected = "Random string value";
-		
-		$appender = new LoggerAppenderSyslog();
-		$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 LoggerAppenderSyslog();
-		$this->assertTrue($appender->requiresLayout());
-	}
-	
-	public function testLogging() {
-		$appender = new LoggerAppenderSyslog("myname");
-		$appender->setLayout(new LoggerLayoutSimple());
-		$appender->activateOptions();
-		
-		$event = new LoggerLoggingEvent(__CLASS__, new Logger("TestLogger"), LoggerLevel::getLevelError(), "testmessage");
-		$appender->append($event);
-	}
-
-	/** Tests parsing of "option" parameter. */
-	public function testOption() {
-		if(!method_exists('ReflectionProperty', 'setAccessible')) {
-			$this->markTestSkipped("ReflectionProperty::setAccessible() required to perform this test (available in PHP 5.3.2+).");
-		}
-		
-		$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('LoggerAppenderSyslog', 'intOption');
-		$property->setAccessible(true);
-		
-		// Check default value first
-		$appender = new LoggerAppenderSyslog();
-		$appender->activateOptions();
-		$actual = $property->getValue($appender);
-		$this->assertSame($default, $actual, "Failed setting default option [$defaultStr]");
-		
-		foreach($options as $option => $expected) {
-			$appender = new LoggerAppenderSyslog();
-			$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() {
-		if(!method_exists('ReflectionProperty', 'setAccessible')) {
-			$this->markTestSkipped("ReflectionProperty::setAccessible() required to perform this test (available in PHP 5.3.2+).");
-		}
-	
-		$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('LoggerAppenderSyslog', 'intPriority');
-		$property->setAccessible(true);
-	
-		// Check default value first
-		$appender = new LoggerAppenderSyslog();
-		$appender->activateOptions();
-		$actual = $property->getValue($appender);
-		$this->assertSame($default, $actual, "Failed setting default priority [$defaultStr].");
-	
-		foreach($priorities as $priority => $expected) {
-			$appender = new LoggerAppenderSyslog();
-			$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() {
-		if(!method_exists('ReflectionProperty', 'setAccessible')) {
-			$this->markTestSkipped("ReflectionProperty::setAccessible() required to perform this test (available in PHP 5.3.2+).");
-		}
-	
-		// 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('LoggerAppenderSyslog', 'intFacility');
-		$property->setAccessible(true);
-	
-		// Check default value first
-		$appender = new LoggerAppenderSyslog();
-		$appender->activateOptions();
-		$actual = $property->getValue($appender);
-		$this->assertSame($default, $default, "Failed setting default facility [$defaultStr].");
-	
-		foreach($facilities as $facility => $expected) {
-			$appender = new LoggerAppenderSyslog();
-			$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 LoggerAppenderSyslog();
-		$appender->setOption('CONS|XYZ');
-		$appender->activateOptions();
-	}
-	
-	/**
-	 * @expectedException PHPUnit_Framework_Error
-	 */
-	public function testInvalidPriority() {
-		$appender = new LoggerAppenderSyslog();
-		$appender->setPriority('XYZ');
-		$appender->activateOptions();
-	}
-	
-	/**
-	 * @expectedException PHPUnit_Framework_Error
-	 */
-	public function testInvalidFacility() {
-		$appender = new LoggerAppenderSyslog();
-		$appender->setFacility('XYZ');
-		$appender->activateOptions();
-	}
-	
-	
-	public function testPriorityOverride() {
-		if(!method_exists('ReflectionProperty', 'setAccessible')) {
-			$this->markTestSkipped("ReflectionProperty::setAccessible() required to perform this test (available in PHP 5.3.2+).");
-		}
-		
-		$appender = new LoggerAppenderSyslog();
-		$appender->setPriority('EMERG');
-		$appender->setOverridePriority(true);
-		$appender->activateOptions();
-		
-		$levels = array(
-			LoggerLevel::getLevelTrace(),
-			LoggerLevel::getLevelDebug(),
-			LoggerLevel::getLevelInfo(),
-			LoggerLevel::getLevelWarn(),
-			LoggerLevel::getLevelError(),
-			LoggerLevel::getLevelFatal(),
-		);
-		
-		$expected = LOG_EMERG;
-		
-		$method = new ReflectionMethod('LoggerAppenderSyslog', '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/79ed2d0d/src/test/php/appenders/socketServer.php
----------------------------------------------------------------------
diff --git a/src/test/php/appenders/socketServer.php b/src/test/php/appenders/socketServer.php
deleted file mode 100644
index 39ec47c..0000000
--- a/src/test/php/appenders/socketServer.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?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
- * @subpackage appenders
- * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- * 
- * A simple socket server used in LoggerAppenderSocketTest.
- */
-
-// Port on which to start the server
-define('SERVER_PORT', 12345);
-
-// Prevent hangs
-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()));
-}
-
-if (socket_set_option($sock, SOL_SOCKET, SO_REUSEADDR, 1) === false) {
-	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()));
-}
-
-if (socket_listen($sock, 100) === false) {
-	die("Failed binding socket: " . socket_strerror(socket_last_error()));
-}
-
-socket_getsockname($sock, $addr, $port);
-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);
-}
-
-myLog("Closing socket.");
-socket_close($sock);
-
-function myLog($msg) {
-	echo date("Y-m-d H:i:s") . " $msg\n";
-}
-
-?>

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/php/bootstrap.php
----------------------------------------------------------------------
diff --git a/src/test/php/bootstrap.php b/src/test/php/bootstrap.php
deleted file mode 100644
index 2dfb255..0000000
--- a/src/test/php/bootstrap.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?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
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- */
-
-error_reporting(E_ALL | E_STRICT); 
-
-// Required for testing logging of sessionID in pattern layout
-session_start();
-
-date_default_timezone_set('Europe/London');
-
-// Define a temp dir where tests may write to
-$tmpDir = dirname(__FILE__) . '/../../../target/temp/phpunit';
-if (!is_dir($tmpDir)) {
-	mkdir($tmpDir, 0777, true);
-}
-define('PHPUNIT_TEMP_DIR', realpath($tmpDir));
-
-// Make the path to the configurations dir for easier access
-$confDir = dirname(__FILE__) . '/../resources/configs';
-define('PHPUNIT_CONFIG_DIR', realpath($confDir));
-
-require dirname(__FILE__) . '/../../main/php/Logger.php';
-require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'LoggerTestHelper.php';
-

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/php/configurators/LoggerConfigurationAdapterINITest.php
----------------------------------------------------------------------
diff --git a/src/test/php/configurators/LoggerConfigurationAdapterINITest.php b/src/test/php/configurators/LoggerConfigurationAdapterINITest.php
deleted file mode 100644
index 2159c73..0000000
--- a/src/test/php/configurators/LoggerConfigurationAdapterINITest.php
+++ /dev/null
@@ -1,173 +0,0 @@
-<?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
- * @subpackage configurators
- * @license	   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- */
-
-/**
- * @group configurators
- */
-class LoggerConfigurationAdapterINITest 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' => 'LoggerAppenderEcho',
-				'layout' => array(
-					'class' => 'LoggerLayoutTTCC',
-				),
-			),
-			'file' => array(
-				'class' => 'LoggerAppenderDailyFile',
-				'layout' => array(
-					'class' => 'LoggerLayoutPattern',
-					'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 LoggerConfigurationAdapterINI();
-		$actual = $adapter->convert($url);
-	
-		$this->assertSame($this->expected1, $actual);
-	}
-	
-	/**
-	 * Test exception is thrown when file cannot be found.
- 	 * @expectedException LoggerException
- 	 * @expectedExceptionMessage File [you/will/never/find/me.ini] does not exist.
-	 */
-	public function testNonExistantFileException() {
-		$adapter = new LoggerConfigurationAdapterINI();
-		$adapter->convert('you/will/never/find/me.ini');
-	}
-	
-	/**
-	 * Test exception is thrown when file is not a valid ini file.
-	 * @expectedException LoggerException
-	 * @expectedExceptionMessage Error parsing configuration file
-	 */
-	public function testInvalidFileException() {
-		$url =  PHPUNIT_CONFIG_DIR . '/adapters/ini/config_invalid_syntax.ini';
-		$adapter = new LoggerConfigurationAdapterINI();
-		$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 LoggerConfigurationAdapterINI();
-		$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 LoggerConfigurationAdapterINI();
-		$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 = LoggerOptionConverter::toBooleanEx($values['unquoted_true']);
-		self::assertTrue($actual);
-		
-		$actual = LoggerOptionConverter::toBooleanEx($values['unquoted_yes']);
-		self::assertTrue($actual);
-		
-		$actual = LoggerOptionConverter::toBooleanEx($values['unquoted_false']);
-		self::assertFalse($actual);
-		
-		$actual = LoggerOptionConverter::toBooleanEx($values['unquoted_no']);
-		self::assertFalse($actual);
-		
-		$actual = LoggerOptionConverter::toBooleanEx($values['quoted_true']);
-		self::assertTrue($actual);
-		
-		$actual = LoggerOptionConverter::toBooleanEx($values['quoted_false']);
-		self::assertFalse($actual);
-		
-		$actual = LoggerOptionConverter::toBooleanEx($values['unquoted_one']);
-		self::assertTrue($actual);
-		
-		$actual = LoggerOptionConverter::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/src/test/php/configurators/LoggerConfigurationAdapterPHPTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/configurators/LoggerConfigurationAdapterPHPTest.php b/src/test/php/configurators/LoggerConfigurationAdapterPHPTest.php
deleted file mode 100644
index 23a0c1e..0000000
--- a/src/test/php/configurators/LoggerConfigurationAdapterPHPTest.php
+++ /dev/null
@@ -1,99 +0,0 @@
-<?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
- * @subpackage configurators
- * @license	   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- */
-
-/**
- * @group configurators
- */
-class LoggerConfigurationAdapterPHPTest extends PHPUnit_Framework_TestCase {
-	
-	private $expected1 = array(
-		'rootLogger' => array(
-			'level' => 'info',
-			'appenders' => array('default')
-		),
-		'appenders' => array(
-			'default' => array(
-				'class' => 'LoggerAppenderEcho',
-				'layout' => array(
-					'class' => 'LoggerLayoutSimple'
-				 )
-			)
-		)
-	);
-	
-	public function testConfig() {
-		$url = PHPUNIT_CONFIG_DIR . '/adapters/php/config_valid.php';
-		$adapter = new LoggerConfigurationAdapterPHP();
-		$actual = $adapter->convert($url);
-		
-		$this->assertSame($this->expected1, $actual);
-	}
-	
-	/**
-	 * Test exception is thrown when file cannot be found.
- 	 * @expectedException LoggerException
- 	 * @expectedExceptionMessage File [you/will/never/find/me.conf] does not exist.
-	 */
-	public function testNonExistantFileWarning() {
-		$adapter = new LoggerConfigurationAdapterPHP();
-		$adapter->convert('you/will/never/find/me.conf');
-	}
-	
-	/**
-	 * Test exception is thrown when file is not valid.
-	 * @expectedException LoggerException
-	 * @expectedExceptionMessage Error parsing configuration: syntax error
-	 */
-	public function testInvalidFileWarning() {
-		$url = PHPUNIT_CONFIG_DIR . '/adapters/php/config_invalid_syntax.php';
-		$adapter = new LoggerConfigurationAdapterPHP();
-		$adapter->convert($url);
-	}
-	
-	/**
-	 * Test exception is thrown when the configuration is empty.
-	 * @expectedException LoggerException
-	 * @expectedExceptionMessage Invalid configuration: empty configuration array.
-	 */
-	public function testEmptyConfigWarning() {
-		$url = PHPUNIT_CONFIG_DIR . '/adapters/php/config_empty.php';
-		$adapter = new LoggerConfigurationAdapterPHP();
-		$adapter->convert($url);
-	}
-	
-	/**
-	 * Test exception is thrown when the configuration does not contain an array.
-	 * @expectedException LoggerException
-	 * @expectedExceptionMessage Invalid configuration: not an array.
-	 */
-	public function testInvalidConfigWarning() {
-		$url = PHPUNIT_CONFIG_DIR . '/adapters/php/config_not_an_array.php';
-		$adapter = new LoggerConfigurationAdapterPHP();
-		$adapter->convert($url);
-	}
-}
-
-?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/php/configurators/LoggerConfigurationAdapterXMLTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/configurators/LoggerConfigurationAdapterXMLTest.php b/src/test/php/configurators/LoggerConfigurationAdapterXMLTest.php
deleted file mode 100644
index ff71ef1..0000000
--- a/src/test/php/configurators/LoggerConfigurationAdapterXMLTest.php
+++ /dev/null
@@ -1,175 +0,0 @@
-<?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
- * @subpackage configurators
- * @license	   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- */
-
-/**
- * @group configurators
- */
-class LoggerConfigurationAdapterXMLTest extends PHPUnit_Framework_TestCase {
-	
-	/** Expected output of parsing config1.xml.*/
-	private $expected1 = array(
-		'appenders' => array(
-			'default' => array(
-				'class' => 'LoggerAppenderEcho',
-				'layout' => array(
-					'class' => 'LoggerLayoutTTCC',
-				),
-				'filters' => array(
-					array(
-						'class' => 'LoggerFilterLevelRange',
-						'params' => array(
-							'levelMin' => 'ERROR',
-							'levelMax' => 'FATAL',
-							'acceptOnMatch' => 'false',
-						),
-					),
-					array(
-						'class' => 'LoggerFilterDenyAll',
-					),
-				),
-			),
-			'file' => array(
-				'class' => 'LoggerAppenderDailyFile',
-				'layout' => array(
-					'class' => 'LoggerLayoutPattern',
-					'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 LoggerConfigurationAdapterXML();
-		$actual = $adapter->convert($url);
-		$this->assertEquals($this->expected1, $actual);
-	}
-	
-	public function testConversion2() {
-		$url =  PHPUNIT_CONFIG_DIR . '/adapters/xml/config_valid_underscore.xml';
-		$adapter = new LoggerConfigurationAdapterXML();
-		$actual = $adapter->convert($url);
-		
-		$this->assertEquals($this->expected1, $actual);
-	}
-	
-	/**
-	 * Test exception is thrown when file cannot be found.
- 	 * @expectedException LoggerException
- 	 * @expectedExceptionMessage File [you/will/never/find/me.conf] does not exist.
-	 */
-	public function testNonExistantFile() {
-		$adapter = new LoggerConfigurationAdapterXML();
-		$adapter->convert('you/will/never/find/me.conf');
-	}
-	
-	/**
-	 * Test exception is thrown when file contains invalid XML.
-	 * @expectedException 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 LoggerConfigurationAdapterXML();
-		$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 LoggerConfigurationAdapterXML();
-		$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 LoggerConfigurationAdapterXML();
-		
-		// 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/src/test/php/filters/LoggerFilterDenyAllTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/filters/LoggerFilterDenyAllTest.php b/src/test/php/filters/LoggerFilterDenyAllTest.php
deleted file mode 100644
index 1e9bb3d..0000000
--- a/src/test/php/filters/LoggerFilterDenyAllTest.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?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
- * @subpackage filters
- * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- */
-
-/**
- * @group filters
- */
-class LoggerFilterDenyAllTest extends PHPUnit_Framework_TestCase {
-        
-	public function testDecide() {
-		$filter = new LoggerFilterDenyAll();
-		
-		$events = array(
-			LoggerTestHelper::getTraceEvent(),
-			LoggerTestHelper::getDebugEvent(),
-			LoggerTestHelper::getInfoEvent(),
-			LoggerTestHelper::getWarnEvent(),
-			LoggerTestHelper::getErrorEvent(),
-			LoggerTestHelper::getFatalEvent(),
-		);
-		
-		foreach($events as $event) {
-			$actual = $filter->decide($event);
-			self::assertEquals(LoggerFilter::DENY, $actual);
-		}
-    }
-    
-    public function testConfiguration() {
-    	$config = LoggerConfiguratorDefault::getDefaultConfiguration();
-    	$config['appenders']['default']['filters'] = array(
-    		array(
-    			'class' => 'LoggerFilterDenyAll'
-    		)
-    	);
-    	
-    	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/src/test/php/filters/LoggerFilterLevelMatchTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/filters/LoggerFilterLevelMatchTest.php b/src/test/php/filters/LoggerFilterLevelMatchTest.php
deleted file mode 100644
index c402030..0000000
--- a/src/test/php/filters/LoggerFilterLevelMatchTest.php
+++ /dev/null
@@ -1,181 +0,0 @@
-<?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
- * @subpackage filters
- * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- */
-
-/**
- * @group filters
- */
-class LoggerFilterLevelMatchTest 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 LoggerFilterLevelMatch();
-		$filter->setAcceptOnMatch("true");
-		
-		$levels = LoggerTestHelper::getAllLevels();
-		$events = LoggerTestHelper::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) ? LoggerFilter::ACCEPT : LoggerFilter::NEUTRAL;
-				$actual = $filter->decide($event);
-					
-				// Get string represenations for logging
-				$sExpected = LoggerTestHelper::decisionToString($expected);
-				$sActual = LoggerTestHelper::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 LoggerFilterLevelMatch();
-		$filter->setAcceptOnMatch("false");
-	
-		$levels = LoggerTestHelper::getAllLevels();
-		$events = LoggerTestHelper::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) ? LoggerFilter::DENY : LoggerFilter::NEUTRAL;
-				$actual = $filter->decide($event);
-					
-				// Get string represenations for logging
-				$sExpected = LoggerTestHelper::decisionToString($expected);
-				$sActual = LoggerTestHelper::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 LoggerFilterLevelMatch();
-		$events = LoggerTestHelper::getAllEvents();
-		
-		foreach($events as $event) {
-			$expected = LoggerFilter::NEUTRAL;
-			$actual = $filter->decide($event);
-				
-			// Get string represenations for logging
-			$sExpected = LoggerTestHelper::decisionToString($expected);
-			$sActual = LoggerTestHelper::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 = LoggerTestHelper::getEchoConfig();
-		
-		// Add filters to default appender
-		$config['appenders']['default']['filters'] = array(
-			
-			// Accepts only INFO events
-			array(
-				'class' => 'LoggerFilterLevelMatch',
-				'params' => array(
-					'levelToMatch' => 'info',
-					'acceptOnMatch' => true
-				)
-			),
-			
-			// Denies all events not accepted by first filter
-			array(
-				'class' => 'LoggerFilterDenyAll',
-			)
-		);
-		 
-		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 = LoggerTestHelper::getEchoConfig();
-	
-		// Add filter which denies INFO events
-		$config['appenders']['default']['filters'] = array(
-			array(
-				'class' => 'LoggerFilterLevelMatch',
-				'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/src/test/php/filters/LoggerFilterLevelRangeTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/filters/LoggerFilterLevelRangeTest.php b/src/test/php/filters/LoggerFilterLevelRangeTest.php
deleted file mode 100644
index 7f16590..0000000
--- a/src/test/php/filters/LoggerFilterLevelRangeTest.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?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
- * @subpackage filters
- * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version    $Revision$
- * @link       http://logging.apache.org/log4php
- */
-
-/**
- * @group filters
- */
-class LoggerFilterLevelRangeTest extends PHPUnit_Framework_TestCase {
-        
-	public function testDecide() {
-		$filter = new LoggerFilterLevelRange();
-		$filter->setAcceptOnMatch("true");
-		$filter->setLevelMin(LoggerLevel::getLevelWarn());
-		$filter->setLevelMax(LoggerLevel::getLevelError());
-		
-		$eventError = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
-		$eventDebug = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelDebug(), "testmessage");
-		$eventWarn = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
-		
-		$result = $filter->decide($eventError);
-		self::assertEquals($result, LoggerFilter::ACCEPT);
-		
-		$result = $filter->decide($eventDebug);
-		self::assertEquals($result, LoggerFilter::DENY);
-		
-		$result = $filter->decide($eventWarn);
-		self::assertEquals($result, LoggerFilter::ACCEPT);
-    }
-    
-    public function testDecideAcceptFalse() {
-		$filter = new LoggerFilterLevelRange();
-		$filter->setAcceptOnMatch("false");
-		$filter->setLevelMin(LoggerLevel::getLevelWarn());
-		$filter->setLevelMax(LoggerLevel::getLevelError());
-		
-		$eventError = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
-		$eventDebug = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelDebug(), "testmessage");
-		$eventWarn = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
-		
-		$result = $filter->decide($eventError);
-		self::assertEquals($result, LoggerFilter::NEUTRAL);
-		
-		$result = $filter->decide($eventDebug);
-		self::assertEquals($result, LoggerFilter::DENY);
-		
-		$result = $filter->decide($eventWarn);
-		self::assertEquals($result, LoggerFilter::NEUTRAL);
-    }
- }


Mime
View raw message