logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ihabu...@apache.org
Subject svn commit: r1230529 - in /logging/log4php/trunk/src/test/php: LoggerConfiguratorTest.php LoggerLevelTest.php
Date Thu, 12 Jan 2012 13:38:17 GMT
Author: ihabunek
Date: Thu Jan 12 13:38:17 2012
New Revision: 1230529

URL: http://svn.apache.org/viewvc?rev=1230529&view=rev
Log:
Minor improvements to tests to reflect recent changes.

Modified:
    logging/log4php/trunk/src/test/php/LoggerConfiguratorTest.php
    logging/log4php/trunk/src/test/php/LoggerLevelTest.php

Modified: logging/log4php/trunk/src/test/php/LoggerConfiguratorTest.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/test/php/LoggerConfiguratorTest.php?rev=1230529&r1=1230528&r2=1230529&view=diff
==============================================================================
--- logging/log4php/trunk/src/test/php/LoggerConfiguratorTest.php (original)
+++ logging/log4php/trunk/src/test/php/LoggerConfiguratorTest.php Thu Jan 12 13:38:17 2012
@@ -51,10 +51,13 @@
  		$appenders = Logger::getRootLogger()->getAllAppenders();
  		$this->assertInternalType('array', $appenders);
  		$this->assertEquals(count($appenders), 1);
- 		$this->assertSame('default', $appenders[0]->getName());
  		
- 		$appender = $appenders[0];
+ 		$names = array_keys($appenders);
+ 		$this->assertSame('default', $names[0]);
+ 		
+ 		$appender = array_shift($appenders);
  		$this->assertInstanceOf('LoggerAppenderEcho', $appender);
+ 		$this->assertSame('default', $appender->getName());
  		
  		$layout = $appender->getLayout();
  		$this->assertInstanceOf('LoggerLayoutTTCC', $layout);

