You are here

function EncryptKeyHandling::testDefaultKey in Encrypt 7

Ensure that, if no key path is set, drupal_private_key is used.

File

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

Class

EncryptKeyHandling
Test key handling.

Code

function testDefaultKey() {

  // Encrypt a value.
  $text = $this
    ->randomName(10);
  $encrypted = encrypt($text);
  $enc_array = unserialize($encrypted);
  $this
    ->assertNotEqual($enc_array['text'], $text, t('The text was encrypted.'));
  $this
    ->assertEqual($enc_array['key_name'], 'drupal_private_key', t('Drupal private key is used when no file-based key is specified.'));
}