Browse Source

Fix phpunit

Laurent Destailleur 3 năm trước cách đây
mục cha
commit
00eabded6d

+ 1 - 0
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) {

+ 2 - 2
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;

+ 3 - 1
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;
 	}