You are here

function CasGatewayTestCase::testCasGatewayLoggedOut in CAS 7

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

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

File

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

Class

CasGatewayTestCase
Test case for CAS gateway feature.

Code

function testCasGatewayLoggedOut() {
  $node1 = $this
    ->drupalCreateNode();
  variable_set('cas_check_frequency', CAS_CHECK_ONCE);
  $this
    ->drupalGet('');
  $this
    ->assertTrue($this->redirect_count == 2, 'Polled CAS server on first request.');
  $this
    ->drupalGet('');
  $this
    ->assertEqual($this->redirect_count, 0, 'Did not poll CAS server on second request.');
  $this
    ->drupalGet('node/' . $node1->nid);
  $this
    ->assertEqual($this->redirect_count, 0, 'Did not poll CAS server on third request.');
  $this
    ->assertFalse($this->loggedInUser);
  variable_set('cas_check_frequency', CAS_CHECK_ALWAYS);
  $this
    ->drupalGet('');
  $this
    ->assertTrue($this->redirect_count == 2, 'Polled CAS server on first request');
  $this
    ->drupalGet('');
  $this
    ->assertTrue($this->redirect_count == 2, 'Polled CAS server on second request');
  $this
    ->drupalGet('node/' . $node1->nid);
  $this
    ->assertEqual($this->redirect_count == 2, 'Polled CAS server on third request');
  $this
    ->assertFalse($this->loggedInUser);
}