Index: tests/t3lib/t3lib_div_testcase.php =================================================================== --- tests/t3lib/t3lib_div_testcase.php (revision 5097) +++ tests/t3lib/t3lib_div_testcase.php (working copy) @@ -68,9 +68,9 @@ /** * @test */ - public function checkTrimExplodeLimitsResults() { + public function checkTrimExplodeLimitsResultsToFirstXElementsWithPositiveParameter() { $testString = ' a , b , c , , d,, ,e '; - $expectedArray = array('a', 'b', 'c , , d,, ,e'); // limiting returns the rest of the string as the last element + $expectedArray = array('a', 'b', 'c'); // limiting returns the rest of the string as the last element $actualArray = t3lib_div::trimExplode(',', $testString, false, 3); $this->assertEquals($expectedArray, $actualArray); @@ -79,6 +79,17 @@ /** * @test */ + public function checkTrimExplodeLimitsResultsToLastXElementsWithNegativeParameter() { + $testString = ' a , b , c , d, ,e, f , , '; + $expectedArray = array('a', 'b', 'c'); // limiting returns the rest of the string as the last element + $actualArray = t3lib_div::trimExplode(',', $testString, true, -3); + + $this->assertEquals($expectedArray, $actualArray); + } + + /** + * @test + */ public function checkTrimExplodeKeepsZeroAsString() { $testString = 'a , b , c , ,d ,, ,e,f, 0 ,'; $expectedArray = array('a', 'b', 'c', 'd', 'e', 'f', '0');