File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ class Encryption
4545 */
4646 public function __construct ($ key , $ adapter = null )
4747 {
48- ($ adapter !== null ) ? $ this ->setAdapter ($ adapter ) : $ this ->setAdapter ('openssl ' );
4948 $ this ->setKey ($ key );
49+ ($ adapter !== null ) ? $ this ->setAdapter ($ adapter ) : $ this ->setAdapter ('openssl ' );
5050 }
5151
5252 /**
Original file line number Diff line number Diff line change 2222
2323class EncryptionTest extends TestCase
2424{
25+ public function testEncryptAndDecryptOnDifferentKeyWithOpenSsl ()
26+ {
27+ $ encryption = new Encryption ('12345678990-=====-=== ' , 'openssl ' );
28+ $ encryptedString = $ encryption ->encrypt ('plain-text ' );
29+
30+ $ encryption2 = new Encryption ('different_key ' , 'openssl ' );
31+ $ decryptedString = $ encryption2 ->decrypt ($ encryptedString );
32+
33+ $ this ->assertFalse ($ decryptedString );
34+ }
35+
2536 public function testEncryptAndDecryptWithOpenSsl ()
2637 {
2738 $ encryption = new Encryption ('12345678990-=====-=== ' , 'openssl ' );
You can’t perform that action at this time.
0 commit comments