You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by gr...@apache.org on 2009/05/24 15:15:22 UTC

svn commit: r778140 - in /incubator/log4php/trunk/src/test/php/configurators: LoggerConfiguratorPhpTest.php test1.php

Author: grobmeier
Date: Sun May 24 13:15:22 2009
New Revision: 778140

URL: http://svn.apache.org/viewvc?rev=778140&view=rev
Log:
added simple php configurator test

Added:
    incubator/log4php/trunk/src/test/php/configurators/LoggerConfiguratorPhpTest.php
    incubator/log4php/trunk/src/test/php/configurators/test1.php

Added: incubator/log4php/trunk/src/test/php/configurators/LoggerConfiguratorPhpTest.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/test/php/configurators/LoggerConfiguratorPhpTest.php?rev=778140&view=auto
==============================================================================
--- incubator/log4php/trunk/src/test/php/configurators/LoggerConfiguratorPhpTest.php (added)
+++ incubator/log4php/trunk/src/test/php/configurators/LoggerConfiguratorPhpTest.php Sun May 24 13:15:22 2009
@@ -0,0 +1,46 @@
+<?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    SVN: $Id$
+ * @link       http://logging.apache.org/log4php
+ */
+
+class LoggerConfiguratorPhpTest extends PHPUnit_Framework_TestCase {
+        
+	protected function setUp() {
+		
+	}
+	
+	protected function tearDown() {
+		LoggerManager::resetConfiguration();
+	}
+        
+	public function testConfigure() {
+		LoggerConfiguratorPhp::configure('configurators/test1.php');
+		$hierarchy = LoggerManager::getLoggerRepository();
+		$root = $hierarchy->getRootLogger();
+		self::assertEquals(LoggerLevel::getLevelWarn(), $root->getLevel());
+		$appender = $root->getAppender("default");
+		self::assertTrue(is_a($appender, 'LoggerAppenderEcho'));
+		$layout = $appender->getLayout();
+		self::assertTrue(is_a($layout, 'LoggerLayoutSimple'));
+	}
+}

Added: incubator/log4php/trunk/src/test/php/configurators/test1.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/test/php/configurators/test1.php?rev=778140&view=auto
==============================================================================
--- incubator/log4php/trunk/src/test/php/configurators/test1.php (added)
+++ incubator/log4php/trunk/src/test/php/configurators/test1.php Sun May 24 13:15:22 2009
@@ -0,0 +1,34 @@
+<?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.
+ * 
+ */
+
+return array(
+     'threshold' => 'ALL',
+     'rootLogger' => array(
+        'level' => 'WARN',
+        'appenders' => array('default'),
+     ),
+     'appenders' => array(
+         'default' => array(
+             'class' => 'LoggerAppenderEcho',
+             'layout' => array(
+                 'class' => 'LoggerLayoutSimple'
+             ),
+         ),
+     ),
+ );
\ No newline at end of file