peer review: added tests but not passed yet

This commit is contained in:
odain
2019-12-12 08:43:01 +01:00
parent 18db31f138
commit 6ec441e501
2 changed files with 129 additions and 1 deletions

View File

@@ -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;