You are here

function CasRequiredLoginTestCase::testCasExclude in CAS 7

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

Test redirection prevented by cas_exclude.

File

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

Class

CasRequiredLoginTestCase
Test case for CAS force login feature.

Code

function testCasExclude() {
  $node = $this
    ->drupalCreateNode();
  $account = $this
    ->casCreateUser();
  $this
    ->setCasUser($account);
  variable_set('cas_check_frequency', CAS_CHECK_ONCE);
  variable_set('cas_exclude', "node/{$node->nid}");

  // Visit an excluded page and ensure we did not try to log in.
  $this
    ->drupalGet("node/{$node->nid}");
  $this
    ->assertField('name', t('Username field found.'), t('Logout'));
  $this
    ->assertField('pass', t('Password field found.'), t('Logout'));

  // Visit another page and ensure we logged in.
  $this
    ->drupalGet('node');
  $this
    ->assertLoggedIn($account);
  $this
    ->assertUrl('node');
}