[TASK] Re-work/simplify copyright header in PHP files - Part 4
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / Log / Processor / ProcessorTest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Unit\Log\Processor;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Testcase for log processors.
19 *
20 * @author Ingo Renner <ingo@typo3.org>
21 */
22 class ProcessorTest extends \TYPO3\CMS\Core\Tests\UnitTestCase implements \TYPO3\CMS\Core\Log\Processor\ProcessorInterface {
23
24 /**
25 * @var bool
26 */
27 public $processorCalled = FALSE;
28
29 /**
30 * Processes a log record and adds server data.
31 *
32 * @param \TYPO3\CMS\Core\Log\LogRecord $logRecord The log record to process
33 * @return \TYPO3\CMS\Core\Log\LogRecord The processed log record with addtional data
34 */
35 public function processLogRecord(\TYPO3\CMS\Core\Log\LogRecord $logRecord) {
36 $this->processorCalled = TRUE;
37 return $logRecord;
38 }
39
40 /**
41 * @test
42 */
43 public function loggerExecutesProcessors() {
44 $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
45 $writer = new \TYPO3\CMS\Core\Log\Writer\NullWriter();
46 $level = \TYPO3\CMS\Core\Log\LogLevel::DEBUG;
47 $logger->addWriter($level, $writer);
48 $logger->addProcessor($level, $this);
49 $logger->warning('test');
50 $this->assertTrue($this->processorCalled);
51 }
52
53 }