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:
Pierre Goiffon
2020-12-10 17:59:16 +01:00
34 changed files with 489 additions and 154 deletions

View File

@@ -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