I have a service that use getenv
function to set some properties. The environment variables are set with a symfony/dotenv
component.
class BrowshotConfiguration
{
private $apiKey;
public function __construct()
{
$this->instanceList = preg_split('/\D+/', getenv('BROWSHOT_INSTANCE_LIST'));
}
public function getInstanceId(int $index)
{
if ($this->instanceList) {
return $this->instanceList[$index] ?? false;
}
return false;
}
}
I want to test that BrowshotConfiguration::getInstanceId retruns a proper value but I BROWSHOT_INSTANCE_LIST is empty so I do not get a real value.
How could I fill the BROWSHOT_INSTANCE_LIST for running tests with one values but use different value for production?