function SecurePagesTestCase::_testOpenRedirect in Secure Pages 6
Same name and namespace in other branches
- 8 securepages.test \SecurePagesTestCase::_testOpenRedirect()
- 6.2 securepages.test \SecurePagesTestCase::_testOpenRedirect()
- 7 securepages.test \SecurePagesTestCase::_testOpenRedirect()
Verifies that securepages is not an open redirect.
1 call to SecurePagesTestCase::_testOpenRedirect()
- 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 216 - Provides SimpleTests for Secure Pages module.
Class
- SecurePagesTestCase
- @file Provides SimpleTests for Secure Pages module.
Code
function _testOpenRedirect() {
// Short-circuit redirects within the simpletest browser.
variable_set('simpletest_maximum_redirects', 0);
variable_set('securepages_switch', TRUE);
global $base_url, $base_path;
$secure_base_url = str_replace('http', 'https', $base_url);
$this
->drupalGet($secure_base_url . $base_path . '?q=http://example.com/', array(
'external' => TRUE,
));
$this
->assertResponse(302);
$this
->assertTrue(strstr($this
->drupalGetHeader('Location'), $base_url), t('Open redirect test passed.'));
$this
->drupalGet($secure_base_url . $base_path . '?q=' . urlencode('http://example.com/'), array(
'external' => TRUE,
));
$this
->assertResponse(404);
// Clean up
variable_del('simpletest_maximum_redirects');
}