2
0
forked from Wavyzz/dolibarr

Fix empty on getDolGlobal

This commit is contained in:
Laurent Destailleur
2023-08-27 15:55:44 +02:00
parent 4ae0e6ed09
commit 4302a6bc04
5 changed files with 20 additions and 10 deletions

View File

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