‪TYPO3CMS  ‪main
ListRendererTest.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 PHPUnit\Framework\Attributes\Test;
25 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
26 
27 final class ‪ListRendererTest extends UnitTestCase
28 {
29  #[Test]
31  {
32  $rendererClass = GeneralUtility::makeInstance(ListRenderer::class);
33  $flashMessage = GeneralUtility::makeInstance(
34  FlashMessage::class,
35  'messageBody',
36  'messageTitle',
37  ContextualFeedbackSeverity::NOTICE
38  );
39  self::assertSame('<ul class="typo3-messages"><li class="alert alert-notice"><h4 class="alert-title">messageTitle</h4><p class="alert-message">messageBody</p></li></ul>', $rendererClass->render([$flashMessage]));
40  }
41 
42  #[Test]
44  {
45  $rendererClass = GeneralUtility::makeInstance(ListRenderer::class);
46  $flashMessage = GeneralUtility::makeInstance(
47  FlashMessage::class,
48  'messageBody',
49  '',
50  ContextualFeedbackSeverity::NOTICE
51  );
52  self::assertSame('<ul class="typo3-messages"><li class="alert alert-notice"><p class="alert-message">messageBody</p></li></ul>', $rendererClass->render([$flashMessage]));
53  }
54 }
‪TYPO3\CMS\Core\Tests\Unit\Messaging\Renderer\ListRendererTest
Definition: ListRendererTest.php:28
‪TYPO3\CMS\Core\Tests\Unit\Messaging\Renderer
Definition: BootstrapRendererTest.php:18
‪TYPO3\CMS\Core\Tests\Unit\Messaging\Renderer\ListRendererTest\renderCreatesCorrectOutputForFlashMessageWithoutTitle
‪renderCreatesCorrectOutputForFlashMessageWithoutTitle()
Definition: ListRendererTest.php:43
‪TYPO3\CMS\Core\Type\ContextualFeedbackSeverity
‪ContextualFeedbackSeverity
Definition: ContextualFeedbackSeverity.php:25
‪TYPO3\CMS\Core\Messaging\Renderer\ListRenderer
Definition: ListRenderer.php:31
‪TYPO3\CMS\Core\Messaging\FlashMessage
Definition: FlashMessage.php:27
‪TYPO3\CMS\Core\Tests\Unit\Messaging\Renderer\ListRendererTest\renderCreatesCorrectOutputForFlashMessage
‪renderCreatesCorrectOutputForFlashMessage()
Definition: ListRendererTest.php:30
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52