forked from Wavyzz/dolibarr
Add phpunit on utf8_check and utf8_valid
This commit is contained in:
@@ -1675,6 +1675,45 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* testUtf8Check
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function testUtf8Check()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$chaine = 'This is an UTF8 string with a é.';
|
||||
$result = utf8_check($chaine);
|
||||
$this->assertEquals(true, $result);
|
||||
|
||||
$chaine = mb_convert_encoding('This is an UTF8 with a é.', 'ISO-8859-1', 'UTF-8');
|
||||
$result = utf8_check($chaine);
|
||||
$this->assertEquals(false, $result);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* testUtf8Valid
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function testUtf8Valid()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$chaine = 'This is an UTF8 string with a é.';
|
||||
$result = utf8_valid($chaine);
|
||||
$this->assertEquals(true, $result);
|
||||
|
||||
$chaine = mb_convert_encoding('This is an UTF8 with a é.', 'ISO-8859-1', 'UTF-8');
|
||||
$result = utf8_valid($chaine);
|
||||
$this->assertEquals(false, $result);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetUserRemoteIP
|
||||
|
||||
Reference in New Issue
Block a user