You are here

function EncryptPortability::testMethodAndKeyProviderPortability in Encrypt 7.3

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

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

File

./encrypt.test, line 115
Tests for encrypt.module

Class

EncryptPortability
Various tests that ensure our encrypted data is portable (i.e. encryptable/decryptable in different environments).

Code

function testMethodAndKeyProviderPortability() {

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