Example #1
0
 /**
  * @test
  */
 public function configureLoggerPropertiesSetsValidConfiguration()
 {
     $expectedLogPath = '/var/apache/partnerportal/log/EsalesLog';
     $expectedLogLevelThreshold = \TYPO3\CMS\Core\Log\LogLevel::INFO;
     $expectedEmailLogLevelThreshold = \TYPO3\CMS\Core\Log\LogLevel::CRITICAL;
     $expectedEmailReceivers = 'bud@spencer.it,terence@hill.de';
     $loggerConfigurationMock = $this->getMockBuilder('Tx_PtExtbase_Logger_LoggerConfiguration')->setMethods(array('getLogLevelThreshold', 'getEmailLogLevelThreshold', 'weHaveAnyEmailReceivers', 'getEmailReceivers'))->getMock();
     $loggerConfigurationMock->expects($this->once())->method('getLogLevelThreshold')->will($this->returnValue($expectedLogLevelThreshold));
     $loggerConfigurationMock->expects($this->once())->method('getEmailLogLevelThreshold')->will($this->returnValue($expectedEmailLogLevelThreshold));
     $loggerConfigurationMock->expects($this->once())->method('weHaveAnyEmailReceivers')->will($this->returnValue(true));
     $loggerConfigurationMock->expects($this->once())->method('getEmailReceivers')->will($this->returnValue($expectedEmailReceivers));
     $this->proxy->_set('logFilePath', $expectedLogPath);
     $this->proxy->_set('loggerConfiguration', $loggerConfigurationMock);
     $this->proxy->_call('configureLoggerProperties');
     $this->assertArrayHasKey($expectedLogLevelThreshold, $GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration']);
     $this->assertSame($expectedLogPath, $GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'][$expectedLogLevelThreshold]['Tx_PtExtbase_Logger_Writer_FileWriter']['logFile']);
     $this->assertArrayHasKey($expectedEmailLogLevelThreshold, $GLOBALS['TYPO3_CONF_VARS']['LOG']['processorConfiguration']);
     $this->assertSame(array('receivers' => $expectedEmailReceivers), $GLOBALS['TYPO3_CONF_VARS']['LOG']['processorConfiguration'][$expectedEmailLogLevelThreshold]['Tx_PtExtbase_Logger_Processor_EmailProcessor']);
     $this->assertArrayHasKey(\TYPO3\CMS\Core\Log\LogLevel::DEBUG, $GLOBALS['TYPO3_CONF_VARS']['LOG']['processorConfiguration']);
     $this->assertArrayHasKey('PunktDe\\PtExtbase\\Logger\\Processor\\ReplaceComponentProcessor', $GLOBALS['TYPO3_CONF_VARS']['LOG']['processorConfiguration'][\TYPO3\CMS\Core\Log\LogLevel::DEBUG]);
 }