From 9480c4053d328a868dc7bf1a5ae39acd0e38b738 Mon Sep 17 00:00:00 2001 From: Anne-Cath Date: Fri, 19 Dec 2025 16:37:47 +0100 Subject: [PATCH 1/2] =?UTF-8?q?N=C2=B08786=20-=20configuration:=20allow=20?= =?UTF-8?q?conditions=20on=20the=20allowed=5Flogin=5Ftypes=20field=20-=20f?= =?UTF-8?q?ix=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/config.class.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 99d38a1ed..82d8a786e 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -2418,6 +2418,7 @@ class Config public function SetAllowedLoginTypes($aAllowedLoginTypes) { $this->m_sAllowedLoginTypes = implode('|', $aAllowedLoginTypes); + $this->Set('allowed_login_types', implode('|', $aAllowedLoginTypes)); } /** From 4dba47798c478694245108289440d87a377858c5 Mon Sep 17 00:00:00 2001 From: odain Date: Fri, 19 Dec 2025 18:35:42 +0100 Subject: [PATCH 2/2] ci: fix broken test due to POST CURL file not sent --- .../src/BaseTestCase/ItopTestCase.php | 18 +++++++++++++++++- .../unitary-tests/webservices/RestTest.php | 1 - 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php b/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php index 12ae32538..09e5da455 100644 --- a/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php +++ b/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php @@ -14,6 +14,7 @@ use ReflectionMethod; use SetupUtils; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\HttpKernel\KernelInterface; + use const DEBUG_BACKTRACE_IGNORE_ARGS; /** @@ -662,7 +663,11 @@ abstract class ItopTestCase extends KernelTestCase curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt_array($ch, $aCurlOptions); - curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($aPostFields)); + if ($this->IsArrayOfArray($aPostFields)) { + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($aPostFields)); + } else { + curl_setopt($ch, CURLOPT_POSTFIELDS, $aPostFields); + } $sOutput = curl_exec($ch); @@ -677,6 +682,17 @@ abstract class ItopTestCase extends KernelTestCase return $sOutput; } + private function IsArrayOfArray(array $aStruct): bool + { + foreach ($aStruct as $k => $v) { + if (is_array($v)) { + return true; + } + } + + return false; + } + protected function CallItopUri(string $sUri, ?array $aPostFields = [], ?array $aCurlOptions = [], $bXDebugEnabled = false): string { $sUrl = \MetaModel::GetConfig()->Get('app_root_url')."/$sUri"; diff --git a/tests/php-unit-tests/unitary-tests/webservices/RestTest.php b/tests/php-unit-tests/unitary-tests/webservices/RestTest.php index 57d323c92..49e26c4a1 100644 --- a/tests/php-unit-tests/unitary-tests/webservices/RestTest.php +++ b/tests/php-unit-tests/unitary-tests/webservices/RestTest.php @@ -94,7 +94,6 @@ class RestTest extends ItopDataTestCase public function testPostJSONDataAsCurlFile() { - $sCallbackName = 'fooCallback'; $sJsonData = '{"operation": "list_operations"}'; // Test regular JSON result