@@ -22,6 +22,10 @@ protected function setUp(): void
2222 {
2323 require $ this ->fixturesFolder . '/RegistrarConfig.php ' ;
2424 }
25+ if (! class_exists ('Encryption ' , false ))
26+ {
27+ require $ this ->fixturesFolder . '/Encryption.php ' ;
28+ }
2529 }
2630
2731 //--------------------------------------------------------------------
@@ -144,6 +148,36 @@ public function testSetsDefaultValues()
144148
145149 //--------------------------------------------------------------------
146150
151+ /**
152+ * @runInSeparateProcess
153+ * @preserveGlobalState disabled
154+ */
155+ public function testSetsDefaultValuesEncryption ()
156+ {
157+ $ dotenv = new DotEnv ($ this ->fixturesFolder , 'encryption.env ' );
158+ $ dotenv ->load ();
159+ $ config = new \Encryption ();
160+
161+ // override config with ENV var
162+ $ this ->assertEquals ('f699c7fd18a8e082d0228932f3acd40e1ef5ef92efcedda32842a211d62f0aa6 ' , bin2hex ($ config ->key ));
163+ $ this ->assertEquals ('OpenSSL ' , $ config ->driver );
164+ }
165+
166+ //--------------------------------------------------------------------
167+
168+ public function testSetsDefaultValuesHex2Bin ()
169+ {
170+ $ dotenv = new DotEnv ($ this ->fixturesFolder , 'commented.env ' );
171+ $ dotenv ->load ();
172+ $ config = new \Encryption ();
173+
174+ // override config with ENV var
175+ $ this ->assertEquals ('84cf2c0811d5daf9e1c897825a3debce91f9a33391e639f72f7a4740b30675a2 ' , bin2hex ($ config ->key ));
176+ $ this ->assertEquals ('MCrypt ' , $ config ->driver );
177+ }
178+
179+ //--------------------------------------------------------------------
180+
147181 public function testRecognizesLooseValues ()
148182 {
149183 $ dotenv = new DotEnv ($ this ->fixturesFolder , 'loose.env ' );
0 commit comments