‪TYPO3CMS  9.5
AbstractProcessorTest.php
Go to the documentation of this file.
1 <?php
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  */
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20 
24 class ‪AbstractProcessorTest extends UnitTestCase
25 {
30  {
31  $this->expectException(InvalidLogProcessorConfigurationException::class);
32  $this->expectExceptionCode(1321696151);
33 
34  $invalidConfiguration = [
35  'foo' => 'bar'
36  ];
37  GeneralUtility::makeInstance(ProcessorFixture::class, $invalidConfiguration);
38  }
39 
43  public function ‪loggerExecutesProcessors()
44  {
45  $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
46  $writer = new \TYPO3\CMS\Core\Log\Writer\NullWriter();
48  $logRecord = new \TYPO3\CMS\Core\Log\LogRecord('dummy', $level, 'message');
49  $processor = $this->getMockBuilder(\‪TYPO3\CMS\Core\Log\Processor\ProcessorInterface::class)
50  ->setMethods(['processLogRecord'])
51  ->getMock();
52  $processor->expects($this->once())->method('processLogRecord')->willReturn($logRecord);
53 
54  $logger->addWriter($level, $writer);
55  $logger->addProcessor($level, $processor);
56  $logger->warning('test');
57  }
58 }
‪TYPO3\CMS\Core\Tests\Unit\Log\Processor\AbstractProcessorTest\loggerExecutesProcessors
‪loggerExecutesProcessors()
Definition: AbstractProcessorTest.php:43
‪TYPO3
‪TYPO3\CMS\Core\Tests\Unit\Log\Processor
Definition: AbstractMemoryTest.php:2
‪TYPO3\CMS\Core\Tests\Unit\Log\Processor\AbstractProcessorTest\processorRefusesInvalidConfigurationOptions
‪processorRefusesInvalidConfigurationOptions()
Definition: AbstractProcessorTest.php:29
‪TYPO3\CMS\Core\Tests\Unit\Log\Processor\AbstractProcessorTest
Definition: AbstractProcessorTest.php:25
‪TYPO3\CMS\Core\Tests\Unit\Log\Fixtures\ProcessorFixture
Definition: ProcessorFixture.php:21
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Log\LogLevel\DEBUG
‪const DEBUG
Definition: LogLevel.php:94
‪TYPO3\CMS\Core\Log\Exception\InvalidLogProcessorConfigurationException
Definition: InvalidLogProcessorConfigurationException.php:21