Merge branch 'support/3.2' into develop

This commit is contained in:
odain
2025-12-19 18:44:55 +01:00
2 changed files with 17 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ use ReflectionMethod;
use SetupUtils; use SetupUtils;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use const DEBUG_BACKTRACE_IGNORE_ARGS; use const DEBUG_BACKTRACE_IGNORE_ARGS;
/** /**
@@ -661,7 +662,11 @@ abstract class ItopTestCase extends KernelTestCase
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt_array($ch, $aCurlOptions); 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); $sOutput = curl_exec($ch);
@@ -676,6 +681,17 @@ abstract class ItopTestCase extends KernelTestCase
return $sOutput; 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 protected function CallItopUri(string $sUri, ?array $aPostFields = [], ?array $aCurlOptions = [], $bXDebugEnabled = false): string
{ {
$sUrl = \MetaModel::GetConfig()->Get('app_root_url')."/$sUri"; $sUrl = \MetaModel::GetConfig()->Get('app_root_url')."/$sUri";

View File

@@ -94,7 +94,6 @@ class RestTest extends ItopDataTestCase
public function testPostJSONDataAsCurlFile() public function testPostJSONDataAsCurlFile()
{ {
$sCallbackName = 'fooCallback';
$sJsonData = '{"operation": "list_operations"}'; $sJsonData = '{"operation": "list_operations"}';
// Test regular JSON result // Test regular JSON result