From c15f729cc4ed5d5d0f6c13e0fd5edee50c044c8b Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Mon, 24 Mar 2025 19:24:04 +0100 Subject: [PATCH] Use environment variable instead of hard coded values --- test/phpunit/AbstractRestAPITest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/phpunit/AbstractRestAPITest.php b/test/phpunit/AbstractRestAPITest.php index 4fb8c0b01e8..923ebb671ba 100644 --- a/test/phpunit/AbstractRestAPITest.php +++ b/test/phpunit/AbstractRestAPITest.php @@ -86,9 +86,9 @@ abstract class AbstractRestAPITest extends CommonClassTest $method = get_called_class()."::".__FUNCTION__; $test = "API Test Setup - "; - $login = 'admin'; - $password = 'admin'; - $url = $this->api_url.'/login?login='.$login.'&password='.$password; + $login = getenv("DOL_CTI_ADMIN_LOGIN") ? getenv("DOL_CTI_ADMIN_LOGIN") : 'admin'; + $password = getenv('DOL_CTI_ADMIN_PASSWORD') ? getenv('DOL_CTI_ADMIN_PASSWORD') : 'admin'; + $url = $this->api_url.'/login?login='.urlencode($login).'&password='.urlencode($password); // Call the API login method to save api_key for this test class. // At first call, if token is not defined a random value is generated and returned. $result = getURLContent($url, 'GET', '', 1, $addheaders, array('http', 'https'), 2);