From 71d5d87fe53ff35dda99386268a0ccfe2046991a Mon Sep 17 00:00:00 2001 From: jf-cbd Date: Tue, 9 Jun 2026 15:34:34 +0200 Subject: [PATCH] Improve test method to be able to get login OR id of the created user --- tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php b/tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php index 42468ee949..7a58d0394f 100644 --- a/tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php +++ b/tests/php-unit-tests/src/BaseTestCase/ItopDataTestCase.php @@ -1471,11 +1471,12 @@ abstract class ItopDataTestCase extends ItopTestCase * @param array $aProfiles Profile names Example: ['Administrator'] * @param string|null $sLogin * @param string|null $sUserId + * @param bool $bReturnLogin * * @return string The unique login * @throws \Exception */ - protected function GivenUserInDB(string $sPassword, array $aProfiles, ?string $sLogin = null, ?string &$sUserId = null): string + protected function GivenUserInDB(string $sPassword, array $aProfiles, ?string $sLogin = null, ?string &$sUserId = null, bool $bReturnLogin = true): string { if (is_null($sLogin)) { $sLogin = 'demo_test_'.uniqid(__CLASS__, true); @@ -1492,7 +1493,7 @@ abstract class ItopDataTestCase extends ItopTestCase 'profile_list' => $aProfileList, ]); - return $sLogin; + return $bReturnLogin ? $sLogin : $sUserId; } /**