mirror of
https://github.com/Combodo/iTop.git
synced 2026-06-25 09:16:44 +02:00
WIP
This commit is contained in:
@@ -1466,6 +1466,31 @@ abstract class ItopDataTestCase extends ItopTestCase
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description To avoid adding finalclasses parameters to GivenUserInDB
|
||||
* @param string $sPassword
|
||||
* @param array $aProfiles Profile names Example: ['Administrator']
|
||||
* @param bool $bReturnLogin
|
||||
*
|
||||
* @return string|int The unique login
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function GivenTokenUserInDB(array $aProfiles, bool $bReturnLogin = true): string|int
|
||||
{
|
||||
$sLogin = 'demo_test_'.uniqid(__CLASS__, true);
|
||||
|
||||
$aProfileList = array_map(function ($sProfileId) {
|
||||
return 'profileid:'.self::$aURP_Profiles[$sProfileId];
|
||||
}, $aProfiles);
|
||||
|
||||
$iUser = $this->GivenObjectInDB('UserToken', [
|
||||
'login' => $sLogin,
|
||||
'language' => 'EN US',
|
||||
'profile_list' => $aProfileList,
|
||||
]);
|
||||
return $bReturnLogin ? $sLogin : $iUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sPassword
|
||||
* @param array $aProfiles Profile names Example: ['Administrator']
|
||||
|
||||
Reference in New Issue
Block a user