function SecurePagesTestCase::_testPathAlias in Secure Pages 6
Same name and namespace in other branches
- 8 securepages.test \SecurePagesTestCase::_testPathAlias()
- 6.2 securepages.test \SecurePagesTestCase::_testPathAlias()
- 7 securepages.test \SecurePagesTestCase::_testPathAlias()
Test redirection on aliased paths.
1 call to SecurePagesTestCase::_testPathAlias()
- 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 185 - Provides SimpleTests for Secure Pages module.
Class
- SecurePagesTestCase
- @file Provides SimpleTests for Secure Pages module.
Code
function _testPathAlias() {
variable_set('securepages_pages', "node/*\nuser*");
// Create test user and login.
$web_user = $this
->drupalCreateUser(array(
'create page content',
'edit own page content',
'administer url aliases',
'create url aliases',
));
$this
->drupalLogin($web_user);
// Create test node.
$node = $this
->drupalCreateNode();
// Create alias.
$edit = array();
$edit['src'] = 'node/' . $node->nid;
$edit['dst'] = $this
->randomName(8);
$this
->drupalPost('admin/build/path/add', $edit, t('Create new alias'));
// Short-circuit redirects within the simpletest browser.
variable_set('simpletest_maximum_redirects', 0);
$this
->drupalGet($edit['dst'], array(
'absolute' => TRUE,
));
$this
->assertResponse(302);
$this
->assertEqual($this
->drupalGetHeader('Location'), $this
->_toHTTPS(url($edit['dst'], array(
'absolute' => TRUE,
))));
// Clean up
variable_del('simpletest_maximum_redirects');
$this
->drupalLogout();
variable_del('securepages_pages');
}