diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index 9c9af971616..6af80a304ae 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -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;