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