2
0
forked from Wavyzz/dolibarr

FIX dol_string_nohtmltag when there is html with windows EOL "<br>\r\n"

This commit is contained in:
Laurent Destailleur
2019-12-23 15:45:08 +01:00
parent 7b08ce9fb8
commit 3250b13f4a
2 changed files with 8 additions and 4 deletions

View File

@@ -520,15 +520,19 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
$text="A <b>string<b><br>\n<br>\n\nwith html tag<br>\n";
$after=dol_string_nohtmltag($text, 0);
$this->assertEquals("A string\n\n\n\n\nwith html tag", $after, "test2a 2 br and 3 \n give 5 \n");
$this->assertEquals("A string\n\n\n\n\nwith html tag", $after, 'test2a 2 br and 3 \n give 5 \n');
$text="A <b>string<b><br>\n<br>\n\nwith html tag<br>\n";
$after=dol_string_nohtmltag($text, 1);
$this->assertEquals("A string with html tag", $after, "test2b 2 br and 3 \n give 1 space");
$this->assertEquals("A string with html tag", $after, 'test2b 2 br and 3 \n give 1 space');
$text="A <b>string<b><br>\n<br>\n\nwith html tag<br>\n";
$after=dol_string_nohtmltag($text, 2);
$this->assertEquals("A string\n\nwith html tag", $after, "test2c 2 br and 3 \n give 2 \n");
$this->assertEquals("A string\n\nwith html tag", $after, 'test2c 2 br and 3 \n give 2 \n');
$text="A <b>string<b><br>\r\n<br>\r\n\r\nwith html tag<br>\n";
$after=dol_string_nohtmltag($text, 2);
$this->assertEquals("A string\n\nwith html tag", $after, 'test2c 2 br and 3 \r\n give 2 \n');
$text="A string<br>Another string";
$after=dol_string_nohtmltag($text, 0);