forked from Wavyzz/dolibarr
Enhance phpunit on sql code testing
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user