From 0915081f5034804484ec535779fc6151faa1e9b5 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Thu, 16 Nov 2023 11:57:29 +0100 Subject: [PATCH] :white_check_mark: ItopDataTestCase fix cached SQL queries with silo --- .../php-unit-tests/src/BaseTestCase/ItopDataTestCase.php | 8 ++++++++ tests/php-unit-tests/unitary-tests/core/DBObjectTest.php | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php b/tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php index 9660b2bb1..333d50e0c 100644 --- a/tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php +++ b/tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php @@ -135,10 +135,18 @@ abstract class ItopDataTestCase extends ItopTestCase // Leave the place clean \UserRights::Logoff(); $this->SetNonPublicStaticProperty(UserRights::class, 'm_aCacheUsers', []); + $this->ResetMetaModelQueyCacheGetObject(); parent::tearDown(); } + /** + * Helper to reset the metamodel cache : for a class and a key it will contain the SQL query, that could include silo filter + */ + protected function ResetMetaModelQueyCacheGetObject() { + $this->SetNonPublicStaticProperty(MetaModel::class, 'aQueryCacheGetObject', []); + } + /** * @inheritDoc */ diff --git a/tests/php-unit-tests/unitary-tests/core/DBObjectTest.php b/tests/php-unit-tests/unitary-tests/core/DBObjectTest.php index bdcd7dee6..8d9500f31 100644 --- a/tests/php-unit-tests/unitary-tests/core/DBObjectTest.php +++ b/tests/php-unit-tests/unitary-tests/core/DBObjectTest.php @@ -520,14 +520,6 @@ class DBObjectTest extends ItopDataTestCase } } - /** - * Helper to reset the metamodel cache - * We might need to create something generic and add it to {@see UserRights::Logoff()} ? - */ - private function ResetMetaModelQueyCacheGetObject() { - $this->SetNonPublicStaticProperty(MetaModel::class, 'aQueryCacheGetObject', []); - } - private function CreateDemoOrgUser(Organization $oDemoOrg, string $sProfileId): User { utils::GetConfig()->SetModuleSetting('authent-local', 'password_validation.pattern', '');