You are here

protected function AgreementMultipleRoleTestCase::requiredUserLogin in Agreement 7.2

Creates user with role and login.

Parameters

int $role_id: The role ID to apply.

string $role_name: the role name.

Return value

object The required user account.

2 calls to AgreementMultipleRoleTestCase::requiredUserLogin()
AgreementMultipleRoleTestCase::testAgreementForFirstRole in ./agreement.test
Asserts that the user with the first role gets the agreement page.
AgreementMultipleRoleTestCase::testAgreementForSecondRole in ./agreement.test
Asserts that the user with the second role gets the agreement page.

File

./agreement.test, line 744
Tests for Agreement module.

Class

AgreementMultipleRoleTestCase
Tests multiple roles applying to an agreement.

Code

protected function requiredUserLogin($role_id, $role_name) {
  $account = $this
    ->drupalCreateUser();
  $account->roles[$role_id] = $role_name;
  try {
    user_save($account);
  } catch (Exception $e) {
    $this
      ->fail('Exception thrown: ' . $e
      ->getMessage());
  }
  $this
    ->drupalLogin($account);
  return $account;
}