File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,9 +35,13 @@ public static function setUpBeforeClass(): void
3535
3636 CodeIgniterServices::injectMock ('superglobals ' , new Superglobals ());
3737
38- putenv ('encryption.key ' );
39- unset($ _ENV ['encryption.key ' ]);
40- service ('superglobals ' )->unsetServer ('encryption.key ' );
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+ }
4145 }
4246
4347 protected function setUp (): void
@@ -47,6 +51,15 @@ protected function setUp(): void
4751 $ this ->encryption = new Encryption ();
4852 }
4953
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+
5063 /**
5164 * Covers behavior with config encryption key set or not
5265 */
You can’t perform that action at this time.
0 commit comments