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");
+ }
+
}
?>