mirror of
https://github.com/friendica/friendica
synced 2025-01-19 17:39: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
|
public function testGetLoggerReturnsPsrLogger(): void
|
||||||
{
|
{
|
||||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
|
||||||
$reflectionProperty->setAccessible(true);
|
|
||||||
$reflectionProperty->setValue(null, null);
|
|
||||||
|
|
||||||
$factory = new LoggerManager(
|
$factory = new LoggerManager(
|
||||||
$this->createStub(IManageConfigValues::class),
|
$this->createStub(IManageConfigValues::class),
|
||||||
$this->createStub(LoggerFactory::class)
|
$this->createStub(LoggerFactory::class)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertInstanceOf(LoggerInterface::class, $factory->getLogger());
|
$this->assertInstanceOf(LoggerInterface::class, $factory->getLogger());
|
||||||
|
|
||||||
|
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||||
|
$reflectionProperty->setAccessible(true);
|
||||||
|
$reflectionProperty->setValue(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetLoggerReturnsSameObject(): void
|
public function testGetLoggerReturnsSameObject(): void
|
||||||
{
|
{
|
||||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
|
||||||
$reflectionProperty->setAccessible(true);
|
|
||||||
$reflectionProperty->setValue(null, null);
|
|
||||||
|
|
||||||
$factory = new LoggerManager(
|
$factory = new LoggerManager(
|
||||||
$this->createStub(IManageConfigValues::class),
|
$this->createStub(IManageConfigValues::class),
|
||||||
$this->createStub(LoggerFactory::class)
|
$this->createStub(LoggerFactory::class)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertSame($factory->getLogger(), $factory->getLogger());
|
$this->assertSame($factory->getLogger(), $factory->getLogger());
|
||||||
|
|
||||||
|
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||||
|
$reflectionProperty->setAccessible(true);
|
||||||
|
$reflectionProperty->setValue(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetLoggerWithDebugDisabledReturnsNullLogger(): void
|
public function testGetLoggerWithDebugDisabledReturnsNullLogger(): void
|
||||||
|
@ -56,16 +56,16 @@ class LoggerManagerTest extends TestCase
|
||||||
['system', 'debugging', null, false],
|
['system', 'debugging', null, false],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
|
||||||
$reflectionProperty->setAccessible(true);
|
|
||||||
$reflectionProperty->setValue(null, null);
|
|
||||||
|
|
||||||
$factory = new LoggerManager(
|
$factory = new LoggerManager(
|
||||||
$config,
|
$config,
|
||||||
$this->createStub(LoggerFactory::class)
|
$this->createStub(LoggerFactory::class)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertInstanceOf(NullLogger::class, $factory->getLogger());
|
$this->assertInstanceOf(NullLogger::class, $factory->getLogger());
|
||||||
|
|
||||||
|
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||||
|
$reflectionProperty->setAccessible(true);
|
||||||
|
$reflectionProperty->setValue(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetLoggerWithProfilerEnabledReturnsProfilerLogger(): void
|
public function testGetLoggerWithProfilerEnabledReturnsProfilerLogger(): void
|
||||||
|
@ -76,16 +76,16 @@ class LoggerManagerTest extends TestCase
|
||||||
['system', 'profiling', null, true],
|
['system', 'profiling', null, true],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
|
||||||
$reflectionProperty->setAccessible(true);
|
|
||||||
$reflectionProperty->setValue(null, null);
|
|
||||||
|
|
||||||
$factory = new LoggerManager(
|
$factory = new LoggerManager(
|
||||||
$config,
|
$config,
|
||||||
$this->createStub(LoggerFactory::class)
|
$this->createStub(LoggerFactory::class)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertInstanceOf(ProfilerLogger::class, $factory->getLogger());
|
$this->assertInstanceOf(ProfilerLogger::class, $factory->getLogger());
|
||||||
|
|
||||||
|
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||||
|
$reflectionProperty->setAccessible(true);
|
||||||
|
$reflectionProperty->setValue(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testChangeLogChannelReturnsDifferentLogger(): void
|
public function testChangeLogChannelReturnsDifferentLogger(): void
|
||||||
|
@ -96,10 +96,6 @@ class LoggerManagerTest extends TestCase
|
||||||
['system', 'profiling', null, true],
|
['system', 'profiling', null, true],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
|
||||||
$reflectionProperty->setAccessible(true);
|
|
||||||
$reflectionProperty->setValue(null, null);
|
|
||||||
|
|
||||||
$factory = new LoggerManager(
|
$factory = new LoggerManager(
|
||||||
$config,
|
$config,
|
||||||
$this->createStub(LoggerFactory::class)
|
$this->createStub(LoggerFactory::class)
|
||||||
|
@ -110,6 +106,10 @@ class LoggerManagerTest extends TestCase
|
||||||
$factory->changeLogChannel(LogChannel::CONSOLE);
|
$factory->changeLogChannel(LogChannel::CONSOLE);
|
||||||
|
|
||||||
$this->assertNotSame($logger1, $factory->getLogger());
|
$this->assertNotSame($logger1, $factory->getLogger());
|
||||||
|
|
||||||
|
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
||||||
|
$reflectionProperty->setAccessible(true);
|
||||||
|
$reflectionProperty->setValue(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testChangeLogChannelToWorkerReturnsWorkerLogger(): void
|
public function testChangeLogChannelToWorkerReturnsWorkerLogger(): void
|
||||||
|
@ -120,10 +120,6 @@ class LoggerManagerTest extends TestCase
|
||||||
['system', 'profiling', null, true],
|
['system', 'profiling', null, true],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$reflectionProperty = new \ReflectionProperty(LoggerManager::class, 'logger');
|
|
||||||
$reflectionProperty->setAccessible(true);
|
|
||||||
$reflectionProperty->setValue(null, null);
|
|
||||||
|
|
||||||
$factory = new LoggerManager(
|
$factory = new LoggerManager(
|
||||||
$config,
|
$config,
|
||||||
$this->createStub(LoggerFactory::class)
|
$this->createStub(LoggerFactory::class)
|
||||||
|
@ -132,5 +128,9 @@ class LoggerManagerTest extends TestCase
|
||||||
$factory->changeLogChannel(LogChannel::WORKER);
|
$factory->changeLogChannel(LogChannel::WORKER);
|
||||||
|
|
||||||
$this->assertInstanceOf(WorkerLogger::class, $factory->getLogger());
|
$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