From f48348cade585edfcc93f91a64db18c60b393d93 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 17 Dec 2011 16:53:36 +0100 Subject: [PATCH] More PHPUnit tests --- test/phpunit/FunctionsTest.php | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/test/phpunit/FunctionsTest.php b/test/phpunit/FunctionsTest.php index 591f0dbef62..72f1821aa73 100755 --- a/test/phpunit/FunctionsTest.php +++ b/test/phpunit/FunctionsTest.php @@ -112,7 +112,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase /** */ - public function testHtmlCleanLastBr() + public function testDolHtmlCleanLastBr() { $input="A string
"; $after=dol_htmlcleanlastbr($input); @@ -132,7 +132,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase /** */ - public function testHtmlEntitiesBr() + public function testDolHtmlEntitiesBr() { $input="A string\nwith a é, &, < and >."; // Text not already HTML $after=dol_htmlentitiesbr($input,0); // Add
before \n @@ -153,6 +153,36 @@ class FunctionsTest extends PHPUnit_Framework_TestCase return true; } + /** + */ + 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); + } + /** */ public function testDolTrunc()