function RoleAssignWebTestCase::setUp in RoleAssign 7
Implements setUp().
Overrides DrupalWebTestCase::setUp
File
- ./
roleassign.test, line 31 - Tests for the RoleAssign module.
Class
- RoleAssignWebTestCase
- Test case for RoleAssign module.
Code
function setUp() {
parent::setUp('roleassign');
$this->user1 = user_load(1);
// Update uid 1's name and password so we know it.
$password = user_password();
require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc');
$account = array(
'name' => 'user1',
'pass' => user_hash_password(trim($password)),
);
// We cannot use user_save() here or the password would be hashed again.
db_update('users')
->fields($account)
->condition('uid', 1)
->execute();
// Reload and and fix up uid 1.
$this->user1 = user_load(1, TRUE);
$this->user1->pass_raw = $password;
}