You are here

function CasGatewayTestCase::testCasGatewayLoggedIn in CAS 7

Same name and namespace in other branches
  1. 6.3 cas.test \CasGatewayTestCase::testCasGatewayLoggedIn()

Test the CAS Gateway functionality of the user is logged in.

File

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

Class

CasGatewayTestCase
Test case for CAS gateway feature.

Code

function testCasGatewayLoggedIn() {

  // Create a user.
  $cas_name = $this
    ->randomName();
  $account = $this
    ->casCreateUser($cas_name);
  $this
    ->setCasUser($cas_name);
  variable_set('cas_check_frequency', CAS_CHECK_ONCE);
  $this
    ->drupalGet('');
  $this
    ->assertLoggedIn($account);

  // Logging out should immediately log a user back in
  $this
    ->drupalGet('user/logout');
  $this
    ->assertLoggedIn($account);
  variable_set('cas_check_frequency', CAS_CHECK_ALWAYS);
  $this
    ->drupalGet('');
  $this
    ->assertLoggedIn($account);

  // Logging out should immediately log a user back in
  $this
    ->drupalGet('user/logout');
  $this
    ->assertLoggedIn($account);
}