File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,19 +25,40 @@ final class EncryptionTest extends CIUnitTestCase
2525{
2626 private Encryption $ encryption ;
2727
28+ public static function setUpBeforeClass (): void
29+ {
30+ parent ::setUpBeforeClass ();
31+
32+ if (is_file (ROOTPATH . '.env ' )) {
33+ rename (ROOTPATH . '.env ' , ROOTPATH . '.env.bak ' );
34+
35+ putenv ('encryption.key ' );
36+ unset($ _ENV ['encryption.key ' ], $ _SERVER ['encryption.key ' ]);
37+ }
38+ }
39+
2840 protected function setUp (): void
2941 {
42+ parent ::setUp ();
43+
3044 $ this ->encryption = new Encryption ();
3145 }
3246
47+ public static function tearDownAfterClass (): void
48+ {
49+ parent ::tearDownAfterClass ();
50+
51+ if (is_file (ROOTPATH . '.env.bak ' )) {
52+ rename (ROOTPATH . '.env.bak ' , ROOTPATH . '.env ' );
53+ }
54+ }
55+
3356 /**
34- * __construct test
35- *
3657 * Covers behavior with config encryption key set or not
3758 */
3859 public function testConstructor (): void
3960 {
40- // Assume no configuration from set_up ()
61+ // Assume no configuration from setUp ()
4162 $ this ->assertEmpty ($ this ->encryption ->key );
4263
4364 // Try with an empty value
You can’t perform that action at this time.
0 commit comments