TASK: Provide already used logger

As we use the logger, we should inject it.
This commit is contained in:
Daniel Siepmann 2018-03-13 12:19:30 +01:00
parent 9e80574361
commit 6d7199ccf2
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
2 changed files with 16 additions and 0 deletions

View file

@ -37,6 +37,21 @@ class IndexFactory implements Singleton
*/ */
protected $configuration; protected $configuration;
/**
* @var \TYPO3\CMS\Core\Log\Logger
*/
protected $logger;
/**
* Inject log manager to get concrete logger from it.
*
* @param \TYPO3\CMS\Core\Log\LogManager $logManager
*/
public function injectLogger(\TYPO3\CMS\Core\Log\LogManager $logManager)
{
$this->logger = $logManager->getLogger(__CLASS__);
}
/** /**
* @param ConfigurationContainerInterface $configuration * @param ConfigurationContainerInterface $configuration
*/ */

View file

@ -38,6 +38,7 @@ class IndexFactoryTest extends AbstractUnitTestCase
$this->configuration = $this->getMockBuilder(ConfigurationContainerInterface::class)->getMock(); $this->configuration = $this->getMockBuilder(ConfigurationContainerInterface::class)->getMock();
$this->subject = new IndexFactory($this->configuration); $this->subject = new IndexFactory($this->configuration);
$this->subject->injectLogger($this->getMockedLogger());
} }
/** /**