public function SimpleLdapUserTestCase::drupalUser1Login in Simple LDAP 7.2
Same name and namespace in other branches
- 7 simple_ldap_user/simple_ldap_user.test \SimpleLdapUserTestCase::drupalUser1Login()
Log in with User 1.
10 calls to SimpleLdapUserTestCase::drupalUser1Login()
- SimpleLdapRoleChangeDrupalUserRoleTestCase::testChangeDrupalUserRole in simple_ldap_role/
simple_ldap_role.test - Changes a user's drupal roles.
- SimpleLdapRoleCreateDrupalRoleTestCase::testCreateRole in simple_ldap_role/
simple_ldap_role.test - Creates a drupal role, and verifies LDAP.
- SimpleLdapRoleDeleteDrupalRoleTestCase::testDeleteRole in simple_ldap_role/
simple_ldap_role.test - Deletes a Drupal role, and checks LDAP.
- SimpleLdapRoleUpdateDrupalRoleTestCase::testUpdateRole in simple_ldap_role/
simple_ldap_role.test - Updates a Drupal role, and verifies LDAP.
- SimpleLdapSSOTestCase::testSimpleLdapSSO in simple_ldap_sso/
simple_ldap_sso.test - Test Simple LDAP SSO.
File
- simple_ldap_user/
simple_ldap_user.test, line 241 - Tests for Simple LDAP User module.
Class
- SimpleLdapUserTestCase
- @file Tests for Simple LDAP User module.
Code
public function drupalUser1Login() {
if ($this->loggedInUser) {
$this
->drupalLogout();
}
// Load password hashing API.
if (!function_exists('user_hash_password')) {
require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc');
}
// Set user1's password to something random in the database.
$pass = hash('sha256', microtime());
db_query("UPDATE {users} SET pass = :hash WHERE uid = 1", array(
':hash' => user_hash_password($pass),
));
// Log in as user1.
$admin_user = user_load(1);
$admin_user->pass_raw = $pass;
$this
->drupalLogin($admin_user);
}