mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
peer review: added tests but not passed yet
This commit is contained in:
@@ -271,6 +271,8 @@ abstract class LogAPI
|
||||
// const LEVEL_ALERT = 'Alert';
|
||||
// const LEVEL_EMERGENCY = 'Emergency';
|
||||
|
||||
protected static $m_oMockMetaModelConfig = null;
|
||||
|
||||
protected static $aLevelsPriority = array(
|
||||
self::LEVEL_DEBUG => 100,
|
||||
self::LEVEL_OK => 150,
|
||||
@@ -285,6 +287,12 @@ abstract class LogAPI
|
||||
static::$m_oFileLog = new FileLog($sTargetFile);
|
||||
}
|
||||
|
||||
public static function MockStaticObjects($oFileLog, $oMetaModelConfig=null)
|
||||
{
|
||||
static::$m_oFileLog = $oFileLog;
|
||||
static::$m_oMockMetaModelConfig = $oMetaModelConfig;
|
||||
}
|
||||
|
||||
public static function Error($sMessage, $sChannel = null, $aContext = array())
|
||||
{
|
||||
static::Log(self::LEVEL_ERROR, $sMessage, $sChannel, $aContext);
|
||||
@@ -357,7 +365,7 @@ abstract class LogAPI
|
||||
*/
|
||||
private static function GetMinLogLevel($sChannel)
|
||||
{
|
||||
$oConfig = \MetaModel::GetConfig();
|
||||
$oConfig = (static::$m_oMockMetaModelConfig === null) ? static::$m_oMockMetaModelConfig : \MetaModel::GetConfig();
|
||||
if (!$oConfig instanceof Config)
|
||||
{
|
||||
return self::LEVEL_OK;
|
||||
|
||||
Reference in New Issue
Block a user