mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
Merge remote-tracking branch 'origin/support/2.7' into develop
# Conflicts: # application/ajaxwebpage.class.inc.php # application/csvpage.class.inc.php # application/itopwebpage.class.inc.php # application/webpage.class.inc.php # application/xmlpage.class.inc.php # core/config.class.inc.php # css/css-variables.scss # datamodels/2.x/version.xml # pages/ajax.document.php # pages/ajax.render.php # pages/ajax.searchform.php # sources/application/TwigBase/Controller/Controller.php
This commit is contained in:
@@ -73,7 +73,7 @@ class ItopDataTestCase extends ItopTestCase
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
//require_once(APPROOT.'/application/startup.inc.php');
|
||||
require_once(APPROOT.'/application/startup.inc.php');
|
||||
|
||||
require_once(APPROOT.'application/utils.inc.php');
|
||||
|
||||
@@ -408,8 +408,12 @@ class ItopDataTestCase extends ItopTestCase
|
||||
* @return \DBObject
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function CreateUser($sLogin, $iProfileId)
|
||||
protected function CreateUser($sLogin, $iProfileId, $sPassword=null)
|
||||
{
|
||||
if (empty($sPassword)){
|
||||
$sPassword = $sLogin;
|
||||
}
|
||||
|
||||
$oUserProfile = new URP_UserProfile();
|
||||
$oUserProfile->Set('profileid', $iProfileId);
|
||||
$oUserProfile->Set('reason', 'UNIT Tests');
|
||||
@@ -417,7 +421,7 @@ class ItopDataTestCase extends ItopTestCase
|
||||
$oUser = $this->createObject('UserLocal', array(
|
||||
'contactid' => 2,
|
||||
'login' => $sLogin,
|
||||
'password' => $sLogin,
|
||||
'password' => $sPassword,
|
||||
'language' => 'EN US',
|
||||
'profile_list' => $oSet,
|
||||
));
|
||||
@@ -426,6 +430,29 @@ class ItopDataTestCase extends ItopTestCase
|
||||
return $oUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DBObject $oUser
|
||||
* @param int $iProfileId
|
||||
*
|
||||
* @return \DBObject
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function AddProfileToUser($oUser, $iProfileId)
|
||||
{
|
||||
$oUserProfile = new URP_UserProfile();
|
||||
$oUserProfile->Set('profileid', $iProfileId);
|
||||
$oUserProfile->Set('reason', 'UNIT Tests');
|
||||
/** @var DBObjectSet $oSet */
|
||||
$oSet = $oUser->Get('profile_list');
|
||||
$oSet->AddObject($oUserProfile);
|
||||
$oUser = $this->updateObject('UserLocal', $oUser->GetKey(), array(
|
||||
'profile_list' => $oSet,
|
||||
));
|
||||
$this->debug("Updated {$oUser->GetName()} ({$oUser->GetKey()})");
|
||||
|
||||
return $oUser;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a Hypervisor in database
|
||||
|
||||
Reference in New Issue
Block a user