diff --git a/tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php b/tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php index 893456630..fbcb2e37d 100644 --- a/tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php +++ b/tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php @@ -37,6 +37,7 @@ use Ticket; use URP_UserProfile; use User; use UserRequest; +use UserRights; use utils; use VirtualHost; use VirtualMachine; @@ -141,6 +142,7 @@ abstract class ItopDataTestCase extends ItopTestCase // Leave the place clean \UserRights::Logoff(); + $this->SetNonPublicStaticProperty(UserRights::class, 'm_aCacheUsers', []); foreach ($this->aEventListeners as $sListenerId) { EventService::UnRegisterListener($sListenerId); diff --git a/tests/php-unit-tests/unitary-tests/core/DBObjectTest.php b/tests/php-unit-tests/unitary-tests/core/DBObjectTest.php index 984a3f570..85e7c6ef3 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBObjectTest.php +++ b/tests/php-unit-tests/unitary-tests/core/DBObjectTest.php @@ -451,7 +451,6 @@ class DBObjectTest extends ItopDataTestCase /** * @covers DBObject::CheckChangedExtKeysValues() - * @runInSeparateProcess MetaModel::GetObject returning wrong values :( */ public function testCheckExtKeysSiloOnAttributeExternalKey() { @@ -529,7 +528,6 @@ class DBObjectTest extends ItopDataTestCase /** * @covers DBObject::CheckChangedExtKeysValues() - * @runInSeparateProcess MetaModel::GetObject returning wrong values :( */ public function testCheckExtKeysOnAttributeLinkedSetIndirect() { @@ -631,7 +629,6 @@ class DBObjectTest extends ItopDataTestCase /** * @covers DBObject::CheckChangedExtKeysValues() - * @runInSeparateProcess MetaModel::GetObject returning wrong values :( */ public function testCheckExtKeysSiloOnAttributeObjectKey() { @@ -685,7 +682,7 @@ class DBObjectTest extends ItopDataTestCase private function CreateDemoOrgUser(Organization $oDemoOrg, string $sProfileId): User { utils::GetConfig()->SetModuleSetting('authent-local', 'password_validation.pattern', ''); - $oUserWithAllowedOrgs = $this->CreateContactlessUser('demo_test_' . __CLASS__, $sProfileId); + $oUserWithAllowedOrgs = $this->CreateContactlessUser('demo_test_' . uniqid(__CLASS__, true), $sProfileId); /** @var \URP_UserOrg $oUserOrg */ $oUserOrg = \MetaModel::NewObject('URP_UserOrg', ['allowed_org_id' => $oDemoOrg->GetKey(),]); $oAllowedOrgList = $oUserWithAllowedOrgs->Get('allowed_org_list'); diff --git a/tests/php-unit-tests/unitary-tests/core/TriggerTest.php b/tests/php-unit-tests/unitary-tests/core/TriggerTest.php index f8abde406..486b829ec 100644 --- a/tests/php-unit-tests/unitary-tests/core/TriggerTest.php +++ b/tests/php-unit-tests/unitary-tests/core/TriggerTest.php @@ -92,7 +92,7 @@ class TriggerTest extends ItopDataTestCase IssueLog::Enable($sTestLogPath); try { - $oPerson1 = MetaModel::GetObject(Person::class, 1, true); + $oPerson1 = MetaModel::GetObjectByName(Person::class, 'Claude Monet'); $sExceptionMessage = 'My test exception message'; $oException = new Exception($sExceptionMessage);