Fix phpunit

This commit is contained in:
Laurent Destailleur
2022-01-24 12:43:42 +01:00
parent 053b402202
commit 00eabded6d
3 changed files with 6 additions and 3 deletions

View File

@@ -1544,6 +1544,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
// This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it).
$data['ip'] = '???@'.$_SERVER['LOGNAME'];
}
// Loop on each log handler and send output
foreach ($conf->loghandlers as $loghandlerinstance) {
if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler) {

View File

@@ -1905,7 +1905,7 @@ class User extends CommonObject
// Update password
if (!empty($this->pass)) {
if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) {
// Si mot de passe saisi et different de celui en base
// If a new value for password is set and different than the one crypted into database
$result = $this->setPassword($user, $this->pass, 0, $notrigger, $nosyncmemberpass);
if ($result < 0) {
return -5;
@@ -3080,7 +3080,7 @@ class User extends CommonObject
$this->personal_mobile = '0999999996';
$this->admin = 0;
$this->login = 'dolibspec';
$this->pass = 'dolibspec';
$this->pass = 'dolibSpec+@123';
//$this->pass_indatabase='dolibspec'; Set after a fetch
//$this->pass_indatabase_crypted='e80ca5a88c892b0aaaf7e154853bccab'; Set after a fetch
$this->datec = $now;

View File

@@ -143,11 +143,13 @@ class UserTest extends PHPUnit\Framework\TestCase
$langs=$this->savlangs;
$db=$this->savdb;
print __METHOD__." USER_PASSWORD_GENERATED=".getDolGlobalString('USER_PASSWORD_GENERATED')."\n";
$localobject=new User($this->savdb);
$localobject->initAsSpecimen();
$result=$localobject->create($user);
$this->assertLessThan($result, 0);
$this->assertLessThan($result, 0, 'Creation of user has failed: '.$localobject->error);
print __METHOD__." result=".$result."\n";
return $result;
}