0
0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2024-11-22 16:02:36 +00:00
salesagility_SuiteCRM/tests/unit/phpunit/includes/SugarLogger/LoggerManagerTest.php
Dillon-Brown 26aab7535d Move test namespaces into autoload-dev
Signed-off-by: Dillon-Brown <dillon.brown@salesagility.com>
2021-09-08 16:49:16 +01:00

61 lines
1.4 KiB
PHP

<?php
use SuiteCRM\Test\SuitePHPUnitFrameworkTestCase;
/**
* Class LoggerManagerTest
*/
class LoggerManagerTest extends SuitePHPUnitFrameworkTestCase
{
/**
* @var LoggerManager
*/
private static $loggerManager;
protected function setUp(): void
{
parent::setUp();
if (self::$loggerManager === null) {
self::$loggerManager = LoggerManager::getLogger();
}
}
protected function tearDown(): void
{
self::$loggerManager = null;
parent::tearDown();
}
public function testLoggerLevels(): void
{
$loggerManager = self::$loggerManager;
$loggerManager::setLevelMapping('test', 125);
$loggerLevels = $loggerManager::getLoggerLevels();
self::assertArrayHasKey('test', $loggerLevels);
}
public function testGetLogLevel(): void
{
$logLevel = self::$loggerManager::getLogLevel();
self::assertEquals('fatal', $logLevel);
}
public function testGetAvailableLoggers(): void
{
$loggers = self::$loggerManager::getAvailableLoggers();
self::assertContains('SugarLogger', $loggers);
}
public function testSetLoggerLevel(): void
{
$loggerManager = self::$loggerManager;
$loggerManager->setLevel('debug');
$logLevel = $loggerManager::getLogLevel();
self::assertEquals('debug', $logLevel);
}
}