From 00eabded6d037541bb50b90fdf5e253436b5e1d6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Jan 2022 12:43:42 +0100 Subject: [PATCH] Fix phpunit --- htdocs/core/lib/functions.lib.php | 1 + htdocs/user/class/user.class.php | 4 ++-- test/phpunit/UserTest.php | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 76ac0df05b1..3d98530ffd7 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index d1cf9a40b95..6345cac8b1a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -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; diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index b8025a3cd41..699e9fd89f0 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -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; }