mirror of
https://github.com/friendica/friendica
synced 2025-01-19 14:59:46 +00:00
Clean static private properties of LoggerManager after test
This commit is contained in:
parent
c1dde29ef6
commit
39088ab003
1 changed files with 24 additions and 24 deletions
|
@ -23,30 +23,30 @@ class LoggerManagerTest extends TestCase
|
|||
{
|
||||
public function testGetLoggerReturnsPsrLogger(): void
|
||||
{
|
||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||
$reflectionProperty->setAccessible(true);
|
||||
$reflectionProperty->setValue(null, null);
|
||||
|
||||
$factory = new LoggerManager(
|
||||
$this->createStub(IManageConfigValues::class),
|
||||
$this->createStub(LoggerFactory::class)
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(LoggerInterface::class, $factory->getLogger());
|
||||
|
||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||
$reflectionProperty->setAccessible(true);
|
||||
$reflectionProperty->setValue(null, null);
|
||||
}
|
||||
|
||||
public function testGetLoggerReturnsSameObject(): void
|
||||
{
|
||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||
$reflectionProperty->setAccessible(true);
|
||||
$reflectionProperty->setValue(null, null);
|
||||
|
||||
$factory = new LoggerManager(
|
||||
$this->createStub(IManageConfigValues::class),
|
||||
$this->createStub(LoggerFactory::class)
|
||||
);
|
||||
|
||||
$this->assertSame($factory->getLogger(), $factory->getLogger());
|
||||
|
||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||
$reflectionProperty->setAccessible(true);
|
||||
$reflectionProperty->setValue(null, null);
|
||||
}
|
||||
|
||||
public function testGetLoggerWithDebugDisabledReturnsNullLogger(): void
|
||||
|
@ -56,16 +56,16 @@ class LoggerManagerTest extends TestCase
|
|||
['system', 'debugging', null, false],
|
||||
]);
|
||||
|
||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||
$reflectionProperty->setAccessible(true);
|
||||
$reflectionProperty->setValue(null, null);
|
||||
|
||||
$factory = new LoggerManager(
|
||||
$config,
|
||||
$this->createStub(LoggerFactory::class)
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(NullLogger::class, $factory->getLogger());
|
||||
|
||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||
$reflectionProperty->setAccessible(true);
|
||||
$reflectionProperty->setValue(null, null);
|
||||
}
|
||||
|
||||
public function testGetLoggerWithProfilerEnabledReturnsProfilerLogger(): void
|
||||
|
@ -76,16 +76,16 @@ class LoggerManagerTest extends TestCase
|
|||
['system', 'profiling', null, true],
|
||||
]);
|
||||
|
||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||
$reflectionProperty->setAccessible(true);
|
||||
$reflectionProperty->setValue(null, null);
|
||||
|
||||
$factory = new LoggerManager(
|
||||
$config,
|
||||
$this->createStub(LoggerFactory::class)
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(ProfilerLogger::class, $factory->getLogger());
|
||||
|
||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||
$reflectionProperty->setAccessible(true);
|
||||
$reflectionProperty->setValue(null, null);
|
||||
}
|
||||
|
||||
public function testChangeLogChannelReturnsDifferentLogger(): void
|
||||
|
@ -96,10 +96,6 @@ class LoggerManagerTest extends TestCase
|
|||
['system', 'profiling', null, true],
|
||||
]);
|
||||
|
||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||
$reflectionProperty->setAccessible(true);
|
||||
$reflectionProperty->setValue(null, null);
|
||||
|
||||
$factory = new LoggerManager(
|
||||
$config,
|
||||
$this->createStub(LoggerFactory::class)
|
||||
|
@ -110,6 +106,10 @@ class LoggerManagerTest extends TestCase
|
|||
$factory->changeLogChannel(LogChannel::CONSOLE);
|
||||
|
||||
$this->assertNotSame($logger1, $factory->getLogger());
|
||||
|
||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||
$reflectionProperty->setAccessible(true);
|
||||
$reflectionProperty->setValue(null, null);
|
||||
}
|
||||
|
||||
public function testChangeLogChannelToWorkerReturnsWorkerLogger(): void
|
||||
|
@ -120,10 +120,6 @@ class LoggerManagerTest extends TestCase
|
|||
['system', 'profiling', null, true],
|
||||
]);
|
||||
|
||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||
$reflectionProperty->setAccessible(true);
|
||||
$reflectionProperty->setValue(null, null);
|
||||
|
||||
$factory = new LoggerManager(
|
||||
$config,
|
||||
$this->createStub(LoggerFactory::class)
|
||||
|
@ -132,5 +128,9 @@ class LoggerManagerTest extends TestCase
|
|||
$factory->changeLogChannel(LogChannel::WORKER);
|
||||
|
||||
$this->assertInstanceOf(WorkerLogger::class, $factory->getLogger());
|
||||
|
||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||
$reflectionProperty->setAccessible(true);
|
||||
$reflectionProperty->setValue(null, null);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue