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 ma...@apache.org on 2006/01/14 18:04:59 UTC
svn commit: r369057 - in /logging/log4php/trunk/src/php5/tests:
LoggerBasicConfiguratorTestCase.php LoggerHierarchyTestCase.php
Author: marco
Date: Sat Jan 14 09:04:53 2006
New Revision: 369057
URL: http://svn.apache.org/viewcvs?rev=369057&view=rev
Log:
Tests added.
Modified:
logging/log4php/trunk/src/php5/tests/LoggerBasicConfiguratorTestCase.php
logging/log4php/trunk/src/php5/tests/LoggerHierarchyTestCase.php
Modified: logging/log4php/trunk/src/php5/tests/LoggerBasicConfiguratorTestCase.php
URL: http://svn.apache.org/viewcvs/logging/log4php/trunk/src/php5/tests/LoggerBasicConfiguratorTestCase.php?rev=369057&r1=369056&r2=369057&view=diff
==============================================================================
--- logging/log4php/trunk/src/php5/tests/LoggerBasicConfiguratorTestCase.php (original)
+++ logging/log4php/trunk/src/php5/tests/LoggerBasicConfiguratorTestCase.php Sat Jan 14 09:04:53 2006
@@ -44,6 +44,11 @@
$this->assertTrue($l instanceof LoggerLayoutTTCC);
}
+
+ protected function tearDown() {
+ LoggerManager::resetConfiguration();
+
+ }
}
?>
Modified: logging/log4php/trunk/src/php5/tests/LoggerHierarchyTestCase.php
URL: http://svn.apache.org/viewcvs/logging/log4php/trunk/src/php5/tests/LoggerHierarchyTestCase.php?rev=369057&r1=369056&r2=369057&view=diff
==============================================================================
--- logging/log4php/trunk/src/php5/tests/LoggerHierarchyTestCase.php (original)
+++ logging/log4php/trunk/src/php5/tests/LoggerHierarchyTestCase.php Sat Jan 14 09:04:53 2006
@@ -24,6 +24,9 @@
/** */
require_once 'PHPUnit2/Framework/TestCase.php';
+
+require_once(LOG4PHP_DIR . '/layouts/LoggerLayoutTTCC.php');
+require_once(LOG4PHP_DIR . '/appenders/LoggerAppenderConsole.php');
require_once LOG4PHP_DIR . '/LoggerHierarchy.php';
class LoggerHierarchyTestCase extends PHPUnit2_Framework_TestCase {
@@ -35,20 +38,37 @@
}
public function testIfLevelIsInitiallyLevelAll() {
- $this->assertEquals($this->loggerRoot->getLevel()->levelStr, 'ALL');
+ $this->assertEquals($this->hierarchy->getRootLogger()->getLevel()->levelStr, 'ALL');
}
public function testIfNameIsRoot() {
- $this->assertEquals($this->loggerRoot->getName(), 'root');
+ $this->assertEquals($this->hierarchy->getRootLogger()->getName(), 'root');
}
public function testIfParentIsNull() {
- $this->assertSame($this->loggerRoot->getParent(), null);
+ $this->assertSame($this->hierarchy->getRootLogger()->getParent(), null);
}
public function testSetParent() {
- $this->loggerRoot->setParent('dummy');
+ $this->hierarchy->getRootLogger()->setParent('dummy');
$this->testIfParentIsNull();
+ }
+
+ public function testResetConfiguration() {
+ $root = $this->hierarchy->getRootLogger();
+ $appender = new LoggerAppenderConsole('A1');
+ $root->addAppender($appender);
+ $logger = $this->hierarchy->getLogger('test');
+ $this->assertEquals(sizeof($this->hierarchy->getCurrentLoggers()), 1);
+ $this->hierarchy->resetConfiguration();
+ $this->assertEquals($this->hierarchy->getRootLogger()->getLevel()->levelStr, 'DEBUG');
+ $this->assertEquals($this->hierarchy->getThreshold()->levelStr, 'ALL');
+ $this->assertEquals(sizeof($this->hierarchy->getCurrentLoggers()), 1);
+ foreach($this->hierarchy->getCurrentLoggers() as $l) {
+ $this->assertEquals($l->getLevel(), null);
+ $this->assertTrue($l->getAdditivity());
+ $this->assertEquals(sizeof($l->getAllAppenders()), 0);
+ }
}
}