You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ih...@apache.org on 2013/11/28 17:03:35 UTC
[05/43] LOG4PHP-121: Reorganized classes into namespaces
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/php/filters/LoggerFilterStringMatchTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/filters/LoggerFilterStringMatchTest.php b/src/test/php/filters/LoggerFilterStringMatchTest.php
deleted file mode 100644
index 366e685..0000000
--- a/src/test/php/filters/LoggerFilterStringMatchTest.php
+++ /dev/null
@@ -1,113 +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 LoggerFilterStringMatchTest extends PHPUnit_Framework_TestCase {
-
- public function testDecideAccept() {
- $filter = new LoggerFilterStringMatch();
- $filter->setAcceptOnMatch("true");
- $filter->setStringToMatch("testmessage");
-
- $eventError = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
- $eventError2 = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "xyz");
- $eventDebug = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
- $eventDebug2 = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelDebug(), "xyz");
- $eventWarn = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
- $eventWarn2 = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "xyz");
-
- $result = $filter->decide($eventError);
- self::assertEquals($result, LoggerFilter::ACCEPT);
-
- $result = $filter->decide($eventError2);
- self::assertEquals($result, LoggerFilter::NEUTRAL);
-
- $result = $filter->decide($eventDebug);
- self::assertEquals($result, LoggerFilter::ACCEPT);
-
- $result = $filter->decide($eventDebug2);
- self::assertEquals($result, LoggerFilter::NEUTRAL);
-
- $result = $filter->decide($eventWarn);
- self::assertEquals($result, LoggerFilter::ACCEPT);
-
- $result = $filter->decide($eventWarn2);
- self::assertEquals($result, LoggerFilter::NEUTRAL);
- }
-
- public function testDecideDeny() {
- $filter = new LoggerFilterStringMatch();
- $filter->setAcceptOnMatch("false");
- $filter->setStringToMatch("testmessage");
-
- $eventError = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
- $eventError2 = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "xyz");
- $eventDebug = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
- $eventDebug2 = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelDebug(), "xyz");
- $eventWarn = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
- $eventWarn2 = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "xyz");
-
- $result = $filter->decide($eventError);
- self::assertEquals($result, LoggerFilter::DENY);
-
- $result = $filter->decide($eventError2);
- self::assertEquals($result, LoggerFilter::NEUTRAL);
-
- $result = $filter->decide($eventDebug);
- self::assertEquals($result, LoggerFilter::DENY);
-
- $result = $filter->decide($eventDebug2);
- self::assertEquals($result, LoggerFilter::NEUTRAL);
-
- $result = $filter->decide($eventWarn);
- self::assertEquals($result, LoggerFilter::DENY);
-
- $result = $filter->decide($eventWarn2);
- self::assertEquals($result, LoggerFilter::NEUTRAL);
- }
-
- public function testDecideNullMessage() {
- $filter = new LoggerFilterStringMatch();
- $filter->setAcceptOnMatch("false");
- $filter->setStringToMatch("testmessage");
-
- $event = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), null);
-
- $result = $filter->decide($event);
- self::assertEquals($result, LoggerFilter::NEUTRAL);
- }
-
- public function testDecideNullMatch() {
- $filter = new LoggerFilterStringMatch();
- $filter->setAcceptOnMatch("false");
-
- $event = new LoggerLoggingEvent("LoggerAppenderEchoTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
-
- $result = $filter->decide($event);
- self::assertEquals($result, LoggerFilter::NEUTRAL);
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/php/helpers/LoggerOptionConverterTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/helpers/LoggerOptionConverterTest.php b/src/test/php/helpers/LoggerOptionConverterTest.php
deleted file mode 100644
index 3f64321..0000000
--- a/src/test/php/helpers/LoggerOptionConverterTest.php
+++ /dev/null
@@ -1,147 +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 helpers
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version $Revision$
- * @link http://logging.apache.org/log4php
- */
-
-define('MY_CONSTANT_CONSTANT', 'DEFINE');
-define('MY_CONSTANT_CONSTANT_OTHER', 'DEFINE_OTHER');
-
-/**
- * @group helpers
- */
-class LoggerOptionConverterTest extends PHPUnit_Framework_TestCase {
-
- public function testToBoolean() {
- self::assertTrue(LoggerOptionConverter::toBooleanEx(1));
- self::assertTrue(LoggerOptionConverter::toBooleanEx("1"));
- self::assertTrue(LoggerOptionConverter::toBooleanEx(true));
- self::assertTrue(LoggerOptionConverter::toBooleanEx("true"));
- self::assertTrue(LoggerOptionConverter::toBooleanEx("on"));
- self::assertTrue(LoggerOptionConverter::toBooleanEx("yes"));
-
- self::assertFalse(LoggerOptionConverter::toBooleanEx(0));
- self::assertFalse(LoggerOptionConverter::toBooleanEx("0"));
- self::assertFalse(LoggerOptionConverter::toBooleanEx(false));
- self::assertFalse(LoggerOptionConverter::toBooleanEx("false"));
- self::assertFalse(LoggerOptionConverter::toBooleanEx("off"));
- self::assertFalse(LoggerOptionConverter::toBooleanEx("no"));
- }
-
- /**
- * Test fail on NULL.
- * @expectedException LoggerException
- * @expectedExceptionMessage Given value [NULL] cannot be converted to boolean.
- */
- public function testToBooleanFailure1() {
- LoggerOptionConverter::toBooleanEx(null);
- }
-
- /**
- * Test fail on invalid string.
- * @expectedException LoggerException
- * @expectedExceptionMessage Given value ['foo'] cannot be converted to boolean.
- */
- public function testToBooleanFailure2() {
- LoggerOptionConverter::toBooleanEx('foo');
- }
-
- public function testToInteger() {
- self::assertSame(1, LoggerOptionConverter::toIntegerEx('1'));
- self::assertSame(1, LoggerOptionConverter::toIntegerEx(1));
- self::assertSame(0, LoggerOptionConverter::toIntegerEx('0'));
- self::assertSame(0, LoggerOptionConverter::toIntegerEx(0));
- self::assertSame(-1, LoggerOptionConverter::toIntegerEx('-1'));
- self::assertSame(-1, LoggerOptionConverter::toIntegerEx(-1));
- }
-
- /**
- * Test fail on NULL.
- * @expectedException LoggerException
- * @expectedExceptionMessage Given value [NULL] cannot be converted to integer.
- */
- public function testToIntegerFailure1() {
- LoggerOptionConverter::toIntegerEx(null);
- }
-
- /**
- * Test fail on empty string.
- * @expectedException LoggerException
- * @expectedExceptionMessage Given value [''] cannot be converted to integer.
- */
- public function testToIntegerFailure2() {
- LoggerOptionConverter::toIntegerEx('');
- }
-
- /**
- * Test fail on invalid string.
- * @expectedException LoggerException
- * @expectedExceptionMessage Given value ['foo'] cannot be converted to integer.
- */
- public function testToIntegerFailure3() {
- LoggerOptionConverter::toIntegerEx('foo');
- }
-
- /**
- * Test fail on boolean.
- * @expectedException LoggerException
- * @expectedExceptionMessage Given value [true] cannot be converted to integer.
- */
- public function testToIntegerFailure4() {
- LoggerOptionConverter::toIntegerEx(true);
- }
-
- /**
- * Test fail on boolean.
- * @expectedException LoggerException
- * @expectedExceptionMessage Given value [false] cannot be converted to integer.
- */
- public function testToIntegerFailure5() {
- LoggerOptionConverter::toIntegerEx(false);
- }
-
- public function testSubstituteConstants() {
- define('OTHER_CONSTANT', 'OTHER');
- define('MY_CONSTANT', 'TEST');
- define('NEXT_CONSTANT', 'NEXT');
-
- $result = LoggerOptionConverter::substConstants('Value of key is ${MY_CONSTANT}.');
- self::assertEquals('Value of key is TEST.', $result);
-
- $result = LoggerOptionConverter::substConstants('Value of key is ${MY_CONSTANT} or ${OTHER_CONSTANT}.');
- self::assertEquals('Value of key is TEST or OTHER.', $result);
-
- $result = LoggerOptionConverter::substConstants('Value of key is ${MY_CONSTANT_CONSTANT}.');
- self::assertEquals('Value of key is DEFINE.', $result);
-
- $result = LoggerOptionConverter::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 LoggerAppenderFile();
- $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/src/test/php/helpers/LoggerPatternParserTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/helpers/LoggerPatternParserTest.php b/src/test/php/helpers/LoggerPatternParserTest.php
deleted file mode 100644
index d0f68ef..0000000
--- a/src/test/php/helpers/LoggerPatternParserTest.php
+++ /dev/null
@@ -1,55 +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 helpers
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version $Revision$
- * @link http://logging.apache.org/log4php
- */
-
-/**
- * @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 LoggerLoggingEvent("LoggerLayoutXml", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
-// $expected = 'ERROR TEST : testmessage in NA at NA'.PHP_EOL;
-
-// $patternParser = new LoggerPatternParser("%-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 LoggerLoggingEvent("MyClass", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
-// $expected = 'MyClass';
-// $patternParser = new LoggerPatternParser("%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/src/test/php/helpers/LoggerUtilsTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/helpers/LoggerUtilsTest.php b/src/test/php/helpers/LoggerUtilsTest.php
deleted file mode 100644
index 5a473ba..0000000
--- a/src/test/php/helpers/LoggerUtilsTest.php
+++ /dev/null
@@ -1,88 +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 helpers
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version $Revision$
- * @link http://logging.apache.org/log4php
- */
-
-/**
- * @group helpers
- */
-class LoggerUtilsTest extends PHPUnit_Framework_TestCase {
-
- public function testShorten() {
- $name = 'org\\apache\\logging\\log4php\\Foo';
-
- $actual = LoggerUtils::shortenClassName($name, null);
- self::assertSame($name, $actual);
-
- $actual = LoggerUtils::shortenClassName($name, 0);
- self::assertSame('Foo', $actual);
-
- $actual = LoggerUtils::shortenClassName($name, 5);
- self::assertSame('o\\a\\l\\l\\Foo', $actual);
-
- $actual = LoggerUtils::shortenClassName($name, 16);
- self::assertSame('o\\a\\l\\l\\Foo', $actual);
-
- $actual = LoggerUtils::shortenClassName($name, 17);
- self::assertSame('o\\a\\l\\log4php\\Foo', $actual);
-
- $actual = LoggerUtils::shortenClassName($name, 25);
- self::assertSame('o\\a\\logging\\log4php\\Foo', $actual);
-
- $actual = LoggerUtils::shortenClassName($name, 28);
- self::assertSame('o\\apache\\logging\\log4php\\Foo', $actual);
-
- $actual = LoggerUtils::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 = LoggerUtils::shortenClassName($name, null);
- self::assertSame($name, $actual);
-
- $actual = LoggerUtils::shortenClassName($name, 0);
- self::assertSame('Foo', $actual);
-
- $actual = LoggerUtils::shortenClassName($name, 5);
- self::assertSame('o\a\l\l\Foo', $actual);
-
- $actual = LoggerUtils::shortenClassName($name, 16);
- self::assertSame('o\a\l\l\Foo', $actual);
-
- $actual = LoggerUtils::shortenClassName($name, 17);
- self::assertSame('o\a\l\log4php\Foo', $actual);
-
- $actual = LoggerUtils::shortenClassName($name, 25);
- self::assertSame('o\a\logging\log4php\Foo', $actual);
-
- $actual = LoggerUtils::shortenClassName($name, 28);
- self::assertSame('o\apache\logging\log4php\Foo', $actual);
-
- $actual = LoggerUtils::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/src/test/php/layouts/LoggerLayoutHtmlTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/layouts/LoggerLayoutHtmlTest.php b/src/test/php/layouts/LoggerLayoutHtmlTest.php
deleted file mode 100644
index 59d7e5c..0000000
--- a/src/test/php/layouts/LoggerLayoutHtmlTest.php
+++ /dev/null
@@ -1,95 +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 layouts
- */
-class LoggerLayoutHtmlTest extends PHPUnit_Framework_TestCase {
-
- public function testErrorLayout() {
- $event = new LoggerLoggingEvent("LoggerLayoutHtmlTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
-
- $layout = new LoggerLayoutHtml();
- $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 LoggerLoggingEvent("LoggerLayoutHtmlTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
-
- $layout = new LoggerLayoutHtml();
- $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 LoggerLayoutHtml();
- $v = $layout->getContentType();
- $e = "text/html";
- self::assertEquals($v, $e);
- }
-
- public function testTitle() {
- $layout = new LoggerLayoutHtml();
- $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 LoggerLayoutHtml();
- $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 LoggerLayoutHtml();
- $v = $layout->getFooter();
- self::assertTrue(strpos($v, "</table>") === 0);
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/php/layouts/LoggerLayoutPatternTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/layouts/LoggerLayoutPatternTest.php b/src/test/php/layouts/LoggerLayoutPatternTest.php
deleted file mode 100644
index cc322cd..0000000
--- a/src/test/php/layouts/LoggerLayoutPatternTest.php
+++ /dev/null
@@ -1,54 +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 layouts
- */
-class LoggerLayoutPatternTest 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 = LoggerTestHelper::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/src/test/php/layouts/LoggerLayoutSerializedTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/layouts/LoggerLayoutSerializedTest.php b/src/test/php/layouts/LoggerLayoutSerializedTest.php
deleted file mode 100644
index 7237127..0000000
--- a/src/test/php/layouts/LoggerLayoutSerializedTest.php
+++ /dev/null
@@ -1,107 +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 layouts
- */
-class LoggerLayoutSerializedTest extends PHPUnit_Framework_TestCase {
-
- public function testLocationInfo() {
- $layout = new LoggerLayoutSerialized();
- 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 LoggerLayoutSerialized();
- $layout->setLocationInfo('foo');
- }
-
- public function testLayout() {
- Logger::configure(array(
- 'appenders' => array(
- 'default' => array(
- 'class' => 'LoggerAppenderEcho',
- 'layout' => array(
- 'class' => 'LoggerLayoutSerialized'
- )
- )
- ),
- '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('LoggerLoggingEvent', $event);
- self::assertEquals('Interesting message.', $event->getMessage());
- self::assertEquals(LoggerLevel::getLevelInfo(), $event->getLevel());
- }
-
- public function testLayoutWithLocationInfo() {
- Logger::configure(array(
- 'appenders' => array(
- 'default' => array(
- 'class' => 'LoggerAppenderEcho',
- 'layout' => array(
- 'class' => 'LoggerLayoutSerialized',
- '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('LoggerLoggingEvent', $event);
- self::assertEquals('Interesting message.', $event->getMessage());
- self::assertEquals(LoggerLevel::getLevelInfo(), $event->getLevel());
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/php/layouts/LoggerLayoutSimpleTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/layouts/LoggerLayoutSimpleTest.php b/src/test/php/layouts/LoggerLayoutSimpleTest.php
deleted file mode 100644
index 76a35c9..0000000
--- a/src/test/php/layouts/LoggerLayoutSimpleTest.php
+++ /dev/null
@@ -1,40 +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 layouts
- */
-class LoggerLayoutSimpleTest extends PHPUnit_Framework_TestCase {
-
- public function testSimpleLayout() {
- $event = new LoggerLoggingEvent("LoggerLayoutSimpleTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
-
- $layout = new LoggerLayoutSimple();
- $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/src/test/php/layouts/LoggerLayoutTTCCTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/layouts/LoggerLayoutTTCCTest.php b/src/test/php/layouts/LoggerLayoutTTCCTest.php
deleted file mode 100644
index 9baf060..0000000
--- a/src/test/php/layouts/LoggerLayoutTTCCTest.php
+++ /dev/null
@@ -1,68 +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 layouts
- */
-class LoggerLayoutTTCCTest extends PHPUnit_Framework_TestCase {
-
- /**
- * @expectedException PHPUnit_Framework_Error
- * @expectedExceptionMessage LoggerLayout TTCC is deprecated and will be removed in a future release.
- */
- public function testDeprecationWarning() {
- $layout = new LoggerLayoutTTCC();
- }
-
- public function testErrorLayout() {
- $event = new LoggerLoggingEvent("LoggerLayoutTTCC", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
-
- $layout = @new LoggerLayoutTTCC();
- $v = $layout->format($event);
-
- $pos = strpos($v, "[".$event->getThreadName()."] ERROR TEST - testmessage");
-
- if ($pos === false) {
- self::assertTrue(false);
- } else if ($pos === true) {
- self::assertTrue(true);
- }
- }
-
- public function testWarnLayout() {
- $event = new LoggerLoggingEvent("LoggerLayoutXml", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
-
- $layout = @new LoggerLayoutTTCC();
- $v = $layout->format($event);
-
- $pos = strpos($v, "[".$event->getThreadName()."] WARN TEST - testmessage");
-
- if ($pos === false) {
- self::assertTrue(false);
- } else if ($pos === true) {
- self::assertTrue(true);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/php/layouts/LoggerLayoutXmlTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/layouts/LoggerLayoutXmlTest.php b/src/test/php/layouts/LoggerLayoutXmlTest.php
deleted file mode 100644
index 34bb77c..0000000
--- a/src/test/php/layouts/LoggerLayoutXmlTest.php
+++ /dev/null
@@ -1,148 +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 layouts
- */
-class LoggerLayoutXmlTest extends PHPUnit_Framework_TestCase {
-
- public function testErrorLayout() {
- $event = LoggerTestHelper::getErrorEvent("testmessage");
-
- $layout = new LoggerLayoutXml();
- $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=\"LoggerLoggingEvent\" file=\"NA\" line=\"NA\" " .
- "method=\"getLocationInformation\" />" . PHP_EOL .
- "</log4php:event>" . PHP_EOL;
-
- self::assertEquals($expected, $actual);
- }
-
- public function testWarnLayout() {
- $event = LoggerTestHelper::getWarnEvent("testmessage");
-
- $layout = new LoggerLayoutXml();
- $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=\"LoggerLoggingEvent\" file=\"NA\" line=\"NA\" " .
- "method=\"getLocationInformation\" />" . PHP_EOL .
- "</log4php:event>" . PHP_EOL;
-
- self::assertEquals($expected, $actual);
- }
-
- public function testLog4JNamespaceErrorLayout() {
- $event = LoggerTestHelper::getErrorEvent("testmessage");
-
- $layout = new LoggerLayoutXml();
- $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=\"LoggerLoggingEvent\" file=\"NA\" line=\"NA\" " .
- "method=\"getLocationInformation\" />" . PHP_EOL .
- "</log4j:event>" . PHP_EOL;
-
- self::assertEquals($expected, $actual);
- }
-
- public function testNDC()
- {
- LoggerNDC::push('foo');
- LoggerNDC::push('bar');
-
- $event = LoggerTestHelper::getErrorEvent("testmessage");
-
- $layout = new LoggerLayoutXml();
- $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=\"LoggerLoggingEvent\" file=\"NA\" line=\"NA\" " .
- "method=\"getLocationInformation\" />" . PHP_EOL .
- "</log4php:event>" . PHP_EOL;
-
- self::assertEquals($expected, $actual);
-
- LoggerNDC::clear();
- }
-
- public function testMDC()
- {
- LoggerMDC::put('foo', 'bar');
- LoggerMDC::put('bla', 'tra');
-
- $event = LoggerTestHelper::getErrorEvent("testmessage");
-
- $layout = new LoggerLayoutXml();
- $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=\"LoggerLoggingEvent\" file=\"NA\" line=\"NA\" " .
- "method=\"getLocationInformation\" />" . PHP_EOL .
- "</log4php:event>" . PHP_EOL;
-
- self::assertEquals($expected, $actual);
-
- LoggerMDC::clear();
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/php/pattern/LoggerPatternConverterTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/pattern/LoggerPatternConverterTest.php b/src/test/php/pattern/LoggerPatternConverterTest.php
deleted file mode 100644
index 12ab854..0000000
--- a/src/test/php/pattern/LoggerPatternConverterTest.php
+++ /dev/null
@@ -1,384 +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 pattern
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version $Revision$
- * @link http://logging.apache.org/log4php
- */
-
-/** Converter referencing non-existant superglobal variable. */
-class LoggerInvalidSuperglobalConverter extends LoggerPatternConverterSuperglobal {
- protected $name = '_FOO';
-}
-
-/**
- * @group pattern
- */
-class LoggerPatternConverterTest extends PHPUnit_Framework_TestCase {
-
- /**
- * A logging event for testing.
- * @var LoggerLoggingEvent
- */
- private $event;
-
- /**
- * Fromatting info used with the logging event.
- * @var LoggerFormattingInfos
- */
- private $info;
-
- public function __construct() {
- $this->event = LoggerTestHelper::getInfoEvent('foobar');
- $this->info = new LoggerFormattingInfo();
- }
-
- public function testCookie() {
- // Fake a couple of cookies
- $_COOKIE['test1'] = 'value1';
- $_COOKIE['test2'] = 'value2';
-
- $converter = new LoggerPatternConverterCookie($this->info, 'test1');
- $actual = $converter->convert($this->event);
- $expected = 'value1';
- self::assertSame($expected, $actual);
-
- $converter = new LoggerPatternConverterCookie($this->info, 'test2');
- $actual = $converter->convert($this->event);
- $expected = 'value2';
- self::assertSame($expected, $actual);
-
- $converter = new LoggerPatternConverterCookie($this->info);
- $actual = $converter->convert($this->event);
- $expected = "test1=value1, test2=value2";
- self::assertSame($expected, $actual);
- }
-
- public function testDate() {
- $converter = new LoggerPatternConverterDate($this->info, 'c');
- $actual = $converter->convert($this->event);
- $expected = date('c', $this->event->getTimeStamp());
- self::assertSame($expected, $actual);
-
- // Format defaults to 'c'
- $converter = new LoggerPatternConverterDate($this->info);
- $actual = $converter->convert($this->event);
- $expected = date('c', $this->event->getTimeStamp());
- self::assertSame($expected, $actual);
-
- $converter = new LoggerPatternConverterDate($this->info, '');
- $actual = $converter->convert($this->event);
- $expected = date('c', $this->event->getTimeStamp());
- self::assertSame($expected, $actual);
-
- // Test ABSOLUTE
- $converter = new LoggerPatternConverterDate($this->info, 'ABSOLUTE');
- $actual = $converter->convert($this->event);
- $expected = date('H:i:s', $this->event->getTimeStamp());
- self::assertSame($expected, $actual);
-
- // Test DATE
- $converter = new LoggerPatternConverterDate($this->info, 'DATE');
- $actual = $converter->convert($this->event);
- $expected = date('d M Y H:i:s.', $this->event->getTimeStamp());
-
- $timestamp = $this->event->getTimeStamp();
- $ms = floor(($timestamp - floor($timestamp)) * 1000);
- $ms = str_pad($ms, 3, '0', STR_PAD_LEFT);
-
- $expected .= $ms;
-
- self::assertSame($expected, $actual);
- }
-
- public function testEnvironment() {
- // Fake a couple of environment values
- $_ENV['test1'] = 'value1';
- $_ENV['test2'] = 'value2';
-
- $converter = new LoggerPatternConverterEnvironment($this->info, 'test1');
- $actual = $converter->convert($this->event);
- $expected = 'value1';
- self::assertSame($expected, $actual);
-
- $converter = new LoggerPatternConverterEnvironment($this->info, 'test2');
- $actual = $converter->convert($this->event);
- $expected = 'value2';
- self::assertSame($expected, $actual);
- }
-
- public function testLevel() {
- $converter = new LoggerPatternConverterLevel($this->info);
- $actual = $converter->convert($this->event);
- $expected = $this->event->getLevel()->toString();
- self::assertEquals($expected, $actual);
- }
-
- public function testLiteral() {
- $converter = new LoggerPatternConverterLiteral('foo bar baz');
- $actual = $converter->convert($this->event);
- $expected = 'foo bar baz';
- self::assertEquals($expected, $actual);
- }
-
- public function testLoggerWithoutOption() {
- $event = LoggerTestHelper::getInfoEvent('foo', 'TestLoggerName');
- $converter = new LoggerPatternConverterLogger($this->info);
-
- $actual = $converter->convert($event);
- $expected = 'TestLoggerName';
- self::assertEquals($expected, $actual);
- }
-
- public function testLoggerWithOption0() {
- $event = LoggerTestHelper::getInfoEvent('foo', 'TestLoggerName');
- $converter = new LoggerPatternConverterLogger($this->info, '0');
-
- $actual = $converter->convert($event);
- $expected = 'TestLoggerName';
- self::assertEquals($expected, $actual);
- }
-
- public function testLocation() {
- $config = LoggerTestHelper::getEchoPatternConfig("%file:%line:%class:%method");
- Logger::configure($config);
-
- // Test by capturing output. Logging methods of a Logger object must
- // be used for the location info to be formed correctly.
- ob_start();
- $log = Logger::getLogger('foo');
- $log->info('foo'); $line = __LINE__; // Do NOT move this to next line.
- $actual = ob_get_contents();
- ob_end_clean();
-
- $expected = implode(':', array(__FILE__, $line, __CLASS__, __FUNCTION__));
- self::assertSame($expected, $actual);
-
- Logger::resetConfiguration();
- }
-
- public function testLocation2() {
- $config = LoggerTestHelper::getEchoPatternConfig("%location");
- Logger::configure($config);
-
- // Test by capturing output. Logging methods of a Logger object must
- // be used for the location info to be formed correctly.
- ob_start();
- $log = Logger::getLogger('foo');
- $log->info('foo'); $line = __LINE__; // Do NOT move this to next line.
- $actual = ob_get_contents();
- ob_end_clean();
-
- $class = __CLASS__;
- $func = __FUNCTION__;
- $file = __FILE__;
-
- $expected = "$class.$func($file:$line)";
- self::assertSame($expected, $actual);
-
- Logger::resetConfiguration();
- }
-
- public function testMessage() {
- $expected = "This is a message.";
- $event = LoggerTestHelper::getInfoEvent($expected);
- $converter = new LoggerPatternConverterMessage($this->info);
- $actual = $converter->convert($event);
- self::assertSame($expected, $actual);
- }
-
- public function testMDC() {
- LoggerMDC::put('foo', 'bar');
- LoggerMDC::put('bla', 'tra');
-
- // Entire context
- $converter = new LoggerPatternConverterMDC($this->info);
- $actual = $converter->convert($this->event);
- $expected = 'foo=bar, bla=tra';
- self::assertSame($expected, $actual);
-
- // Just foo
- $converter = new LoggerPatternConverterMDC($this->info, 'foo');
- $actual = $converter->convert($this->event);
- $expected = 'bar';
- self::assertSame($expected, $actual);
-
- // Non existant key
- $converter = new LoggerPatternConverterMDC($this->info, 'doesnotexist');
- $actual = $converter->convert($this->event);
- $expected = '';
- self::assertSame($expected, $actual);
-
- LoggerMDC::clear();
- }
-
- public function testNDC() {
- LoggerNDC::push('foo');
- LoggerNDC::push('bar');
- LoggerNDC::push('baz');
-
- $converter = new LoggerPatternConverterNDC($this->info);
- $expected = 'foo bar baz';
- $actual = $converter->convert($this->event);
- self::assertEquals($expected, $actual);
- }
-
- public function testNewline() {
- $converter = new LoggerPatternConverterNewLine($this->info);
- $actual = $converter->convert($this->event);
- $expected = PHP_EOL;
- self::assertSame($expected, $actual);
- }
-
- public function testProcess() {
- $converter = new LoggerPatternConverterProcess($this->info);
- $actual = $converter->convert($this->event);
- $expected = getmypid();
- self::assertSame($expected, $actual);
- }
-
- public function testRelative() {
- $converter = new LoggerPatternConverterRelative($this->info);
- $expected = number_format($this->event->getTimeStamp() - $this->event->getStartTime(), 4);
- $actual = $converter->convert($this->event);
- self::assertSame($expected, $actual);
- }
-
- public function testRequest() {
- // Fake a couple of request values
- $_REQUEST['test1'] = 'value1';
- $_REQUEST['test2'] = 'value2';
-
- // Entire request
- $converter = new LoggerPatternConverterRequest($this->info);
- $actual = $converter->convert($this->event);
- $expected = 'test1=value1, test2=value2';
- self::assertSame($expected, $actual);
-
- // Just test2
- $converter = new LoggerPatternConverterRequest($this->info, 'test2');
- $actual = $converter->convert($this->event);
- $expected = 'value2';
- self::assertSame($expected, $actual);
- }
-
- public function testServer() {
- // Fake a server value
- $_SERVER['test1'] = 'value1';
-
- $converter = new LoggerPatternConverterServer($this->info, 'test1');
- $actual = $converter->convert($this->event);
- $expected = 'value1';
- self::assertSame($expected, $actual);
- }
-
- public function testSession() {
- // Fake a session value
- $_SESSION['test1'] = 'value1';
-
- $converter = new LoggerPatternConverterSession($this->info, 'test1');
- $actual = $converter->convert($this->event);
- $expected = 'value1';
- self::assertSame($expected, $actual);
- }
-
- public function testSessionID() {
- $converter = new LoggerPatternConverterSessionID($this->info);
- $actual = $converter->convert($this->event);
- $expected = session_id();
- self::assertSame($expected, $actual);
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- * @expectedExceptionMessage log4php: LoggerInvalidSuperglobalConverter: Cannot find superglobal variable $_FOO
- */
- public function testNonexistantSuperglobal() {
- $converter = new LoggerInvalidSuperglobalConverter($this->info);
- $actual = $converter->convert($this->event);
- }
-
- public function testFormattingTrimRight() {
- $event = LoggerTestHelper::getInfoEvent('0123456789');
-
- $info = new LoggerFormattingInfo();
- $info->max = 5;
-
- $converter = new LoggerPatternConverterMessage($info);
- $actual = "";
- $converter->format($actual, $event);
- $expected = "01234";
- self::assertSame($expected, $actual);
- }
-
- public function testFormattingTrimLeft() {
- $event = LoggerTestHelper::getInfoEvent('0123456789');
-
- $info = new LoggerFormattingInfo();
- $info->max = 5;
- $info->trimLeft = true;
-
- $converter = new LoggerPatternConverterMessage($info);
- $actual = "";
- $converter->format($actual, $event);
- $expected = "56789";
- self::assertSame($expected, $actual);
- }
-
- public function testFormattingPadEmpty() {
- $event = LoggerTestHelper::getInfoEvent('');
-
- $info = new LoggerFormattingInfo();
- $info->min = 5;
-
- $converter = new LoggerPatternConverterMessage($info);
- $actual = "";
- $converter->format($actual, $event);
- $expected = " ";
- self::assertSame($expected, $actual);
- }
-
- public function testFormattingPadLeft() {
- $event = LoggerTestHelper::getInfoEvent('0');
-
- $info = new LoggerFormattingInfo();
- $info->min = 5;
-
- $converter = new LoggerPatternConverterMessage($info);
- $actual = "";
- $converter->format($actual, $event);
- $expected = " 0";
- self::assertSame($expected, $actual);
- }
-
- public function testFormattingPadRight() {
- $event = LoggerTestHelper::getInfoEvent('0');
-
- $info = new LoggerFormattingInfo();
- $info->min = 5;
- $info->padLeft = false;
-
- $converter = new LoggerPatternConverterMessage($info);
- $actual = "";
- $converter->format($actual, $event);
- $expected = "0 ";
- self::assertSame($expected, $actual);
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/php/renderers/LoggerRendererMapTest.php
----------------------------------------------------------------------
diff --git a/src/test/php/renderers/LoggerRendererMapTest.php b/src/test/php/renderers/LoggerRendererMapTest.php
deleted file mode 100644
index 030f4b5..0000000
--- a/src/test/php/renderers/LoggerRendererMapTest.php
+++ /dev/null
@@ -1,243 +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 renderers
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version $Revision$
- * @link http://logging.apache.org/log4php
- */
-
-/** Renders everything as 'foo'. */
-class FooRenderer implements LoggerRenderer {
- public function render($input) {
- return 'foo';
- }
-}
-
-class InvalidCostumObjectRenderer { }
-
-class Fruit3 {
- public $test1 = 'test1';
- public $test2 = 'test2';
- public $test3 = 'test3';
-}
-
-class Fruit3Descendant extends Fruit3 {
-}
-
-class FruitRenderer3 implements LoggerRenderer {
- public function render($fruit) {
- return $fruit->test1 . ',' . $fruit->test2 . ',' . $fruit->test3;
- }
-}
-
-class SampleObject {
-}
-
-/**
- * @group renderers
- */
-class LoggerRendererMapTest extends PHPUnit_Framework_TestCase {
-
- public function testDefaults() {
-
- $map = new LoggerRendererMap();
- $actual = $map->getByClassName('Exception');
- self::assertInstanceOf('LoggerRendererException', $actual);
-
- // Check non-configured objects return null
- self::assertNull($map->getByObject(new stdClass()));
- self::assertNull($map->getByClassName('stdClass'));
- }
-
- public function testClear()
- {
- $map = new LoggerRendererMap();
- $map->clear(); // This should clear the map and remove default renderers
- self::assertNull($map->getByClassName('Exception'));
- }
-
- public function testFindAndRender()
- {
- $map = new LoggerRendererMap();
- $map->addRenderer('Fruit3', 'FruitRenderer3');
-
- $fruit = new Fruit3();
- $descendant = new Fruit3Descendant();
-
- // Check rendering of fruit
- $actual = $map->findAndRender($fruit);
- $expected = 'test1,test2,test3';
- self::assertSame($expected, $actual);
-
- $actual = $map->getByObject($fruit);
- self::assertInstanceOf('FruitRenderer3', $actual);
-
- // Check rendering of fruit's descendant
- $actual = $map->findAndRender($descendant);
- $expected = 'test1,test2,test3';
- self::assertSame($expected, $actual);
-
- $actual = $map->getByObject($descendant);
- self::assertInstanceOf('FruitRenderer3', $actual);
-
- // Test rendering null returns null
- self::assertNull($map->findAndRender(null));
- }
-
- /**
- * Try adding a non-existant class as renderer.
- * @expectedException PHPUnit_Framework_Error
- * @expectedExceptionMessage Failed adding renderer. Rendering class [DoesNotExist] not found.
- */
- public function testAddRendererError1()
- {
- $map = new LoggerRendererMap();
- $map->addRenderer('Fruit3', 'DoesNotExist');
- }
-
- /**
- * Try adding a class which does not implement LoggerRenderer as renderer.
- * @expectedException PHPUnit_Framework_Error
- * @expectedExceptionMessage Failed adding renderer. Rendering class [stdClass] does not implement the LoggerRenderer interface.
- */
- public function testAddRendererError2()
- {
- $map = new LoggerRendererMap();
- $map->addRenderer('Fruit3', 'stdClass');
- }
-
- public function testAddRendererError3()
- {
- $map = new LoggerRendererMap();
- @$map->addRenderer('Fruit3', 'stdClass');
- self::assertNull($map->getByClassName('Fruit3'));
-
- @$map->addRenderer('Fruit3', 'DoesNotExist');
- self::assertNull($map->getByClassName('Fruit3'));
- }
-
- /**
- * Try setting a non-existant class as default renderer.
- * @expectedException PHPUnit_Framework_Error
- * @expectedExceptionMessage Failed setting default renderer. Rendering class [DoesNotExist] not found.
- */
- public function testSetDefaultRendererError1()
- {
- $map = new LoggerRendererMap();
- $map->setDefaultRenderer('DoesNotExist');
- }
-
- /**
- * Try setting a class which does not implement LoggerRenderer as default renderer.
- * @expectedException PHPUnit_Framework_Error
- * @expectedExceptionMessage Failed setting default renderer. Rendering class [stdClass] does not implement the LoggerRenderer interface.
- */
- public function testSetDefaultRendererError2()
- {
- $map = new LoggerRendererMap();
- $map->setDefaultRenderer('stdClass');
- }
-
- public function testSetDefaultRendererError3()
- {
- $map = new LoggerRendererMap();
- $expected = $map->getDefaultRenderer();
-
- @$map->setDefaultRenderer('stdClass');
- $actual = $map->getDefaultRenderer();
- self::assertSame($expected, $actual);
-
- @$map->setDefaultRenderer('DoesNotExist');
- $actual = $map->getDefaultRenderer();
- self::assertSame($expected, $actual);
- }
-
- public function testFetchingRenderer()
- {
- $map = new LoggerRendererMap();
- $map->addRenderer('Fruit3', 'FruitRenderer3');
- }
-
- public function testDefaultRenderer()
- {
- $fruit = new Fruit3();
-
- $map = new LoggerRendererMap();
- $actual = $map->findAndRender($fruit);
-
- $defaultRenderer = new LoggerRendererDefault();
- $expected = $defaultRenderer->render($fruit);
- self::assertSame($expected, $actual);
- }
-
- public function testOverrideDefaultRenderer()
- {
- $map = new LoggerRendererMap();
- $default = $map->getDefaultRenderer();
-
- $array = array(1, 2, 3);
-
- $actual = $map->findAndRender($array);
- $expected = print_r($array, true);
- self::assertSame($actual, $expected);
-
- // Now switch the default renderer
- $map->setDefaultRenderer('FooRenderer');
- $actual = $map->findAndRender($array);
- $expected = 'foo';
- self::assertSame($actual, $expected);
- }
-
- public function testGetByObjectCrap()
- {
- $map = new LoggerRendererMap();
-
- // Non object input should always return null
- self::assertNull($map->getByObject(null));
- self::assertNull($map->getByObject(array()));
- self::assertNull($map->getByObject('sdasda'));
- }
-
- public function testXMLConfig()
- {
- $map = Logger::getHierarchy()->getRendererMap();
- Logger::resetConfiguration();
- self::assertInstanceOf('LoggerRendererDefault', $map->getDefaultRenderer());
-
- Logger::configure(PHPUNIT_CONFIG_DIR . '/renderers/config_default_renderer.xml');
- self::assertInstanceOf('FruitRenderer3', $map->getDefaultRenderer());
-
- Logger::resetConfiguration();
- self::assertInstanceOf('LoggerRendererDefault', $map->getDefaultRenderer());
- }
-
- public function testExceptionRenderer()
- {
- $ex = new LoggerException("This is a test");
-
- $map = new LoggerRendererMap();
- $actual = $map->findAndRender($ex);
- $expected = (string) $ex;
-
- self::assertSame($expected, $actual);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/resources/configs/adapters/ini/config_invalid_appender_declaration_1.ini
----------------------------------------------------------------------
diff --git a/src/test/resources/configs/adapters/ini/config_invalid_appender_declaration_1.ini b/src/test/resources/configs/adapters/ini/config_invalid_appender_declaration_1.ini
deleted file mode 100644
index 4b29374..0000000
--- a/src/test/resources/configs/adapters/ini/config_invalid_appender_declaration_1.ini
+++ /dev/null
@@ -1,24 +0,0 @@
-;
-; 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.
-;
-
-log4php.rootLogger = DEBUG, default
-
-log4php.appender.default = LoggerAppenderEcho
-
-# invalid appender line should trigger warning
-log4php.appender.default.layout.param.bla = LoggerLayoutTTCC
-
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/resources/configs/adapters/ini/config_invalid_appender_declaration_2.ini
----------------------------------------------------------------------
diff --git a/src/test/resources/configs/adapters/ini/config_invalid_appender_declaration_2.ini b/src/test/resources/configs/adapters/ini/config_invalid_appender_declaration_2.ini
deleted file mode 100644
index d36aa43..0000000
--- a/src/test/resources/configs/adapters/ini/config_invalid_appender_declaration_2.ini
+++ /dev/null
@@ -1,24 +0,0 @@
-;
-; 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.
-;
-
-log4php.rootLogger = DEBUG, default
-
-log4php.appender.default = LoggerAppenderEcho
-
-# invalid appender line should trigger warning
-log4php.appender.default.not-layout.param = LoggerLayoutTTCC
-
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/resources/configs/adapters/ini/config_invalid_syntax.ini
----------------------------------------------------------------------
diff --git a/src/test/resources/configs/adapters/ini/config_invalid_syntax.ini b/src/test/resources/configs/adapters/ini/config_invalid_syntax.ini
deleted file mode 100644
index 9971ea2..0000000
--- a/src/test/resources/configs/adapters/ini/config_invalid_syntax.ini
+++ /dev/null
@@ -1,19 +0,0 @@
-;
-; 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.
-;
-
-not a valid ini file ()
-
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/resources/configs/adapters/ini/config_valid.ini
----------------------------------------------------------------------
diff --git a/src/test/resources/configs/adapters/ini/config_valid.ini b/src/test/resources/configs/adapters/ini/config_valid.ini
deleted file mode 100644
index 5e2a6d9..0000000
--- a/src/test/resources/configs/adapters/ini/config_valid.ini
+++ /dev/null
@@ -1,41 +0,0 @@
-;
-; 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.
-;
-
-log4php.rootLogger = DEBUG, default
-
-log4php.appender.default = LoggerAppenderEcho
-log4php.appender.default.layout = LoggerLayoutTTCC
-
-log4php.appender.file = LoggerAppenderDailyFile
-log4php.appender.file.layout = LoggerLayoutPattern
-log4php.appender.file.layout.conversionPattern = "%d{ISO8601} [%p] %c: %m (at %F line %L)%n"
-log4php.appender.file.datePattern = Ymd
-log4php.appender.file.file = target/examples/daily_%s.log
-log4php.appender.file.threshold = warn
-
-log4php.logger.foo = warn, default
-
-log4php.logger.foo.bar = debug, file
-log4php.additivity.foo.bar = "true"
-
-log4php.logger.foo.bar.baz = trace, default, file
-log4php.additivity.foo.bar.baz = "false"
-
-log4php.renderer.Fruit = FruitRenderer
-log4php.renderer.Beer = BeerRenderer
-
-log4php.threshold = debug
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/resources/configs/adapters/ini/values.ini
----------------------------------------------------------------------
diff --git a/src/test/resources/configs/adapters/ini/values.ini b/src/test/resources/configs/adapters/ini/values.ini
deleted file mode 100644
index bd4239a..0000000
--- a/src/test/resources/configs/adapters/ini/values.ini
+++ /dev/null
@@ -1,25 +0,0 @@
-;
-; 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.
-;
-
-unquoted_true = true
-unquoted_false = false
-unquoted_yes = true
-unquoted_no = false
-quoted_true = "true"
-quoted_false = "false"
-unquoted_one = 1
-unquoted_zero = 0
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/resources/configs/adapters/php/config_empty.php
----------------------------------------------------------------------
diff --git a/src/test/resources/configs/adapters/php/config_empty.php b/src/test/resources/configs/adapters/php/config_empty.php
deleted file mode 100644
index 7b0b37c..0000000
--- a/src/test/resources/configs/adapters/php/config_empty.php
+++ /dev/null
@@ -1,28 +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
- */
-
-// Empty config
-
-?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/resources/configs/adapters/php/config_invalid_syntax.php
----------------------------------------------------------------------
diff --git a/src/test/resources/configs/adapters/php/config_invalid_syntax.php b/src/test/resources/configs/adapters/php/config_invalid_syntax.php
deleted file mode 100644
index bd0220f..0000000
--- a/src/test/resources/configs/adapters/php/config_invalid_syntax.php
+++ /dev/null
@@ -1,42 +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
- */
-
-return array(
- 'rootLogger' => array(
- 'level' => 'info',
- 'appenders' => array('default')
- ),
- 'appenders' => array(
- 'default' => array(
- 'class' => 'LoggerAppenderEcho',
- 'layout' => array(
- 'class' => 'LoggerLayoutSimple'
- )
- )
- )
-
-// Invalid file - no closing brace.
-
-?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/resources/configs/adapters/php/config_not_an_array.php
----------------------------------------------------------------------
diff --git a/src/test/resources/configs/adapters/php/config_not_an_array.php b/src/test/resources/configs/adapters/php/config_not_an_array.php
deleted file mode 100644
index 4ed942c..0000000
--- a/src/test/resources/configs/adapters/php/config_not_an_array.php
+++ /dev/null
@@ -1,29 +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
- */
-
-// Not an array
-return new Exception();
-
-?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/resources/configs/adapters/php/config_valid.php
----------------------------------------------------------------------
diff --git a/src/test/resources/configs/adapters/php/config_valid.php b/src/test/resources/configs/adapters/php/config_valid.php
deleted file mode 100644
index 176a704..0000000
--- a/src/test/resources/configs/adapters/php/config_valid.php
+++ /dev/null
@@ -1,42 +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
- */
-
-return array(
- 'rootLogger' => array(
- 'level' => 'info',
- 'appenders' => array('default')
- ),
- 'appenders' => array(
- 'default' => array(
- 'class' => 'LoggerAppenderEcho',
- 'layout' => array(
- 'class' => 'LoggerLayoutSimple'
- )
- )
- )
-)
-;
-
-?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/resources/configs/adapters/xml/config_duplicate_logger.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/configs/adapters/xml/config_duplicate_logger.xml b/src/test/resources/configs/adapters/xml/config_duplicate_logger.xml
deleted file mode 100644
index fde2223..0000000
--- a/src/test/resources/configs/adapters/xml/config_duplicate_logger.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
-
- <appender name="default" class="LoggerAppenderEcho">
- <layout class="LoggerLayoutSimple"/>
- </appender>
-
- <!-- Duplicate logger -->
- <logger name="foo">
- <level value="info" />
- <appender_ref ref="default" />
- </logger>
-
- <logger name="foo">
- <level value="warn" />
- <appender_ref ref="default" />
- </logger>
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="default" />
- </root>
-</configuration>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/resources/configs/adapters/xml/config_duplicate_renderer.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/configs/adapters/xml/config_duplicate_renderer.xml b/src/test/resources/configs/adapters/xml/config_duplicate_renderer.xml
deleted file mode 100644
index a9310ad..0000000
--- a/src/test/resources/configs/adapters/xml/config_duplicate_renderer.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration>
- <!-- Duplicate renderer -->
- <renderer renderedClass="Fruit" renderingClass="FruitRenderer1" />
- <renderer renderedClass="Fruit" renderingClass="FruitRenderer2" />
- <renderer renderedClass="Beer" renderingClass="BeerRenderer" />
- <appender name="default" class="LoggerAppenderEcho">
- <layout class="LoggerLayoutSimple"/>
- </appender>
- <root>
- <level value="DEBUG" />
- <appender_ref ref="default" />
- </root>
-</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/resources/configs/adapters/xml/config_invalid_syntax.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/configs/adapters/xml/config_invalid_syntax.xml b/src/test/resources/configs/adapters/xml/config_invalid_syntax.xml
deleted file mode 100644
index f367fbf..0000000
--- a/src/test/resources/configs/adapters/xml/config_invalid_syntax.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
- <appender name="default" class="LoggerAppenderEcho">
- <layout class="LoggerLayoutSimple"/>
- </appender>
-
- <!-- Duplicate logger -->
- <logger name="foo">
- <level value="info" />
- <appender_ref ref="default" />
- </logger>
-
- <logger name="foo">
- <level value="warn" />
- <appender_ref ref="default" />
- </logger>
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="default" />
- </root>
-
- <!-- Invalid XML file for testing -->
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/resources/configs/adapters/xml/config_valid.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/configs/adapters/xml/config_valid.xml b/src/test/resources/configs/adapters/xml/config_valid.xml
deleted file mode 100644
index 70f06c4..0000000
--- a/src/test/resources/configs/adapters/xml/config_valid.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
- <renderer renderedClass="Fruit" renderingClass="FruitRenderer" />
- <renderer renderedClass="Beer" renderingClass="BeerRenderer" />
- <appender name="default" class="LoggerAppenderEcho">
- <layout class="LoggerLayoutTTCC"/>
- <filter class="LoggerFilterLevelRange">
- <param name="levelMin" value="ERROR" />
- <param name="levelMax" value="FATAL" />
- <param name="acceptOnMatch" value="false" />
- </filter>
- <filter class="LoggerFilterDenyAll" />
- </appender>
- <appender name="file" class="LoggerAppenderDailyFile" threshold="warn">
- <param name="datePattern" value="Ymd" />
- <param name="file" value="target/examples/daily_%s.log" />
- <layout class="LoggerLayoutPattern">
- <param name="conversionPattern" value= "%d{ISO8601} [%p] %c: %m (at %F line %L)%n" />
- </layout>
- </appender>
- <logger name="foo.bar.baz" additivity="false">
- <level value="trace" />
- <appender_ref ref="default" />
- </logger>
- <logger name="foo.bar" additivity="true">
- <level value="debug" />
- <appender_ref ref="file" />
- </logger>
- <logger name="foo">
- <level value="warn" />
- <appender_ref ref="default" />
- <appender_ref ref="file" />
- </logger>
- <root>
- <level value="DEBUG" />
- <appender_ref ref="default" />
- </root>
-</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/resources/configs/adapters/xml/config_valid_underscore.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/configs/adapters/xml/config_valid_underscore.xml b/src/test/resources/configs/adapters/xml/config_valid_underscore.xml
deleted file mode 100644
index 020530f..0000000
--- a/src/test/resources/configs/adapters/xml/config_valid_underscore.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<!-- Same as config_valid.xml but uses appender-ref instead of appender_ref -->
-
-<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
- <renderer renderedClass="Fruit" renderingClass="FruitRenderer" />
- <renderer renderedClass="Beer" renderingClass="BeerRenderer" />
- <appender name="default" class="LoggerAppenderEcho">
- <layout class="LoggerLayoutTTCC"/>
- <filter class="LoggerFilterLevelRange">
- <param name="levelMin" value="ERROR" />
- <param name="levelMax" value="FATAL" />
- <param name="acceptOnMatch" value="false" />
- </filter>
- <filter class="LoggerFilterDenyAll" />
- </appender>
- <appender name="file" class="LoggerAppenderDailyFile" threshold="warn">
- <param name="datePattern" value="Ymd" />
- <param name="file" value="target/examples/daily_%s.log" />
- <layout class="LoggerLayoutPattern">
- <param name="conversionPattern" value= "%d{ISO8601} [%p] %c: %m (at %F line %L)%n" />
- </layout>
- </appender>
- <logger name="foo.bar.baz" additivity="false">
- <level value="trace" />
- <appender-ref ref="default" />
- </logger>
- <logger name="foo.bar" additivity="true">
- <level value="debug" />
- <appender-ref ref="file" />
- </logger>
- <logger name="foo">
- <level value="warn" />
- <appender-ref ref="default" />
- <appender-ref ref="file" />
- </logger>
- <root>
- <level value="DEBUG" />
- <appender-ref ref="default" />
- </root>
-</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/resources/configs/appenders/config_invalid_appender_class.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/configs/appenders/config_invalid_appender_class.xml b/src/test/resources/configs/appenders/config_invalid_appender_class.xml
deleted file mode 100644
index db3ccf0..0000000
--- a/src/test/resources/configs/appenders/config_invalid_appender_class.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php" threshold="debug">
- <appender name="foo" class="stdClass"/>
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="default" />
- </root>
-</configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/test/resources/configs/appenders/config_invalid_filter_class.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/configs/appenders/config_invalid_filter_class.xml b/src/test/resources/configs/appenders/config_invalid_filter_class.xml
deleted file mode 100644
index eb0364f..0000000
--- a/src/test/resources/configs/appenders/config_invalid_filter_class.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<configuration xmlns="http://logging.apache.org/log4php">
- <appender name="foo" class="LoggerAppenderConsole">
- <filter class="stdClass" />
- </appender>
-
- <root>
- <level value="DEBUG" />
- <appender_ref ref="foo" />
- </root>
-</configuration>