N°7803 Test iTop Hub move to production (compilation phase)

This commit is contained in:
Romain Quetiez
2024-10-18 17:23:46 +02:00
parent bb16f4ad57
commit 9b651c2451
2 changed files with 92 additions and 0 deletions

View File

@@ -1368,4 +1368,28 @@ abstract class ItopDataTestCase extends ItopTestCase
]);
return $sLogin;
}
/**
* @param string $sPassword
* @param array $aProfiles Profile names Example: ['Administrator']
*
* @return string The unique login
* @throws \Exception
*/
protected function GivenUserInDB(string $sPassword, array $aProfiles): string
{
$sLogin = 'demo_test_'.uniqid(__CLASS__, true);
$aProfileList = array_map(function($sProfileId) {
return 'profileid:'.self::$aURP_Profiles[$sProfileId];
}, $aProfiles);
$iUser = $this->GivenObjectInDB('UserLocal', [
'login' => $sLogin,
'password' => $sPassword,
'language' => 'EN US',
'profile_list' => $aProfileList,
]);
return $sLogin;
}
}