You are here

function LdapAuthenticationTestCase::prepTestData in Lightweight Directory Access Protocol (LDAP) 7

prepTestData create an ldap_authorization configuration and stores fake ldap server configuration.

Parameters

string $testid the name of the test. used to determine which configuration file to include:

Return value

object consumer configuration object (class = LdapAuthorizationConsumerConfAdmin)

3 calls to LdapAuthenticationTestCase::prepTestData()
LdapAuthenticationTestCase::testAuthenticationWhitelistTests in ldap_authentication/tests/ldap_authentication.test
LdapAuthenticationTestCase::testExclusiveModeUserLogon in ldap_authentication/tests/ldap_authentication.test
LDAP Authentication Exclusive Mode User Logon Test (ids = LDAP_authen.EM.ULT.*)
LdapAuthenticationTestCase::testMixedModeUserLogon in ldap_authentication/tests/ldap_authentication.test
LDAP Authentication Mixed Mode User Logon Test (ids = LDAP_authen.MM.ULT.*)

File

ldap_authentication/tests/ldap_authentication.test, line 46

Class

LdapAuthenticationTestCase

Code

function prepTestData($sid, $testid) {
  $this->testFunctions = new LdapTestFunctions();
  include drupal_get_path('module', 'ldap_authentication') . '/tests/LdapServerTestData.' . $sid . '.inc';
  $this->testFunctions
    ->prepTestServers($test_data['servers']);
  $this->testData = $test_data;
  $authentication_conf = is_array($testid) ? $testid : $test_data['ldap_authentication'][$testid];
  $this->testFunctions
    ->configureAuthentication($authentication_conf);

  // set up authorization conf.  needed for some tests.
  $consumer_conf = $test_data['ldap_authorization_conf']['consumer_conf'];
  $consumer_obj = ldap_authorization_get_consumer_object($consumer_conf['consumerType']);
  $consumer_conf_admin = new LdapAuthorizationConsumerConfAdmin($consumer_obj, TRUE);
  foreach ($consumer_conf as $property_name => $property_value) {
    $consumer_conf_admin->{$property_name} = $property_value;
  }
  $consumer_conf_admin
    ->save();
}