public function LdapAuthenticationTestCase::AttemptLogon in Lightweight Directory Access Protocol (LDAP) 7
File
- ldap_authentication/
tests/ ldap_authentication.test, line 69
Class
Code
public function AttemptLogon($dn, $goodpwd = TRUE) {
$this
->drupalLogout();
$user = $this->testData['servers'][$this->sid]['users'][$dn]['attr'];
$parts = ldap_explode_dn($dn, 0);
$cn_parts = explode('=', $parts[0]);
$edit = array(
'name' => ldap_pear_unescape_dn_value($cn_parts[1]),
'pass' => $user['password'][0],
);
$user = user_load_by_name($edit['name']);
if ($user) {
user_delete($user->uid);
}
$this
->drupalPost('user', $edit, t('Log in'));
}