From c61565101ee968a56912aa17c8eb6b1d1d8e1795 Mon Sep 17 00:00:00 2001 From: odain Date: Wed, 29 Nov 2023 16:09:36 +0100 Subject: [PATCH] adapt tests for saas targets --- .../unitary-tests/core/UserRightsTest.php | 7 +++---- .../unitary-tests/synchro/DataSynchroTest.php | 21 ++++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/php-unit-tests/unitary-tests/core/UserRightsTest.php b/tests/php-unit-tests/unitary-tests/core/UserRightsTest.php index 51734ee4f..4bcb8550b 100644 --- a/tests/php-unit-tests/unitary-tests/core/UserRightsTest.php +++ b/tests/php-unit-tests/unitary-tests/core/UserRightsTest.php @@ -40,7 +40,6 @@ use utils; /** * @group itopRequestMgmt * @group userRights - * @group defaultProfiles */ class UserRightsTest extends ItopDataTestCase { @@ -50,7 +49,7 @@ class UserRightsTest extends ItopDataTestCase try { utils::GetConfig()->SetModuleSetting('authent-local', 'password_validation.pattern', ''); - self::CreateUser('admin', 1); + self::CreateContactlessUser('admin', 1); } catch (CoreCannotSaveObjectException $e) { } @@ -78,7 +77,7 @@ class UserRightsTest extends ItopDataTestCase $sLogin = $sLoginPrefix.$iCount; $iCount++; - $oUser = self::CreateUser($sLogin, $iProfileId); + $oUser = self::CreateContactlessUser($sLogin, $iProfileId); $_SESSION = array(); UserRights::Login($sLogin); return $oUser; @@ -494,7 +493,7 @@ class UserRightsTest extends ItopDataTestCase { utils::GetConfig()->Set('security.hide_administrators', $bHideAdministrators); - $oUserAdmin = $this->CreateUser('admin1', 1); + $oUserAdmin = $this->CreateContactlessUser('admin1', 1); $this->CreateUniqueUserAndLogin('test1', 2); // portal user $oSearch = new DBObjectSearch('URP_UserProfile'); diff --git a/tests/php-unit-tests/unitary-tests/synchro/DataSynchroTest.php b/tests/php-unit-tests/unitary-tests/synchro/DataSynchroTest.php index d418e23c2..b9d45e0bc 100644 --- a/tests/php-unit-tests/unitary-tests/synchro/DataSynchroTest.php +++ b/tests/php-unit-tests/unitary-tests/synchro/DataSynchroTest.php @@ -30,7 +30,6 @@ use utils; * * @package Combodo\iTop\Test\UnitTest\Synchro * @group dataSynchro - * @group defaultProfiles */ class DataSynchroTest extends ItopDataTestCase { @@ -138,17 +137,19 @@ class DataSynchroTest extends ItopDataTestCase // Create the data source // - $oDataSource = new SynchroDataSource(); - $oDataSource->Set('name', 'Test data sync '.time()); - $oDataSource->Set('description', 'unit test - created automatically'); - $oDataSource->Set('status', 'production'); - $oDataSource->Set('user_id', 0); - $oDataSource->Set('scope_class', $sClass); + $aDsParams = [ + 'name' => 'Test data sync '.time(), + 'description' => 'unit test - created automatically', + 'status' => 'production', + 'user_id' => 0, + 'scope_class' => $sClass + ]; foreach ($aSourceProperties as $sProperty => $value) { - $oDataSource->Set($sProperty, $value); + $aDsParams[$sProperty] = $value; } - $iDataSourceId = $oDataSource->DBInsert(); + $oDataSource = $this->createObject('SynchroDataSource', $aDsParams); + $iDataSourceId = $oDataSource->GetKey(); $oAttributeSet = $oDataSource->Get('attribute_list'); while ($oAttribute = $oAttributeSet->Fetch()) @@ -382,7 +383,7 @@ class DataSynchroTest extends ItopDataTestCase 'source_data' => array( array('primary_key', 'login', 'password', 'profile_list'), array( - array('user_A', 'login_A', 'password_A', 'profileid:10;reason:he/she is managing services'), + array('user_A', 'login_A', 'password_A', 'profileid:3;reason:he/she is managing services'), ), ), 'target_data' => array(