From f1d3bd0873d2d9cd6f56f7f5a44a06e5bc4a11b3 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Tue, 12 Aug 2025 02:15:51 +0800 Subject: [PATCH] fix: unset `encryption.key` variables in `RunInSeparateProcess` tests --- tests/system/Config/BaseConfigTest.php | 6 ++++++ tests/system/Config/DotEnvTest.php | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/tests/system/Config/BaseConfigTest.php b/tests/system/Config/BaseConfigTest.php index 0ba70346de4c..9158db34140f 100644 --- a/tests/system/Config/BaseConfigTest.php +++ b/tests/system/Config/BaseConfigTest.php @@ -197,6 +197,9 @@ public function testSetsDefaultValues(): void #[RunInSeparateProcess] public function testSetsDefaultValuesEncryptionUsingHex2Bin(): void { + putenv('encryption.key'); + unset($_ENV['encryption.key'], $_SERVER['encryption.key']); // @phpstan-ignore codeigniter.superglobalAccess + $dotenv = new DotEnv($this->fixturesFolder, 'encryption.env'); $dotenv->load(); $config = new Encryption(); @@ -210,6 +213,9 @@ public function testSetsDefaultValuesEncryptionUsingHex2Bin(): void #[RunInSeparateProcess] public function testSetDefaultValuesEncryptionUsingBase64(): void { + putenv('encryption.key'); + unset($_ENV['encryption.key'], $_SERVER['encryption.key']); // @phpstan-ignore codeigniter.superglobalAccess + $dotenv = new DotEnv($this->fixturesFolder, 'base64encryption.env'); $dotenv->load(); $config = new Encryption('base64'); diff --git a/tests/system/Config/DotEnvTest.php b/tests/system/Config/DotEnvTest.php index 6fd287be6ad5..97bf2e3dd026 100644 --- a/tests/system/Config/DotEnvTest.php +++ b/tests/system/Config/DotEnvTest.php @@ -90,6 +90,9 @@ public static function provideLoadsVars(): iterable #[RunInSeparateProcess] public function testLoadsHex2Bin(): void { + putenv('encryption.key'); + unset($_ENV['encryption.key'], $_SERVER['encryption.key']); // @phpstan-ignore codeigniter.superglobalAccess + $dotenv = new DotEnv($this->fixturesFolder, 'encryption.env'); $dotenv->load(); @@ -102,6 +105,9 @@ public function testLoadsHex2Bin(): void #[RunInSeparateProcess] public function testLoadsBase64(): void { + putenv('encryption.key'); + unset($_ENV['encryption.key'], $_SERVER['encryption.key']); // @phpstan-ignore codeigniter.superglobalAccess + $dotenv = new DotEnv($this->fixturesFolder, 'base64encryption.env'); $dotenv->load();