TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
Nl2brViewHelperTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Format;
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  */
18 
23 {
27  protected $viewHelper;
28 
29  protected function setUp()
30  {
31  parent::setUp();
32  $this->viewHelper = new Nl2brViewHelper();
33  $this->injectDependenciesIntoViewHelper($this->viewHelper);
34  }
35 
40  {
41  $this->viewHelper->setRenderChildrenClosure(
42  function () {
43  return '<p class="bodytext">Some Text without line breaks</p>';
44  }
45  );
46  $this->setArgumentsUnderTest(
47  $this->viewHelper,
48  [
49  ]
50  );
51  $actualResult = $this->viewHelper->initializeArgumentsAndRender();
52  $this->assertEquals('<p class="bodytext">Some Text without line breaks</p>', $actualResult);
53  }
54 
59  {
60  $this->viewHelper->setRenderChildrenClosure(
61  function () {
62  return 'Line 1' . chr(10) . 'Line 2';
63  }
64  );
65  $this->setArgumentsUnderTest(
66  $this->viewHelper,
67  [
68  ]
69  );
70  $actualResult = $this->viewHelper->initializeArgumentsAndRender();
71  $this->assertEquals('Line 1<br />' . chr(10) . 'Line 2', $actualResult);
72  }
73 
78  {
79  $this->viewHelper->setRenderChildrenClosure(
80  function () {
81  return 'Line 1' . chr(13) . chr(10) . 'Line 2';
82  }
83  );
84  $this->setArgumentsUnderTest(
85  $this->viewHelper,
86  [
87  ]
88  );
89  $actualResult = $this->viewHelper->initializeArgumentsAndRender();
90  $this->assertEquals('Line 1<br />' . chr(13) . chr(10) . 'Line 2', $actualResult);
91  }
92 }
setArgumentsUnderTest(ViewHelperInterface $viewHelper, array $arguments=[])