You are here

protected function AesTests::testAesEncryption in AES encryption 8.2

Encrypt a string and decrypt it back.

File

src/Tests/AesTests.php, line 46

Class

AesTests
Test encryption/decryption

Namespace

Drupal\aes\Tests

Code

protected function testAesEncryption() {
  $encrypted = AES::encrypt($this->string);
  $decrypted = AES::decrypt($encrypted);
  $this
    ->assertNotEqual($encrypted, $this->string, 'String has been encrypted');
  $this
    ->assertEqual($decrypted, $this->string, 'String has been successfully decrypted');
}