TYPO3 CMS  TYPO3_8-7
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 
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 }
static makeInstance($className,... $constructorArguments)