Skip to content

Commit 343b6f7

Browse files
authored
fix: unset encryption.key variables in RunInSeparateProcess tests (#9670)
1 parent c2d9440 commit 343b6f7

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

tests/system/Config/BaseConfigTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ public function testSetsDefaultValues(): void
197197
#[RunInSeparateProcess]
198198
public function testSetsDefaultValuesEncryptionUsingHex2Bin(): void
199199
{
200+
putenv('encryption.key');
201+
unset($_ENV['encryption.key'], $_SERVER['encryption.key']); // @phpstan-ignore codeigniter.superglobalAccess
202+
200203
$dotenv = new DotEnv($this->fixturesFolder, 'encryption.env');
201204
$dotenv->load();
202205
$config = new Encryption();
@@ -210,6 +213,9 @@ public function testSetsDefaultValuesEncryptionUsingHex2Bin(): void
210213
#[RunInSeparateProcess]
211214
public function testSetDefaultValuesEncryptionUsingBase64(): void
212215
{
216+
putenv('encryption.key');
217+
unset($_ENV['encryption.key'], $_SERVER['encryption.key']); // @phpstan-ignore codeigniter.superglobalAccess
218+
213219
$dotenv = new DotEnv($this->fixturesFolder, 'base64encryption.env');
214220
$dotenv->load();
215221
$config = new Encryption('base64');

tests/system/Config/DotEnvTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ public static function provideLoadsVars(): iterable
9090
#[RunInSeparateProcess]
9191
public function testLoadsHex2Bin(): void
9292
{
93+
putenv('encryption.key');
94+
unset($_ENV['encryption.key'], $_SERVER['encryption.key']); // @phpstan-ignore codeigniter.superglobalAccess
95+
9396
$dotenv = new DotEnv($this->fixturesFolder, 'encryption.env');
9497
$dotenv->load();
9598

@@ -102,6 +105,9 @@ public function testLoadsHex2Bin(): void
102105
#[RunInSeparateProcess]
103106
public function testLoadsBase64(): void
104107
{
108+
putenv('encryption.key');
109+
unset($_ENV['encryption.key'], $_SERVER['encryption.key']); // @phpstan-ignore codeigniter.superglobalAccess
110+
105111
$dotenv = new DotEnv($this->fixturesFolder, 'base64encryption.env');
106112
$dotenv->load();
107113

0 commit comments

Comments
 (0)