From: Elmar Hinz Date: Thu, 26 May 2016 10:05:30 +0000 (+0200) Subject: [TASK] Unit test to cover stdWrap_brTag X-Git-Tag: TYPO3_8-2-0~257 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/09af6ee64642a20137dddb550a4acdd159edf532?ds=inline [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 Tested-by: Frank Naegler Reviewed-by: Morton Jonuschat Tested-by: Morton Jonuschat --- 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' => '
']; + $config2 = ['brTag' => '
']; + 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', '
one
two', $config1], + 'config1: multiple breaks at the beginning' => [LF . LF . 'one' . LF . 'two', '

one
two', $config1], + 'config1: one break at the end' => ['one' . LF . 'two' . LF, 'one
two
', $config1], + 'config1: multiple breaks at the end' => ['one' . LF . 'two' . LF . LF, 'one
two

', $config1], + + 'config2: one break at the beginning' => [LF . 'one' . LF . 'two', '
one
two', $config2], + 'config2: multiple breaks at the beginning' => [LF . LF . 'one' . LF . 'two', '

one
two', $config2], + 'config2: one break at the end' => ['one' . LF . 'two' . LF, 'one
two
', $config2], + 'config2: multiple breaks at the end' => ['one' . LF . 'two' . LF . LF, 'one
two

', $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() ///////////////////////////////