You are here

public function EncryptPortability::testMethodAndKeyProviderPortability in Encrypt 7.2

Same name and namespace in other branches
  1. 7.3 encrypt.test \EncryptPortability::testMethodAndKeyProviderPortability()

Ensure that a method and key provider are stored with an encrypted value.

File

./encrypt.test, line 110
Tests for the project Encrypt.

Class

EncryptPortability
Various tests that ensure our encrypted data is portable.

Code

public function testMethodAndKeyProviderPortability() {

  // Generate some text to encrypt and encrypt it.
  $text = $this
    ->randomName(10);
  $encrypted = encrypt($text, array(), 'mcrypt_aes_cbc', 'drupal_variable');
  $encrypted_array = unserialize($encrypted);
  $this
    ->assertEqual($encrypted_array['method'], 'mcrypt_aes_cbc', t('Encryption method is stored with an encrypted value.'));
  $this
    ->assertEqual($encrypted_array['key_provider'], 'drupal_variable', t('Key provider is stored with an encrypted value.'));
}