2
0
forked from Wavyzz/dolibarr

Add more phpunit to avoid empty and hasRight

This commit is contained in:
Laurent Destailleur
2022-09-25 14:56:13 +02:00
parent c58333adb7
commit de94451a88

View File

@@ -552,6 +552,15 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
}
$this->assertTrue($ok, 'Found code empty($user->hasRight in file '.$file['relativename'].'. empty() must not be used with hasRight.');
// Test we don't have empty(DolibarrApiAccess::$user->hasRight
$ok=true;
$matches=array();
preg_match_all('/empty\(DolibarrApiAccess::\$user->hasRight/', $filecontent, $matches, PREG_SET_ORDER);
foreach ($matches as $key => $val) {
$ok=false;
break;
}
$this->assertTrue($ok, 'Found code empty(DolibarrApiAccess::$user->hasRight in file '.$file['relativename'].'. empty() must not be used with hasRight.');
// Test we don't have @var array(
$ok=true;