diff --git a/tests/php-unit-tests/unitary-tests/core/UserRightsTest.php b/tests/php-unit-tests/unitary-tests/core/UserRightsTest.php index af6eb3e74a..59cbdae88a 100644 --- a/tests/php-unit-tests/unitary-tests/core/UserRightsTest.php +++ b/tests/php-unit-tests/unitary-tests/core/UserRightsTest.php @@ -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();