class LdapUserUITests in Lightweight Directory Access Protocol (LDAP) 8.2
Same name and namespace in other branches
- 7.2 ldap_user/tests/ldap_user.test \LdapUserUITests
Hierarchy
- class \LdapTestCase extends \DrupalWebTestCase
- class \LdapUserUITests
Expanded class hierarchy of LdapUserUITests
File
- ldap_user/
tests/ ldap_user.test, line 1207
View source
class LdapUserUITests extends LdapTestCase {
public static function getInfo() {
return array(
'name' => 'LDAP User User Interface',
'description' => 'Test ldap user admin interface.',
'group' => 'LDAP User',
);
}
function __construct($test_id = NULL) {
parent::__construct($test_id);
}
public $module_name = 'ldap_user';
protected $ldap_test_data;
/**
* create one or more server configurations in such as way
* that this setUp can be a prerequisite for ldap_authentication and ldap_authorization
*/
function setUp() {
parent::setUp(array(
'ldap_user',
'ldap_test',
));
variable_set('ldap_simpletest', 2);
}
function tearDown() {
parent::tearDown();
variable_del('ldap_help_watchdog_detail');
variable_del('ldap_simpletest');
}
/**
* make sure user admin interface works. (its a beast)
*/
function testUI() {
// just to give warning if setup doesn't succeed. may want to take these out at some point.
$setup_success = module_exists('ldap_user') && module_exists('ldap_servers') && config('ldap_test.settings')
->get('simpletest') > 0;
$this
->assertTrue($setup_success, ' ldap_user setup successful', $this
->testId('user interface tests'));
$sids = array(
'activedirectory1',
);
$this
->prepTestData('hogwarts', $sids, 'provisionToDrupal', 'default');
$this->privileged_user = $this
->drupalCreateUser(array(
'administer site configuration',
'administer users',
));
$this
->drupalLogin($this->privileged_user);
$ldap_user_conf = ldap_user_conf();
// debug('ldap_user_conf before form submission'); debug($ldap_user_conf);
$this
->drupalGet('admin/config/people/ldap/user');
// Populate the field settings with new settings.
$sid = 'activedirectory1';
$edit_direct_map = array(
'manualAccountConflict' => LDAP_USER_MANUAL_ACCT_CONFLICT_LDAP_ASSOCIATE,
'drupalAcctProvisionServer' => $sid,
'userConflictResolve' => LDAP_USER_CONFLICT_LOG,
'acctCreation' => LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR_DEFAULT,
'orphanedDrupalAcctBehavior' => 'ldap_user_orphan_email',
'orphanedCheckQty' => '50',
'ldapEntryProvisionServer' => $sid,
);
// 'wsEnabled' => TRUE, 'wsKey' => $wsKey,
// 'wsUserIps' => join("\n", $wsUserIps),
$edit = $edit_direct_map + array(
'drupalAcctProvisionTriggers[' . LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE . ']' => TRUE,
'drupalAcctProvisionTriggers[' . LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE . ']' => TRUE,
'1__sm__ldap_attr__6' => '[sn]',
'1__sm__convert__6' => FALSE,
'1__sm__user_attr__6' => '[field.field_lname]',
'1__sm__1__6' => TRUE,
'1__sm__2__6' => TRUE,
'1__sm__ldap_attr__7' => '[givenname]',
'1__sm__convert__7' => FALSE,
'1__sm__user_attr__7' => '[field.field_fname]',
'1__sm__1__7' => TRUE,
'1__sm__2__7' => TRUE,
'ldapEntryProvisionTriggers[' . LDAP_USER_LDAP_ENTRY_PROV_ON_USER_UPDATE_CREATE . ']' => TRUE,
'ldapEntryProvisionTriggers[' . LDAP_USER_LDAP_ENTRY_PROV_ON_AUTHENTICATE . ']' => TRUE,
'ldapEntryProvisionTriggers[' . LDAP_USER_LDAP_ENTRY_DELETE_ON_USER_DELETE . ']' => TRUE,
'2__sm__user_attr__0' => 'user_tokens',
'2__sm__user_tokens__0' => 'Drupal provisioned account for [property.uid]',
'2__sm__convert__0' => FALSE,
'2__sm__ldap_attr__0' => '[description]',
'2__sm__4__3' => TRUE,
'2__sm__4__3' => TRUE,
'2__sm__user_attr__1' => '[property.uid]',
'2__sm__user_tokens__1' => '',
'2__sm__convert__1' => TRUE,
'2__sm__ldap_attr__1' => '[guid]',
'2__sm__4__1' => TRUE,
'2__sm__4__1' => TRUE,
'2__sm__user_attr__2' => 'user_tokens',
'2__sm__user_tokens__2' => 'cn=[property.name]ou=people,dc=hogwarts,dc=edu',
'2__sm__convert__2' => FALSE,
'2__sm__ldap_attr__2' => '[dn]',
'2__sm__4__2' => TRUE,
'2__sm__4__2' => TRUE,
);
$this
->drupalPost('admin/config/people/ldap/user', $edit, t('Save'));
$ldap_user_conf = ldap_user_conf(NULL, TRUE);
// debug('edit'); debug($edit); debug('user conf object after save'); debug($ldap_user_conf);
foreach ($edit_direct_map as $property => $value) {
$this
->assertTrue($ldap_user_conf->{$property} == $value, $property . ' ' . t('field set correctly'), $this
->testId('user interface tests'));
}
// $this->assertTrue(
// ($ldap_user_conf->wsUserIps[0] == $wsUserIps[0] && $ldap_user_conf->wsUserIps[1] == $wsUserIps[1])
// , t('webserice ips set correctly'), $this->testId('user interface tests'));
$this
->assertTrue(isset($ldap_user_conf->drupalAcctProvisionTriggers[LDAP_USER_DRUPAL_USER_PROV_ON_AUTHENTICATE]) && isset($ldap_user_conf->drupalAcctProvisionTriggers[LDAP_USER_DRUPAL_USER_PROV_ON_USER_UPDATE_CREATE]), t('drupal provision triggers set correctly'), $this
->testId('user interface tests'));
$this
->assertTrue(isset($ldap_user_conf->ldapEntryProvisionTriggers[LDAP_USER_LDAP_ENTRY_PROV_ON_USER_UPDATE_CREATE]) && isset($ldap_user_conf->ldapEntryProvisionTriggers[LDAP_USER_LDAP_ENTRY_PROV_ON_AUTHENTICATE]) && isset($ldap_user_conf->ldapEntryProvisionTriggers[LDAP_USER_LDAP_ENTRY_DELETE_ON_USER_DELETE]), t('ldap provision triggers set correctly'), $this
->testId('user interface tests'));
$field_token = '[field.field_lname]';
$field_lname_set_correctly = $ldap_user_conf->ldapUserSynchMappings[LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER][$field_token]['enabled'] == TRUE && $ldap_user_conf->ldapUserSynchMappings[LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER][$field_token]['ldap_attr'] == '[sn]';
$this
->assertTrue($field_lname_set_correctly, t('Synch mapping for field.field_lname field set correctly'), $this
->testId('user interface tests'));
if (!$field_lname_set_correctly) {
debug('ldap_user_conf->synchMapping[direction][field.field_lname]');
debug($ldap_user_conf->ldapUserSynchMappings[LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER]['field.field_lname']);
}
$field_token = '[field.field_fname]';
$field_fname_set_correctly = $ldap_user_conf->ldapUserSynchMappings[LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER][$field_token]['enabled'] == TRUE && $ldap_user_conf->ldapUserSynchMappings[LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER][$field_token]['direction'] == 1 && $ldap_user_conf->ldapUserSynchMappings[LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER][$field_token]['ldap_attr'] == '[givenname]';
$this
->assertTrue($field_fname_set_correctly, t('Synch mapping for field.field_lname field set correctly'), $this
->testId('user interface tests'));
if (!$field_fname_set_correctly) {
debug('ldap_user_conf->synchMapping[direction][field.field_lname]');
debug($ldap_user_conf->ldapUserSynchMappings[LDAP_USER_PROV_DIRECTION_TO_DRUPAL_USER]['field.field_lname']);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LdapTestCase:: |
public | property | ||
LdapTestCase:: |
public | property | ||
LdapTestCase:: |
public | property | ||
LdapTestCase:: |
public | property | ||
LdapTestCase:: |
public | property | ||
LdapTestCase:: |
public | property | ||
LdapTestCase:: |
public | property | ||
LdapTestCase:: |
public | property | ||
LdapTestCase:: |
public | property | ||
LdapTestCase:: |
public | property | ||
LdapTestCase:: |
public | function | ||
LdapTestCase:: |
public | function | ||
LdapTestCase:: |
public | function | 1 | |
LdapTestCase:: |
function | keep user entity fields function for ldap_user in base class instead of user test class in case module integration testing is needed | ||
LdapTestCase:: |
function | |||
LdapTestCase:: |
function | setup configuration and fake test data for all ldap modules | ||
LdapTestCase:: |
public | function | ||
LdapTestCase:: |
public | function | attempt to derive a testid from backtrace | |
LdapUserUITests:: |
protected | property | ||
LdapUserUITests:: |
public | property |
Overrides LdapTestCase:: |
|
LdapUserUITests:: |
public static | function | ||
LdapUserUITests:: |
function |
create one or more server configurations in such as way
that this setUp can be a prerequisite for ldap_authentication and ldap_authorization Overrides LdapTestCase:: |
||
LdapUserUITests:: |
function |
Overrides LdapTestCase:: |
||
LdapUserUITests:: |
function | make sure user admin interface works. (its a beast) | ||
LdapUserUITests:: |
function |
Overrides LdapTestCase:: |