2
0
forked from Wavyzz/dolibarr

Enhance phpunit on sql code testing

This commit is contained in:
Laurent Destailleur
2022-03-07 19:37:53 +01:00
parent d6852c31b8
commit b339e1a883
2 changed files with 15 additions and 15 deletions

View File

@@ -204,7 +204,6 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
'commonobject.class.php',
'conf.class.php',
'html.form.class.php',
'html.formmail.class.php',
'translate.class.php',
'utils.class.php',
'TraceableDB.php',
@@ -362,7 +361,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
$matches=array();
preg_match_all('/(sql|SET|WHERE|INSERT|VALUES|LIKE).+\s*\'"\s*\.\s*\$(.......)/', $filecontent, $matches, PREG_SET_ORDER);
foreach ($matches as $key => $val) {
if (! in_array($val[2], array('this->d', 'this->e', 'db->esc', 'dbs->es', 'mydb->e', 'dbsessi', 'db->ida', 'escaped', 'exclude', 'include'))) {
if (! in_array($val[2], array('this->d', 'this->e', 'db->esc', 'dbs->es', 'dbs->id', 'mydb->e', 'dbsessi', 'db->ida', 'escaped', 'exclude', 'include'))) {
$ok=false; // This will generate error
break;
}