mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-17 04:15:15 +02:00
LoggerFactory can create ProfilerLogger
This commit is contained in:
parent
f65a838594
commit
96af0e6ebb
2 changed files with 41 additions and 3 deletions
|
@ -11,6 +11,7 @@ namespace Friendica\Test\Unit\Core\Logger\Factory;
|
|||
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\Logger\Factory\LoggerFactory;
|
||||
use Friendica\Core\Logger\Type\ProfilerLogger;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\NullLogger;
|
||||
|
@ -34,10 +35,25 @@ class LoggerFactoryTest extends TestCase
|
|||
public function testCreateWithDebugDisabledReturnsNullLogger(): void
|
||||
{
|
||||
$config = $this->createStub(IManageConfigValues::class);
|
||||
$config->method('get')->willReturn(false);
|
||||
$config->method('get')->willReturnMap([
|
||||
['system', 'debugging', null, false],
|
||||
]);
|
||||
|
||||
$factory = new LoggerFactory($config);
|
||||
|
||||
$this->assertInstanceOf(NullLogger::class, $factory->create());
|
||||
}
|
||||
|
||||
public function testCreateWithProfilerEnabledReturnsProfilerLogger(): void
|
||||
{
|
||||
$config = $this->createStub(IManageConfigValues::class);
|
||||
$config->method('get')->willReturnMap([
|
||||
['system', 'debugging', null, false],
|
||||
['system', 'profiling', null, true],
|
||||
]);
|
||||
|
||||
$factory = new LoggerFactory($config);
|
||||
|
||||
$this->assertInstanceOf(ProfilerLogger::class, $factory->create());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue