You are here

public function LdapServersTestCase::testInstall in Lightweight Directory Access Protocol (LDAP) 7

Same name and namespace in other branches
  1. 8.2 ldap_servers/tests/ldap_servers.test \LdapServersTestCase::testInstall()
  2. 7.2 ldap_servers/tests/ldap_servers.test \LdapServersTestCase::testInstall()

File

ldap_servers/tests/ldap_servers.test, line 51
simpletest for ldap aservers

Class

LdapServersTestCase

Code

public function testInstall() {
  $group = 'ldap_servers: install and uninstall';
  $install_tables = array(
    'ldap_servers',
  );

  // disable, uninstall, and enable/install module
  $modules = array(
    $this->module_name,
  );
  module_disable($modules, TRUE);

  // disable dependent modules
  drupal_uninstall_modules($modules);
  module_enable($modules, TRUE);
  foreach ($install_tables as $table) {
    $this
      ->assertTrue(db_table_exists($table), $table . ' table creates', $group);
  }
  $var_created = $this
    ->assertTrue(TRUE, 'ldap_servers_encryption variable initialized', $group);
  $var_created = $this
    ->assertTrue(variable_get('ldap_servers_encrypt_key', FALSE), 'ldap_servers_encrypt_key variable initialized', $group);
  module_disable($modules, TRUE);

  // disable dependent modules
  drupal_uninstall_modules($modules);
  foreach ($install_tables as $table) {
    $this
      ->assertFalse(db_table_exists($table), $table . ' table removed', $group);
  }
  $var_created = $this
    ->assertFalse(variable_get('ldap_servers_encryption', FALSE), 'ldap_servers_encryption variable removed', $group);
  $var_created = $this
    ->assertFalse(variable_get('ldap_servers_encrypt_key', FALSE), 'ldap_servers_encrypt_key variable removed', $group);
  module_enable($modules, TRUE);
}