From 76725c61ed33c6189c4eed1725727f2a091eae96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 22 Jul 2014 04:10:42 +0200 Subject: [PATCH] Created test for dol_nl2br --- test/phpunit/FunctionsLibTest.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 2178ad6fb5a..b72e470edec 100755 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -783,5 +783,27 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $this->assertEquals('{"AA":"B\/B","CC":"","EE":"FF","HH":"GG;"}',json_encode($tmp)); } + /** + * dol_nl2br + * + * @return void + */ + public function testDolNl2Br() { + + //String to encode + $string = "a\na"; + + $this->assertEquals(dol_nl2br($string), "a
\na"); + + //With $forxml parameter + $this->assertEquals(dol_nl2br($string, 0, 1), "a
\na"); + + //Replacing \n by br + $this->assertEquals(dol_nl2br($string, 1), "a
a"); + + //With $forxml parameter + $this->assertEquals(dol_nl2br($string, 1, 1), "a
a"); + } + } ?>