You are here

function SecurePagesTestCase::_testCachedResponse in Secure Pages 7

Same name and namespace in other branches
  1. 8 securepages.test \SecurePagesTestCase::_testCachedResponse()
  2. 6.2 securepages.test \SecurePagesTestCase::_testCachedResponse()
  3. 6 securepages.test \SecurePagesTestCase::_testCachedResponse()
1 call to SecurePagesTestCase::_testCachedResponse()
SecurePagesTestCase::testSecurePages in ./securepages.test
Runs all the test functions. These are run from a single outer function to avoid multiple re-installs by simpletest.

File

./securepages.test, line 211
Provides SimpleTests for Secure Pages module.

Class

SecurePagesTestCase
@file Provides SimpleTests for Secure Pages module.

Code

function _testCachedResponse() {

  // Enable the page cache and fetch the login page.
  variable_set('cache', TRUE);
  $url = url('user', array(
    'absolute' => TRUE,
    'https' => FALSE,
  ));
  $this
    ->drupalGet($url);

  // Short-circuit redirects within the simpletest browser.
  variable_set('simpletest_maximum_redirects', 0);
  $this
    ->drupalGet($url);
  $this
    ->assertResponse(302);
  $this
    ->assertEqual($this
    ->drupalGetHeader('Location'), url('user', array(
    'https' => TRUE,
    'absolute' => TRUE,
  )));
  $this
    ->assertEqual($this
    ->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');

  // Clean up
  variable_del('cache');
  variable_del('simpletest_maximum_redirects');
}