From 09af6ee64642a20137dddb550a4acdd159edf532 Mon Sep 17 00:00:00 2001 From: Elmar Hinz <t3elmar@gmail.com> Date: Thu, 26 May 2016 12:05:30 +0200 Subject: [PATCH] [TASK] Unit test to cover stdWrap_brTag Resolves: #76307 Releases: master Change-Id: Ie75ab139102cedb6e5bc01ffb59bbf51c900dded Reviewed-on: https://review.typo3.org/48293 Reviewed-by: Frank Naegler <frank.naegler@typo3.org> Tested-by: Frank Naegler <frank.naegler@typo3.org> Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de> Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de> --- .../ContentObjectRendererTest.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php index ee5fa803f135..b145fcd05ced 100755 --- a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php +++ b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php @@ -2575,6 +2575,40 @@ class ContentObjectRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase $this->assertEquals($expected, $result); } + public function stdWrapBrTagDataProvider() + { + $noConfig = []; + $config1 = ['brTag' => '<br/>']; + $config2 = ['brTag' => '<br>']; + return [ + 'no config: one break at the beginning' => [LF . 'one' . LF . 'two', 'onetwo', $noConfig], + 'no config: multiple breaks at the beginning' => [LF . LF . 'one' . LF . 'two', 'onetwo', $noConfig], + 'no config: one break at the end' => ['one' . LF . 'two' . LF, 'onetwo', $noConfig], + 'no config: multiple breaks at the end' => ['one' . LF . 'two' . LF . LF, 'onetwo', $noConfig], + + 'config1: one break at the beginning' => [LF . 'one' . LF . 'two', '<br/>one<br/>two', $config1], + 'config1: multiple breaks at the beginning' => [LF . LF . 'one' . LF . 'two', '<br/><br/>one<br/>two', $config1], + 'config1: one break at the end' => ['one' . LF . 'two' . LF, 'one<br/>two<br/>', $config1], + 'config1: multiple breaks at the end' => ['one' . LF . 'two' . LF . LF, 'one<br/>two<br/><br/>', $config1], + + 'config2: one break at the beginning' => [LF . 'one' . LF . 'two', '<br>one<br>two', $config2], + 'config2: multiple breaks at the beginning' => [LF . LF . 'one' . LF . 'two', '<br><br>one<br>two', $config2], + 'config2: one break at the end' => ['one' . LF . 'two' . LF, 'one<br>two<br>', $config2], + 'config2: multiple breaks at the end' => ['one' . LF . 'two' . LF . LF, 'one<br>two<br><br>', $config2], + ]; + } + + /** + * Check if brTag works properly + * + * @test + * @dataProvider stdWrapBrTagDataProvider + */ + public function stdWrap_brTag($input, $expected, $config) + { + $this->assertEquals($expected, $this->subject->stdWrap_brTag($input, $config)); + } + /////////////////////////////// // Tests concerning getData() /////////////////////////////// -- GitLab