You are here

function CasTestHelper::casLogin in CAS 6.3

Same name and namespace in other branches
  1. 7 cas.test \CasTestHelper::casLogin()

Log in a CAS user with the internal browser.

Parameters

$account: A user object with a valid CAS username field, or the CAS username as a string.

$attributes: Additional attributes for the CAS user.

6 calls to CasTestHelper::casLogin()
CasLoginRedirectionTestCase::testNewUserLoginRedirection in ./cas.test
Verify login redirection for a new user.
CasLogoutRedirectionTestCase::testLogoutRedirection in ./cas.test
Test redirection on user logout.
CasSingleSignOutTestCase::testSingleSignOut in ./cas.test
CasSingleSignOutTestCase::testSingleSignOutDoubleEncode in ./cas.test
CasUserTestCase::testCaseInsensitiveLogin in ./cas.test

... See full list

File

./cas.test, line 140
Tests for cas.module.

Class

CasTestHelper
@file Tests for cas.module.

Code

function casLogin($account, $attributes = array()) {
  if ($this->loggedInUser) {
    $this
      ->drupalLogout();
  }

  // Log in the user.
  $cas_name = $this
    ->setCasUser($account, $attributes);
  $this
    ->drupalGet('cas');
  $pass = $this
    ->assertLink(t('Log out'), 0, t('CAS user %cas_name successfully logged in.', array(
    '%cas_name' => $cas_name,
  )), t('User login'));
  if ($pass) {
    $this->loggedInUser = cas_user_load_by_name($cas_name, TRUE);
  }
}