Skip to content
Snippets Groups Projects
Commit ffa767bb authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Qual: Add more PHPunit tests

parent 4489eba5
No related branches found
No related tags found
No related merge requests found
...@@ -4239,7 +4239,7 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id') ...@@ -4239,7 +4239,7 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id')
* Verify if condition in string is ok or not * Verify if condition in string is ok or not
* *
* @param string $strRights String with condition to check * @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) function verifCond($strRights)
{ {
......
...@@ -118,6 +118,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase ...@@ -118,6 +118,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
/** /**
* testDolHtmlCleanLastBr
*
* @return boolean
*/ */
public function testDolHtmlCleanLastBr() public function testDolHtmlCleanLastBr()
{ {
...@@ -138,6 +141,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase ...@@ -138,6 +141,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testDolHtmlEntitiesBr
*
* @return boolean
*/ */
public function testDolHtmlEntitiesBr() public function testDolHtmlEntitiesBr()
{ {
...@@ -161,6 +167,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase ...@@ -161,6 +167,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testDolTextIsHtml
*
* @return void
*/ */
public function testDolTextIsHtml() public function testDolTextIsHtml()
{ {
...@@ -191,6 +200,31 @@ class FunctionsTest extends PHPUnit_Framework_TestCase ...@@ -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() public function testDolTrunc()
{ {
...@@ -272,5 +306,29 @@ class FunctionsTest extends PHPUnit_Framework_TestCase ...@@ -272,5 +306,29 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
print __METHOD__."getServerTimeZoneInt=".(getServerTimeZoneInt()*3600)."\n"; print __METHOD__."getServerTimeZoneInt=".(getServerTimeZoneInt()*3600)."\n";
$this->assertEquals(getServerTimeZoneInt()*3600,($nowtzserver-$now)); $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
...@@ -120,7 +120,7 @@ class ImportTest extends PHPUnit_Framework_TestCase ...@@ -120,7 +120,7 @@ class ImportTest extends PHPUnit_Framework_TestCase
*/ */
public function testImportSample1() public function testImportSample1()
{ {
$file=dirname(__FILE__).'/Example_import_company_1.csv';
return true; return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment