mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-07 15:54:26 +02:00
Always return NullLogger if debug is disabled
This commit is contained in:
parent
4a8533aa11
commit
f65a838594
2 changed files with 35 additions and 5 deletions
|
@ -9,23 +9,35 @@ declare(strict_types=1);
|
|||
|
||||
namespace Friendica\Test\Unit\Core\Logger\Factory;
|
||||
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\Logger\Factory\LoggerFactory;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\NullLogger;
|
||||
|
||||
class LoggerFactoryTest extends TestCase
|
||||
{
|
||||
public function testLoggerFactoryCreateReturnsPsrLogger(): void
|
||||
public function testCreateReturnsPsrLogger(): void
|
||||
{
|
||||
$factory = new LoggerFactory();
|
||||
$factory = new LoggerFactory($this->createStub(IManageConfigValues::class));
|
||||
|
||||
$this->assertInstanceOf(LoggerInterface::class, $factory->create());
|
||||
}
|
||||
|
||||
public function testLoggerFactoryCreateReturnsSameObject(): void
|
||||
public function testCreateReturnsSameObject(): void
|
||||
{
|
||||
$factory = new LoggerFactory();
|
||||
$factory = new LoggerFactory($this->createStub(IManageConfigValues::class));
|
||||
|
||||
$this->assertSame($factory->create(), $factory->create());
|
||||
}
|
||||
|
||||
public function testCreateWithDebugDisabledReturnsNullLogger(): void
|
||||
{
|
||||
$config = $this->createStub(IManageConfigValues::class);
|
||||
$config->method('get')->willReturn(false);
|
||||
|
||||
$factory = new LoggerFactory($config);
|
||||
|
||||
$this->assertInstanceOf(NullLogger::class, $factory->create());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue