Fix phpunit

This commit is contained in:
Laurent Destailleur 2022-01-04 13:45:18 +01:00
parent 6bd6bc3d57
commit 956288081c
2 changed files with 5 additions and 5 deletions

View File

@ -2109,7 +2109,7 @@ class User extends CommonObject
* @param int $notrigger 1=Does not launch triggers
* @param int $nosyncmember Do not synchronize linked member
* @param int $passwordalreadycrypted 0=Value is cleartext password, 1=Value is crypted value.
* @return string If OK return clear password, 0 if no change, < 0 if error
* @return string If OK return clear password, 0 if no change (warning, you may retreive 1 instead of 0 even if password was same), < 0 if error
*/
public function setPassword($user, $password = '', $changelater = 0, $notrigger = 0, $nosyncmember = 0, $passwordalreadycrypted = 0)
{

View File

@ -290,7 +290,7 @@ class UserTest extends PHPUnit\Framework\TestCase
$conf->global->USER_PASSWORD_GENERATED = 'standard';
$localobject->error = '';
$result = $localobject->setPassword($user, '12345678901');
$result = $localobject->setPassword($user, '123456789AA');
print __METHOD__." set a too small password with USER_PASSWORD_GENERATED = standard\n";
print __METHOD__." localobject->error=".$localobject->error."\n";
$this->assertEquals(-1, $result, 'We must receive a negative error code (pass too small) and we did not here');
@ -301,7 +301,7 @@ class UserTest extends PHPUnit\Framework\TestCase
$conf->global->USER_PASSWORD_PATTERN = '12;2;2;2;3;1';
$localobject->error = '';
$result = $localobject->setPassword($user, '12345678901');
$result = $localobject->setPassword($user, '1234567892BB');
print __METHOD__." set a too small password with USER_PASSWORD_GENERATED = perso\n";
print __METHOD__." localobject->error=".$localobject->error."\n";
$this->assertEquals(-1, $result, 'We must receive a negative error code (pass too small) and we did not here');
@ -321,10 +321,10 @@ class UserTest extends PHPUnit\Framework\TestCase
$this->assertEquals(-1, $result, 'We must receive a negative error code (pass without enough uppercase) and we did not here');
$localobject->error = '';
$result = $localobject->setPassword($user, '$*34567890AB');
$result = $localobject->setPassword($user, '$*34567890CD');
print __METHOD__." set a password with enough uppercase\n";
print __METHOD__." localobject->error=".$localobject->error."\n";
$this->assertEquals('$*34567890AB', $result, 'We must get the password as it is valid (pass with enough uppercase) and we did not here');
$this->assertEquals('$*34567890CD', $result, 'We must get the password as it is valid (pass with enough uppercase) and we did not here');
// Test digits : $chartofound = "!@#$%&*()_-+={}[]\\|:;'/";