diff --git a/test/phpunit/FunctionsTest.php b/test/phpunit/FunctionsTest.php index d0e7025c8a0..7afb8270fed 100755 --- a/test/phpunit/FunctionsTest.php +++ b/test/phpunit/FunctionsTest.php @@ -151,6 +151,41 @@ class FunctionsTest extends PHPUnit_Framework_TestCase $this->assertEquals('533.21.1',$tmp['browserversion']); } + + /** + * testDolTextIsHtml + * + * @return void + */ + public function testDolTextIsHtml() + { + // True + $input='xxx'; + $after=dol_textishtml($input); + $this->assertTrue($after); + $input='xxx'; + $after=dol_textishtml($input); + $this->assertTrue($after); + $input='xxx yyy zzz'; + $after=dol_textishtml($input); + $this->assertTrue($after); + $input='xxx
'; + $after=dol_textishtml($input); + $this->assertTrue($after); + $input='text with
some div
'; + $after=dol_textishtml($input); + $this->assertTrue($after); + $input='text with HTML   entities'; + $after=dol_textishtml($input); + $this->assertTrue($after); + + // False + $input='xxx < br>'; + $after=dol_textishtml($input); + $this->assertFalse($after); + } + + /** * testDolHtmlCleanLastBr * @@ -200,39 +235,26 @@ class FunctionsTest extends PHPUnit_Framework_TestCase return true; } - /** - * testDolTextIsHtml - * - * @return void - */ - public function testDolTextIsHtml() - { - // True - $input='xxx'; - $after=dol_textishtml($input); - $this->assertTrue($after); - $input='xxx'; - $after=dol_textishtml($input); - $this->assertTrue($after); - $input='xxx yyy zzz'; - $after=dol_textishtml($input); - $this->assertTrue($after); - $input='xxx
'; - $after=dol_textishtml($input); - $this->assertTrue($after); - $input='text with
some div
'; - $after=dol_textishtml($input); - $this->assertTrue($after); - $input='text with HTML   entities'; - $after=dol_textishtml($input); - $this->assertTrue($after); - // False - $input='xxx < br>'; - $after=dol_textishtml($input); - $this->assertFalse($after); + /** + * testDolNbOfLinesBis + * + * @return boolean + */ + public function testDolNbOfLinesBis() + { + $input="A string\nwith a é, &, < and >.\nThird line"; + $after=dol_nboflines_bis($input,0); + $this->assertEquals($after,3); + + $input="A string
with a é, &, < and >.\nThird line"; + $after=dol_nboflines_bis($input,0); + $this->assertEquals($after,3); + + return true; } + /** * testDolTextIsHtml *