mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
✅ Fix regression introduced with the optimization done in d641504. Cope with the fact that sometimes the admin account already exists, sometimes not.
This commit is contained in:
@@ -48,11 +48,7 @@ class UserRightsTest extends ItopDataTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
try {
|
||||
utils::GetConfig()->SetModuleSetting('authent-local', 'password_validation.pattern', '');
|
||||
}
|
||||
catch (CoreCannotSaveObjectException $e) {
|
||||
}
|
||||
utils::GetConfig()->SetModuleSetting('authent-local', 'password_validation.pattern', '');
|
||||
}
|
||||
|
||||
public static $aClasses = [
|
||||
@@ -102,6 +98,15 @@ class UserRightsTest extends ItopDataTestCase
|
||||
public function testLogin($sLogin, $bResult)
|
||||
{
|
||||
$_SESSION = [];
|
||||
if ($sLogin == 'admin') {
|
||||
// Fixture data required in this case only
|
||||
try {
|
||||
self::CreateUser('admin', 1);
|
||||
}
|
||||
catch (CoreCannotSaveObjectException $e) {
|
||||
// The admin account could exist, depending on where and when the test suite is executed
|
||||
}
|
||||
}
|
||||
$this->assertEquals($bResult, UserRights::Login($sLogin));
|
||||
$this->assertEquals($bResult, UserRights::IsLoggedIn());
|
||||
UserRights::Logoff();
|
||||
|
||||
Reference in New Issue
Block a user