You are here

protected function EckTestHelper::loginUser1 in Entity Construction Kit (ECK) 7.2

Log in as user 1.

2 calls to EckTestHelper::loginUser1()
EckCrudTest::setUp in tests/EckCrudTest.test
Sets up a Drupal site for running functional and integration tests.
EckEntityTranslationTest::setUp in tests/EckEntityTranslationTest.test
Sets up a Drupal site for running functional and integration tests.

File

tests/EckTestHelper.test, line 16
The EckTestHelper class.

Class

EckTestHelper
Helper logic for the other ECK tests.

Code

protected function loginUser1() {

  // Load user 1 and set a new password for it.
  $account = user_load(1);
  $password = user_password();
  $account->pass_raw = $password;

  // Update the stored password.
  require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc');
  $account->pass = user_hash_password(trim($account->pass_raw));
  drupal_write_record('users', $account, 'uid');
  entity_get_controller('user')
    ->resetCache(array(
    $account->uid,
  ));
  $this
    ->drupalLogin($account);
}