UserRights Unit tests

SVN:trunk[5297]
This commit is contained in:
Eric Espié
2018-01-26 08:06:41 +00:00
parent a58ba7fcc5
commit 5144f62da9
2 changed files with 262 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ use ArchivedObjectException;
use CMDBSource;
use Contact;
use DBObject;
use DBObjectSet;
use Exception;
use Farm;
use FunctionalCI;
@@ -39,6 +40,7 @@ use Person;
use PHPUnit\Framework\TestCase;
use Server;
use Ticket;
use URP_UserProfile;
use VirtualHost;
use VirtualMachine;
@@ -175,6 +177,30 @@ class ItopDataTestCase extends ItopTestCase
return $oPerson;
}
/**
* @param string $sLogin
* @param int $iProfileId
* @return \DBObject
* @throws Exception
*/
protected function CreateUser($sLogin, $iProfileId)
{
$oUserProfile = new URP_UserProfile();
$oUserProfile->Set('profileid', $iProfileId);
$oUserProfile->Set('reason', 'UNIT Tests');
$oSet = DBObjectSet::FromObject($oUserProfile);
$oUser = self::createObject('UserLocal', array(
'contactid' => 2,
'login' => $sLogin,
'password' => $sLogin,
'language' => 'EN US',
'profile_list' => $oSet,
));
$this->debug("Created {$oUser->GetName()} ({$oUser->GetKey()})\n");
return $oUser;
}
/**
* Create a Hypervisor in database
* @param int $iNum