‪TYPO3CMS  11.5
AbstractProcessorTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
28 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
29 
33 class ‪AbstractProcessorTest extends UnitTestCase
34 {
39  {
40  $this->expectException(InvalidLogProcessorConfigurationException::class);
41  $this->expectExceptionCode(1321696151);
42 
43  $invalidConfiguration = [
44  'foo' => 'bar',
45  ];
46  GeneralUtility::makeInstance(ProcessorFixture::class, $invalidConfiguration);
47  }
48 
52  public function ‪loggerExecutesProcessors(): void
53  {
54  $logger = new ‪Logger('test.core.log');
55  $writer = new ‪NullWriter();
56  $level = LogLevel::DEBUG;
57  $logRecord = new ‪LogRecord('dummy', $level, 'message');
58  $processor = $this->getMockBuilder(ProcessorInterface::class)
59  ->onlyMethods(['processLogRecord'])
60  ->getMock();
61  $processor->expects(self::once())->method('processLogRecord')->willReturn($logRecord);
62 
63  $logger->addWriter($level, $writer);
64  $logger->addProcessor($level, $processor);
65  $logger->warning('test');
66  }
67 }
‪TYPO3\CMS\Core\Tests\Unit\Log\Processor\AbstractProcessorTest\loggerExecutesProcessors
‪loggerExecutesProcessors()
Definition: AbstractProcessorTest.php:52
‪TYPO3\CMS\Core\Log\Processor\ProcessorInterface
Definition: ProcessorInterface.php:27
‪TYPO3\CMS\Core\Tests\Unit\Log\Processor
Definition: AbstractMemoryTest.php:18
‪TYPO3\CMS\Core\Tests\Unit\Log\Processor\AbstractProcessorTest\processorRefusesInvalidConfigurationOptions
‪processorRefusesInvalidConfigurationOptions()
Definition: AbstractProcessorTest.php:38
‪TYPO3\CMS\Core\Tests\Unit\Log\Processor\AbstractProcessorTest
Definition: AbstractProcessorTest.php:34
‪TYPO3\CMS\Core\Log\LogRecord
Definition: LogRecord.php:22
‪TYPO3\CMS\Core\Tests\Unit\Log\Fixtures\ProcessorFixture
Definition: ProcessorFixture.php:27
‪TYPO3\CMS\Core\Log\Logger
Definition: Logger.php:27
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50
‪TYPO3\CMS\Core\Log\Writer\NullWriter
Definition: NullWriter.php:24
‪TYPO3\CMS\Core\Log\Exception\InvalidLogProcessorConfigurationException
Definition: InvalidLogProcessorConfigurationException.php:23
‪TYPO3\CMS\Core\Log\LogLevel
Definition: LogLevel.php:24