19declare(strict_types=1);
23use PHPUnit\Framework\TestCase;
32 $expected_logger = $this->createStub(LoggerInterface::class);
33 $expected_component =
'comp_id';
34 $expected_level_fectcher = $this->createStub(LevelFetcherInterface::class);
36 $internal_factory = $this->createMock(LazyInternalFactoryInterface::class);
38 ->expects($this->atLeastOnce())
39 ->method(
'getLazyGhost')
40 ->with($expected_component, $expected_level_fectcher)
41 ->willReturn($expected_logger);
43 $config_by_component = $this->createMock(ConfigByComponentInterface::class);
45 ->expects($this->never())
46 ->method($this->anything());
48 $level_fetcher_factory = $this->createMock(LevelFetcherFactoryInterface::class);
49 $level_fetcher_factory
50 ->expects($this->atLeastOnce())
51 ->method(
'componentLevelFetcher')
52 ->with($config_by_component, $expected_component)
53 ->willReturn($expected_level_fectcher);
55 $factory =
new LoggerFactory($internal_factory, $config_by_component, $level_fetcher_factory);
56 $actual_logger = $factory->getLazy($expected_component);
61 'This should return the logger from LazyInternalFactory'
This exists to encapsulate reading the level of a logger from the config, to be able to delay it as m...