You are here

public function SimpleLdapSSOTestCase::setUp in Simple LDAP 7.2

Same name and namespace in other branches
  1. 7 simple_ldap_sso/simple_ldap_sso.test \SimpleLdapSSOTestCase::setUp()

Set up the modules and any other.

Overrides SimpleLdapUserTestCase::setUp

File

simple_ldap_sso/simple_ldap_sso.test, line 23
Simple LDAP SSO module tests.

Class

SimpleLdapSSOTestCase
@file Simple LDAP SSO module tests.

Code

public function setUp() {

  // Get the live simple_ldap_sso configuration.
  $binddn = variable_get('simple_ldap_sso_binddn');
  $bindpw = variable_get('simple_ldap_sso_bindpw');
  $encryption_key = variable_get('simple_ldap_sso_encryption_key');
  $attribute_sid = variable_get('simple_ldap_sso_attribute_sid');
  $hashing_algorithm = variable_get('simple_ldap_sso_hashing_algorithm');
  $flood_limit = variable_get('simple_ldap_sso_flood_limit');
  $flood_window = variable_get('simple_ldap_sso_flood_window');

  // Get a list of modules passed as parameters.
  $modules = func_get_args();
  if (isset($modules[0]) && is_array($modules[0])) {
    $modules = $modules[0];
  }
  if (empty($modules)) {
    $modules = array();
  }

  // Create the simpletest sandbox.
  parent::setUp(array(
    'simple_ldap_sso',
  ) + $modules);

  // Configure the sandbox simple_ldap_sso instance.
  variable_set('simple_ldap_sso_binddn', $binddn);
  variable_set('simple_ldap_sso_bindpw', $bindpw);
  variable_set('simple_ldap_sso_encryption_key', $encryption_key);
  variable_set('simple_ldap_sso_attribute_sid', $attribute_sid);
  variable_set('simple_ldap_sso_hashing_algorithm', $hashing_algorithm);
  variable_set('simple_ldap_sso_flood_limit', $flood_limit);
  variable_set('simple_ldap_sso_flood_window', $flood_window);
  $test_user = variable_get('simple_ldap_test_user');
  $attribute_name = variable_get('simple_ldap_user_attribute_name');

  // Initialize a user account object.
  $account = new stdClass();
  $account->name = $test_user[$attribute_name];
  $account->pass_raw = $test_user['pass'];
  $this->testUser = $account;
}