You are here

public function EncryptEncryptionMethodPluginsTest::testPluginDependencies in Encrypt 7.2

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

Test that plugins cannot be enabled if dependencies are not met.

File

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

Class

EncryptEncryptionMethodPluginsTest
Test encryption method hooks.

Code

public function testPluginDependencies() {

  // First, set the variable to trigger our unmet dependency.
  variable_set('encrypt_test_trigger_unmet_deps', TRUE);

  // Then make sure dependency errors appear on the page, and the method
  // cannot be enabled.
  $this
    ->drupalGet('admin/config/system/encrypt/add');
  $this
    ->assertText('This is an unmet dependency.');
  $this
    ->assertFieldByXPath('//input[@name="encrypt_encryption_method" and @value="test" and @disabled]');

  // Now disable the unmet dependency and make sure all is OK. Note that this
  // should also implicitly test the plugin cache-clearing mechanism.
  variable_set('encrypt_test_trigger_unmet_deps', FALSE);
  $this
    ->drupalGet('admin/config/system/encrypt');
  $this
    ->assertNoText('This is an unmet dependency.');
  $this
    ->assertNoFieldByXPath('//input[@name="encrypt_encryption_method" and @value="test" and @disabled]');
}