diff --git a/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php b/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php index b533f77c9..86a955020 100644 --- a/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php +++ b/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php @@ -698,4 +698,16 @@ abstract class ItopTestCase extends KernelTestCase return $this->CallUrl($sUrl, $aPostFields, $aCurlOptions, $bXDebugEnabled); } + + /** + * Return a temporary file path. that will be cleaned up by tearDown() + * @return string: temporary file path + */ + public function GetTemporaryFilePath(string $sPrefix = "test"): string + { + + $sPath = tempnam(sys_get_temp_dir(), $sPrefix); + $this->aFileToClean[] = $sPath; + return $sPath; + } }