Skip to content

Commit 5050dad

Browse files
committed
fix: unset encryption.key variables in RunInSeparateProcess tests
1 parent bd4c41d commit 5050dad

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
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']);
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']);
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 & 7 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']);
95+
9396
$dotenv = new DotEnv($this->fixturesFolder, 'encryption.env');
9497
$dotenv->load();
9598

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

108114
$this->assertSame('base64:L40bKo6b8Nu541LeVeZ1i5RXfGgnkar42CPTfukhGhw=', getenv('encryption.key'));
109115
$this->assertSame('OpenSSL', getenv('encryption.driver'));
110116
}
111117

112-
public function testLoadsNoneStringFiles(): void
113-
{
114-
$this->expectException(TypeError::class);
115-
116-
new DotEnv($this->fixturesFolder, 2);
117-
}
118-
119118
public function testCommentedLoadsVars(): void
120119
{
121120
$dotenv = new DotEnv($this->fixturesFolder, 'commented.env');

0 commit comments

Comments
 (0)