Skip to content

Commit 9fdc43e

Browse files
committed
fix: remove class-level .env rename in EncryptionTest to prevent test pollution
1 parent 9ac583d commit 9fdc43e

1 file changed

Lines changed: 3 additions & 16 deletions

File tree

tests/system/Encryption/EncryptionTest.php

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,9 @@ public static function setUpBeforeClass(): void
3535

3636
CodeIgniterServices::injectMock('superglobals', new Superglobals());
3737

38-
if (is_file(ROOTPATH . '.env')) {
39-
rename(ROOTPATH . '.env', ROOTPATH . '.env.bak');
40-
41-
putenv('encryption.key');
42-
unset($_ENV['encryption.key']);
43-
service('superglobals')->unsetServer('encryption.key');
44-
}
38+
putenv('encryption.key');
39+
unset($_ENV['encryption.key']);
40+
service('superglobals')->unsetServer('encryption.key');
4541
}
4642

4743
protected function setUp(): void
@@ -51,15 +47,6 @@ protected function setUp(): void
5147
$this->encryption = new Encryption();
5248
}
5349

54-
public static function tearDownAfterClass(): void
55-
{
56-
parent::tearDownAfterClass();
57-
58-
if (is_file(ROOTPATH . '.env.bak')) {
59-
rename(ROOTPATH . '.env.bak', ROOTPATH . '.env');
60-
}
61-
}
62-
6350
/**
6451
* Covers behavior with config encryption key set or not
6552
*/

0 commit comments

Comments
 (0)