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