Skip to content

Commit 878af3c

Browse files
committed
Add a test to tests encryption from mcrypt to sodium
1 parent 0a9aaec commit 878af3c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/PHPUnit/Doctrine/ValueEncrypterTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ public function testEncryptWithMCryptEncryptedString(string $value): void
4343
{
4444
$mcrypt = $this->registry->getEncryptionManager(Rijndael256MCryptEncryptionAdapter::getCode());
4545

46-
$mcrypt->encryptString($value);
46+
$encryptedString = $mcrypt->encryptString($value);
47+
$encryptedStringWithSodium = $this->registry->getEncryptionManager(XChaChaPolySodiumEncryptionAdapter::getCode());
48+
$decryptedValue = $this->encrypter->decrypt($encryptedString);
49+
50+
$this->assertEquals($value, $decryptedValue);
51+
$this->assertNotEquals($encryptedStringWithSodium, $decryptedValue);
4752
}
4853

4954
protected function setUp(string $defaultAdapterCode = null): void

0 commit comments

Comments
 (0)