diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3ba43241c47..645296fce52 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4239,7 +4239,7 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id') * Verify if condition in string is ok or not * * @param string $strRights String with condition to check - * @return boolean true or false + * @return boolean True or False. Return true if strRights is '' */ function verifCond($strRights) { diff --git a/test/phpunit/FunctionsTest.php b/test/phpunit/FunctionsTest.php index 63a966d5811..9ff8935c455 100755 --- a/test/phpunit/FunctionsTest.php +++ b/test/phpunit/FunctionsTest.php @@ -118,6 +118,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase /** + * testDolHtmlCleanLastBr + * + * @return boolean */ public function testDolHtmlCleanLastBr() { @@ -138,6 +141,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase } /** + * testDolHtmlEntitiesBr + * + * @return boolean */ public function testDolHtmlEntitiesBr() { @@ -161,6 +167,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase } /** + * testDolTextIsHtml + * + * @return void */ public function testDolTextIsHtml() { @@ -191,6 +200,31 @@ class FunctionsTest extends PHPUnit_Framework_TestCase } /** + * testDolTextIsHtml + * + * @return void + */ + public function testDolUtf8Check() + { + // True + $result=utf8_check('azerty'); + $this->assertTrue($result); + + $file=dirname(__FILE__).'/textutf8.txt'; + $filecontent=file_get_contents($file); + $result=utf8_check($filecontent); + $this->assertTrue($result); + + $file=dirname(__FILE__).'/textiso.txt'; + $filecontent=file_get_contents($file); + $result=utf8_check($filecontent); + $this->assertFalse($result); + } + + /** + * testDolTrunc + * + * @return boolean */ public function testDolTrunc() { @@ -272,5 +306,29 @@ class FunctionsTest extends PHPUnit_Framework_TestCase print __METHOD__."getServerTimeZoneInt=".(getServerTimeZoneInt()*3600)."\n"; $this->assertEquals(getServerTimeZoneInt()*3600,($nowtzserver-$now)); } + + /** + * testVerifCond + * + * @return void + */ + public function testVerifCond() + { + $verifcond=verifCond('1==1'); + $this->assertTrue($verifcond); + + $verifcond=verifCond('1==2'); + $this->assertFalse($verifcond); + + $verifcond=verifCond('$conf->facture->enabled'); + $this->assertTrue($verifcond); + + $verifcond=verifCond('$conf->moduledummy->enabled'); + $this->assertFalse($verifcond); + + $verifcond=verifCond(''); + $this->assertTrue($verifcond); + } + } ?> \ No newline at end of file diff --git a/test/phpunit/ImportTest.php b/test/phpunit/ImportTest.php index e650a8adb46..693a83ecb48 100755 --- a/test/phpunit/ImportTest.php +++ b/test/phpunit/ImportTest.php @@ -120,7 +120,7 @@ class ImportTest extends PHPUnit_Framework_TestCase */ public function testImportSample1() { - + $file=dirname(__FILE__).'/Example_import_company_1.csv'; return true;