factory = new LoggerFactory(); } /** @test */ public function serviceIsCreated() { /** @var Logger $instance */ $instance = $this->factory->__invoke(new ServiceManager(), ''); $this->assertInstanceOf(LoggerInterface::class, $instance); $this->assertEquals('Logger', $instance->getName()); } /** @test */ public function nameIsSetFromOptions() { /** @var Logger $instance */ $instance = $this->factory->__invoke(new ServiceManager(), '', ['logger_name' => 'Foo']); $this->assertInstanceOf(LoggerInterface::class, $instance); $this->assertEquals('Foo', $instance->getName()); } /** @test */ public function serviceNameOverwritesOptionsLoggerName() { /** @var Logger $instance */ $instance = $this->factory->__invoke(new ServiceManager(), 'Logger_Shlink', ['logger_name' => 'Foo']); $this->assertInstanceOf(LoggerInterface::class, $instance); $this->assertEquals('Shlink', $instance->getName()); } }