function SecurePagesTestCase::_testXHR in Secure Pages 6.2
Same name and namespace in other branches
- 8 securepages.test \SecurePagesTestCase::_testXHR()
- 6 securepages.test \SecurePagesTestCase::_testXHR()
- 7 securepages.test \SecurePagesTestCase::_testXHR()
Test detection of XHR requests.
1 call to SecurePagesTestCase::_testXHR()
- 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 281 - Provides SimpleTests for Secure Pages module.
Class
- SecurePagesTestCase
- @file Provides SimpleTests for Secure Pages module.
Code
function _testXHR() {
$admin_user = $this
->drupalCreateUser(array(
'access user profiles',
'administer users',
'access administration pages',
));
$this
->drupalLogin($admin_user);
// Without XHR header
$this
->drupalGet($this
->_toHTTP(url('user/autocomplete/a', array(
'absolute' => TRUE,
))));
$this
->assertResponse(200);
$this
->assertUrl($this
->_toHTTPS(url('user/autocomplete/a', array(
'absolute' => TRUE,
))));
// With XHR header
$this
->drupalGet($this
->_toHTTP(url('user/autocomplete/a', array(
'absolute' => TRUE,
))), array(), array(
'X-Requested-With: XMLHttpRequest',
));
$this
->assertResponse(200);
$this
->assertUrl($this
->_toHTTP(url('user/autocomplete/a', array(
'absolute' => TRUE,
))));
// Clean up
$this
->drupalLogout();
}