Exemplo n.º 1
0
 /**
  * Test that a logger can be created.
  *
  * @dataProvider provideLogFilePaths()
  *
  * @param string $path
  * @param int    $count
  * @param string $class
  */
 public function testLoggerCreation($path, $count, $class)
 {
     $config = $this->createMock(Config::class);
     $config->expects($this->once())->method('getLogFilePath')->will($this->returnValue($path));
     $provider = new LoggerProvider($config);
     $this->assertCount($count, $provider->getHandlers());
     if (null === $class) {
         $this->assertNull($provider->getLogger());
     } else {
         $this->assertInstanceOf($class, $provider->getLogger());
     }
 }
Exemplo n.º 2
0
 /**
  * Get logger.
  *
  * @return null|LoggerInterface
  */
 public function getLogger()
 {
     if (null === $this->logger) {
         $provider = new LoggerProvider($this->config);
         $this->logger = $provider->getLogger();
     }
     return $this->logger;
 }