mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-27 20:48:46 +02:00
UserRights Unit tests
SVN:trunk[5297]
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user