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