Modified: logging/log4php/trunk/src/test/php/LoggerLevelTest.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/test/php/LoggerLevelTest.php?rev=1230529&r1=1230528&r2=1230529&view=diff
==============================================================================
--- logging/log4php/trunk/src/test/php/LoggerLevelTest.php (original)
+++ logging/log4php/trunk/src/test/php/LoggerLevelTest.php Thu Jan 12 13:38:17 2012
@@ -27,58 +27,58 @@
  */
 class LoggerLevelTest extends PHPUnit_Framework_TestCase {
         
-	protected function doTestLevel($o, $code, $str, $syslog) {
-		self::assertTrue( $o instanceof LoggerLevel );
-		self::assertEquals( $o->toInt(), $code);
-		self::assertEquals( $o->toString(), $str);
-		self::assertEquals( $o->getSyslogEquivalent(), $syslog);
+	protected function doTestLevel($level, $code, $str, $syslog) {
+		self::assertTrue($level instanceof LoggerLevel);
+		self::assertEquals($level->toInt(), $code);
+		self::assertEquals($level->toString(), $str);
+		self::assertEquals($level->getSyslogEquivalent(), $syslog);
 	}
 
 	public function testLevelOff() {
-		$this->doTestLevel( LoggerLevel::getLevelOff(), LoggerLevel::OFF, 'OFF', 0 );
-		$this->doTestLevel( LoggerLevel::toLevel(LoggerLevel::OFF), LoggerLevel::OFF, 'OFF',
0 );
-		$this->doTestLevel( LoggerLevel::toLevel('OFF'), LoggerLevel::OFF, 'OFF', 0 );
+		$this->doTestLevel(LoggerLevel::getLevelOff(), LoggerLevel::OFF, 'OFF', LOG_ALERT);
+		$this->doTestLevel(LoggerLevel::toLevel(LoggerLevel::OFF), LoggerLevel::OFF, 'OFF',
LOG_ALERT);
+		$this->doTestLevel(LoggerLevel::toLevel('OFF'), LoggerLevel::OFF, 'OFF', LOG_ALERT);
     }
 
 	public function testLevelFatal() {
-		$this->doTestLevel( LoggerLevel::getLevelFatal(), LoggerLevel::FATAL, 'FATAL', 0 );
-		$this->doTestLevel( LoggerLevel::toLevel(LoggerLevel::FATAL), LoggerLevel::FATAL, 'FATAL',
0 );
-		$this->doTestLevel( LoggerLevel::toLevel('FATAL'), LoggerLevel::FATAL, 'FATAL', 0 );
+		$this->doTestLevel(LoggerLevel::getLevelFatal(), LoggerLevel::FATAL, 'FATAL', LOG_ALERT);
+		$this->doTestLevel(LoggerLevel::toLevel(LoggerLevel::FATAL), LoggerLevel::FATAL, 'FATAL',
LOG_ALERT);
+		$this->doTestLevel(LoggerLevel::toLevel('FATAL'), LoggerLevel::FATAL, 'FATAL', LOG_ALERT);
     }
 
 	public function testLevelError() {
-		$this->doTestLevel( LoggerLevel::getLevelError(), LoggerLevel::ERROR, 'ERROR', 3 );
-		$this->doTestLevel( LoggerLevel::toLevel(LoggerLevel::ERROR), LoggerLevel::ERROR, 'ERROR',
3 );
-		$this->doTestLevel( LoggerLevel::toLevel('ERROR'), LoggerLevel::ERROR, 'ERROR', 3 );
+		$this->doTestLevel(LoggerLevel::getLevelError(), LoggerLevel::ERROR, 'ERROR', LOG_ERR);
+		$this->doTestLevel(LoggerLevel::toLevel(LoggerLevel::ERROR), LoggerLevel::ERROR, 'ERROR',
LOG_ERR);
+		$this->doTestLevel(LoggerLevel::toLevel('ERROR'), LoggerLevel::ERROR, 'ERROR', LOG_ERR);
     }
 	
 	public function testLevelWarn() {
-		$this->doTestLevel( LoggerLevel::getLevelWarn(), LoggerLevel::WARN, 'WARN', 4 );
-		$this->doTestLevel( LoggerLevel::toLevel(LoggerLevel::WARN), LoggerLevel::WARN, 'WARN',
4 );
-		$this->doTestLevel( LoggerLevel::toLevel('WARN'), LoggerLevel::WARN, 'WARN', 4 );
+		$this->doTestLevel(LoggerLevel::getLevelWarn(), LoggerLevel::WARN, 'WARN', LOG_WARNING);
+		$this->doTestLevel(LoggerLevel::toLevel(LoggerLevel::WARN), LoggerLevel::WARN, 'WARN',
LOG_WARNING);
+		$this->doTestLevel(LoggerLevel::toLevel('WARN'), LoggerLevel::WARN, 'WARN', LOG_WARNING);
     }
 
 	public function testLevelInfo() {
-		$this->doTestLevel( LoggerLevel::getLevelInfo(), LoggerLevel::INFO, 'INFO', 6 );
-		$this->doTestLevel( LoggerLevel::toLevel(LoggerLevel::INFO), LoggerLevel::INFO, 'INFO',
6 );
-		$this->doTestLevel( LoggerLevel::toLevel('INFO'), LoggerLevel::INFO, 'INFO', 6 );
+		$this->doTestLevel(LoggerLevel::getLevelInfo(), LoggerLevel::INFO, 'INFO', LOG_INFO);
+		$this->doTestLevel(LoggerLevel::toLevel(LoggerLevel::INFO), LoggerLevel::INFO, 'INFO',
LOG_INFO);
+		$this->doTestLevel(LoggerLevel::toLevel('INFO'), LoggerLevel::INFO, 'INFO', LOG_INFO);
     }
 
 	public function testLevelDebug() {
-		$this->doTestLevel( LoggerLevel::getLevelDebug(), LoggerLevel::DEBUG, 'DEBUG', 7 );
-		$this->doTestLevel( LoggerLevel::toLevel(LoggerLevel::DEBUG), LoggerLevel::DEBUG, 'DEBUG',
7 );
-		$this->doTestLevel( LoggerLevel::toLevel('DEBUG'), LoggerLevel::DEBUG, 'DEBUG', 7 );
+		$this->doTestLevel(LoggerLevel::getLevelDebug(), LoggerLevel::DEBUG, 'DEBUG', LOG_DEBUG);
+		$this->doTestLevel(LoggerLevel::toLevel(LoggerLevel::DEBUG), LoggerLevel::DEBUG, 'DEBUG',
LOG_DEBUG);
+		$this->doTestLevel(LoggerLevel::toLevel('DEBUG'), LoggerLevel::DEBUG, 'DEBUG', LOG_DEBUG);
 	}
     
     public function testLevelTrace() {
-		$this->doTestLevel( LoggerLevel::getLevelTrace(), LoggerLevel::TRACE, 'TRACE', 7 );
-		$this->doTestLevel( LoggerLevel::toLevel(LoggerLevel::TRACE), LoggerLevel::TRACE, 'TRACE',
7 );
-		$this->doTestLevel( LoggerLevel::toLevel('TRACE'), LoggerLevel::TRACE, 'TRACE', 7 );
+		$this->doTestLevel(LoggerLevel::getLevelTrace(), LoggerLevel::TRACE, 'TRACE', LOG_DEBUG);
+		$this->doTestLevel(LoggerLevel::toLevel(LoggerLevel::TRACE), LoggerLevel::TRACE, 'TRACE',
LOG_DEBUG);
+		$this->doTestLevel(LoggerLevel::toLevel('TRACE'), LoggerLevel::TRACE, 'TRACE', LOG_DEBUG);
     }
 
 	public function testLevelAll() {
-		$this->doTestLevel( LoggerLevel::getLevelAll(), LoggerLevel::ALL, 'ALL', 7 );
-		$this->doTestLevel( LoggerLevel::toLevel(LoggerLevel::ALL), LoggerLevel::ALL, 'ALL',
7 );
-		$this->doTestLevel( LoggerLevel::toLevel('ALL'), LoggerLevel::ALL, 'ALL', 7 );
+		$this->doTestLevel(LoggerLevel::getLevelAll(), LoggerLevel::ALL, 'ALL', LOG_DEBUG);
+		$this->doTestLevel(LoggerLevel::toLevel(LoggerLevel::ALL), LoggerLevel::ALL, 'ALL',
LOG_DEBUG);
+		$this->doTestLevel(LoggerLevel::toLevel('ALL'), LoggerLevel::ALL, 'ALL', LOG_DEBUG);
     }
 }



Mime
View raw message