‪TYPO3CMS  11.5
LoggerAwareChannelTest.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 
20 use Psr\Log\LogLevel;
24 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
27 
31 class ‪LoggerAwareChannelTest extends FunctionalTestCase
32 {
34  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_logger',
35  ];
36 
38  'LOG' => [
39  'beep' => [
40  'writerConfiguration' => [
41  LogLevel::DEBUG => [
42  DummyWriter::class => [],
43  ],
44  ],
45  ],
46  ],
47  ];
48 
49  protected function ‪setUp(): void
50  {
51  parent::setUp();
52  $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv');
53  $this->setUpBackendUser(1);
56  }
57 
58  protected function ‪tearDown(): void
59  {
61  parent::tearDown();
62  }
63 
67  public function ‪classLevelChannelAttributeIsRead(): void
68  {
69  $container = $this->getContainer();
70  $subject = $container->get(LoggerAwareClassAttributeChannelTester::class);
71 
72  $subject->run();
73 
74  self::assertInstanceOf(LogRecord::class, ‪DummyWriter::$logs[0]);
75  self::assertSame('beep beep', ‪DummyWriter::$logs[0]->getMessage());
76  }
77 
81  public function ‪constructorChannelAttributeIsRead(): void
82  {
83  $container = $this->getContainer();
84  $subject = $container->get(ConstructorAttributeChannelTester::class);
85 
86  $subject->run();
87 
88  self::assertInstanceOf(LogRecord::class, ‪DummyWriter::$logs[0]);
89  self::assertSame('beep beep', ‪DummyWriter::$logs[0]->getMessage());
90  }
91 }
‪TYPO3\CMS\Core\Tests\Functional\Log\LoggerAwareChannelTest\tearDown
‪tearDown()
Definition: LoggerAwareChannelTest.php:58
‪TYPO3\CMS\Core\Tests\Functional\Log\LoggerAwareChannelTest\setUp
‪setUp()
Definition: LoggerAwareChannelTest.php:49
‪TYPO3\CMS\Core\Tests\Functional\Log\LoggerAwareChannelTest\$testExtensionsToLoad
‪$testExtensionsToLoad
Definition: LoggerAwareChannelTest.php:33
‪TYPO3\CMS\Core\Tests\Functional\Log
Definition: LoggerAwareChannelTest.php:18
‪TYPO3\CMS\Core\Tests\Functional\Log\LoggerAwareChannelTest
Definition: LoggerAwareChannelTest.php:32
‪TYPO3\CMS\Core\Tests\Functional\Log\LoggerAwareChannelTest\constructorChannelAttributeIsRead
‪constructorChannelAttributeIsRead()
Definition: LoggerAwareChannelTest.php:81
‪TYPO3\CMS\Core\Core\Bootstrap\initializeLanguageObject
‪static initializeLanguageObject()
Definition: Bootstrap.php:598
‪TYPO3\CMS\Core\Log\LogRecord
Definition: LogRecord.php:22
‪TYPO3\CMS\Core\Tests\Functional\Fixtures\Log\DummyWriter\$logs
‪static array $logs
Definition: DummyWriter.php:26
‪TYPO3Tests\TestLogger\LoggerAwareClassAttributeChannelTester
Definition: LoggerAwareClassAttributeChannelTester.php:26
‪TYPO3\CMS\Core\Core\Bootstrap
Definition: Bootstrap.php:70
‪TYPO3\CMS\Core\Tests\Functional\Log\LoggerAwareChannelTest\classLevelChannelAttributeIsRead
‪classLevelChannelAttributeIsRead()
Definition: LoggerAwareChannelTest.php:67
‪TYPO3\CMS\Core\Tests\Functional\Log\LoggerAwareChannelTest\$configurationToUseInTestInstance
‪$configurationToUseInTestInstance
Definition: LoggerAwareChannelTest.php:37
‪TYPO3Tests\TestLogger\ConstructorAttributeChannelTester
Definition: ConstructorAttributeChannelTester.php:24
‪TYPO3\CMS\Core\Tests\Functional\Fixtures\Log\DummyWriter
Definition: DummyWriter.php:24