From 73ce542ad192a282c9f1451da51c145dff377311 Mon Sep 17 00:00:00 2001 From: Elmar Hinz <t3elmar@gmail.com> Date: Tue, 31 May 2016 14:11:21 +0200 Subject: [PATCH] [TASK] Add unit test to cover stdWrap_csConv Resolves: #76396 Releases: master Change-Id: Ic122bd700f72e77012f238355570f8ebe092206c Reviewed-on: https://review.typo3.org/48419 Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Tested-by: Wouter Wolters <typo3@wouterwolters.nl> --- .../ContentObjectRendererTest.php | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php index 6dfbcc9ef0ec..291926271bc8 100755 --- a/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php +++ b/typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php @@ -830,6 +830,63 @@ class ContentObjectRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase $this->assertEquals($expected, $result); } + /** + * Data provider for stdWrap_csConv + * + * @return array Order expected, input, conf + */ + public function stdWrap_csConvDataProvider() + { + return [ + 'empty string from ISO-8859-15' => [ + '', + iconv('UTF-8', 'ISO-8859-15', ''), + ['csConv' => 'ISO-8859-15'] + ], + 'empty string from BIG-5' => [ + '', + mb_convert_encoding('', 'BIG-5'), + ['csConv' => 'BIG-5'] + ], + '"0" from ISO-8859-15' => [ + '0', + iconv('UTF-8', 'ISO-8859-15', '0'), + ['csConv' => 'ISO-8859-15'] + ], + '"0" from BIG-5' => [ + '0', + mb_convert_encoding('0', 'BIG-5'), + ['csConv' => 'BIG-5'] + ], + 'euro symbol from ISO-88859-15' => [ + '€', + iconv('UTF-8', 'ISO-8859-15', '€'), + ['csConv' => 'ISO-8859-15'] + ], + 'good morning from BIG-5' => [ + '早安', + mb_convert_encoding('早安', 'BIG-5'), + ['csConv' => 'BIG-5'] + ], + ]; + } + + /** + * Check if stdWrap_csConv works properly. + * + * @test + * @dataProvider stdWrap_csConvDataProvider + * @param string $expected The expected value. + * @param string $value The input value. + * @param array $conf Property: csConv + * @return void + */ + public function stdWrap_csConv($expected, $input, $conf) + { + $this->assertSame($expected, + $this->subject->stdWrap_csConv($input, $conf)); + } + /** * Test for the stdWrap_stripHtml * -- GitLab