‪TYPO3CMS  11.5
BootstrapRendererTest.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 
23 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
24 
28 class ‪BootstrapRendererTest extends UnitTestCase
29 {
34  {
35  $rendererClass = GeneralUtility::makeInstance(BootstrapRenderer::class);
36  $flashMessage = GeneralUtility::makeInstance(
37  FlashMessage::class,
38  'messageBody',
39  'messageTitle',
41  );
42  ‪$output = $rendererClass->render([$flashMessage]);
43  self::assertStringContainsString('<div class="typo3-messages">', ‪$output);
44  self::assertStringContainsString('<div class="alert alert-notice">', ‪$output);
45  self::assertStringContainsString('<div class="media-body">', ‪$output);
46  self::assertStringContainsString('<h4 class="alert-title">messageTitle</h4>', ‪$output);
47  self::assertStringContainsString('<p class="alert-message">messageBody</p>', ‪$output);
48  }
49 
54  {
55  $rendererClass = GeneralUtility::makeInstance(BootstrapRenderer::class);
56  $flashMessage = GeneralUtility::makeInstance(
57  FlashMessage::class,
58  'messageBody',
59  '',
61  );
62  ‪$output = $rendererClass->render([$flashMessage]);
63  self::assertStringContainsString('<div class="typo3-messages">', ‪$output);
64  self::assertStringContainsString('<div class="alert alert-notice">', ‪$output);
65  self::assertStringContainsString('<div class="media-body">', ‪$output);
66  self::assertStringContainsString('<p class="alert-message">messageBody</p>', ‪$output);
67  self::assertStringNotContainsString('<h4 class="alert-title">messageTitle</h4>', ‪$output);
68  }
69 }
‪TYPO3\CMS\Core\Tests\Unit\Messaging\Renderer
Definition: BootstrapRendererTest.php:18
‪TYPO3\CMS\Core\Tests\Unit\Messaging\Renderer\BootstrapRendererTest
Definition: BootstrapRendererTest.php:29
‪TYPO3\CMS\Core\Tests\Unit\Messaging\Renderer\BootstrapRendererTest\renderCreatesCorrectOutputForFlashMessage
‪renderCreatesCorrectOutputForFlashMessage()
Definition: BootstrapRendererTest.php:33
‪TYPO3\CMS\Core\Tests\Unit\Messaging\Renderer\BootstrapRendererTest\renderCreatesCorrectOutputForFlashMessageWithoutTitle
‪renderCreatesCorrectOutputForFlashMessageWithoutTitle()
Definition: BootstrapRendererTest.php:53
‪TYPO3\CMS\Core\Messaging\Renderer\BootstrapRenderer
Definition: BootstrapRenderer.php:30
‪$output
‪$output
Definition: annotationChecker.php:121
‪TYPO3\CMS\Core\Messaging\FlashMessage
Definition: FlashMessage.php:26
‪TYPO3\CMS\Core\Messaging\AbstractMessage\NOTICE
‪const NOTICE
Definition: AbstractMessage.php:27
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50