TYPO3 CMS  TYPO3_6-2
LogManagerTest.php
Go to the documentation of this file.
1 <?php
3 
24 
28  protected $logManagerInstance = NULL;
29 
30  public function setUp() {
31  $this->logManagerInstance = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager');
32  }
33 
34  public function tearDown() {
35  \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager')->reset();
36  parent::tearDown();
37  }
38 
43  $this->assertInstanceOf('TYPO3\\CMS\\Core\\Log\\Logger', $this->logManagerInstance->getLogger('test'));
44  }
45 
50  $this->assertSame('test.a.b', $this->logManagerInstance->getLogger('test_a_b')->getName());
51  }
52 
57  $this->assertSame('test.a.b', $this->logManagerInstance->getLogger('test\\a\\b')->getName());
58  }
59 
64  $loggerName = $this->getUniqueId('test.core.log');
65  $this->logManagerInstance->registerLogger($loggerName);
66  $logger1 = $this->logManagerInstance->getLogger($loggerName);
67  $logger2 = $this->logManagerInstance->getLogger($loggerName);
68  $this->assertSame($logger1, $logger2);
69  }
70 
74  public function configuresLoggerWithConfiguredWriter() {
75  $component = 'test';
76  $writer = 'TYPO3\\CMS\\Core\\Log\\Writer\\NullWriter';
78  $GLOBALS['TYPO3_CONF_VARS']['LOG'][$component]['writerConfiguration'] = array(
79  $level => array(
80  $writer => array()
81  )
82  );
84  $logger = $this->logManagerInstance->getLogger($component);
85  $writers = $logger->getWriters();
86  $this->assertInstanceOf($writer, $writers[$level][0]);
87  }
88 
92  public function configuresLoggerWithConfiguredProcessor() {
93  $component = 'test';
94  $processor = 'TYPO3\\CMS\\Core\\Log\\Processor\\NullProcessor';
96  $GLOBALS['TYPO3_CONF_VARS']['LOG'][$component]['processorConfiguration'] = array(
97  $level => array(
98  $processor => array()
99  )
100  );
102  $logger = $this->logManagerInstance->getLogger($component);
103  $processors = $logger->getProcessors();
104  $this->assertInstanceOf($processor, $processors[$level][0]);
105  }
106 
107 }
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]