fix: harden portable host installation

This commit is contained in:
Marco0300
2026-09-01 19:26:10 +02:00
parent 5b2c64ff39
commit 323afaf832
6 changed files with 37 additions and 24 deletions
+7
View File
@@ -11,6 +11,13 @@ unlink($tempEnv);
if (getenv('JOBcard_LOADED') !== 'from-file') {
throw new RuntimeException('Expected .env values to load from file');
}
$invalidEnv = tempnam(sys_get_temp_dir(), 'jobcard-env-invalid-');
file_put_contents($invalidEnv, "NOT A NAME=should-not-load\nJOBcard_VALID=ok\n");
load_dotenv($invalidEnv);
unlink($invalidEnv);
if (getenv('NOT A NAME') !== false || getenv('JOBcard_VALID') !== 'ok') {
throw new RuntimeException('Expected malformed .env names to be ignored');
}
$checks = 0;
assert(env_required('JOBcard_TEST_VALUE') === 'present');