You are here

function SecurePagesTestCase::_testCachedResponse in Secure Pages 6

Same name and namespace in other branches
  1. 8 securepages.test \SecurePagesTestCase::_testCachedResponse()
  2. 6.2 securepages.test \SecurePagesTestCase::_testCachedResponse()
  3. 7 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 164
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/login', array(
    'absolute' => TRUE,
  ));
  $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'), $this
    ->_toHTTPS(url('user/login', array(
    'absolute' => TRUE,
  ))));

  // $this->assertEqual($this->drupalGetHeader('X-Securepages-Cache'), 'HIT', 'Page was cached.'); @FIXME
  // Clean up
  variable_del('cache');
  variable_del('simpletest_maximum_redirects');
}