You are here

function SecureSiteTest::testUserAgentIE in Secure Site 5

Same name and namespace in other branches
  1. 6 tests/securesite.test \SecureSiteTest::testUserAgentIE()

Check that the realm is correct when using the HTTP Auth method with Internet Explorer's User Agent string

File

tests/securesite.test, line 533
Secure Site module unit tests

Class

SecureSiteTest
Unit tests for the Secure Site module

Code

function testUserAgentIE() {
  $realm = variable_get('securesite_realm', variable_get('site_name', 'Drupal'));

  // Send the Internet Explorer 8.0 Beta User-Agent header
  $this
    ->drupalVariableSet('securesite_enabled', SECURESITE_AUTH);
  $this
    ->drupalVariableSet('securesite_filter_pages_type', SECURESITE_WHITELIST);
  $this
    ->drupalVariableSet('securesite_filter_pages', '');
  $this
    ->addHeader('User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; Media Center PC 5.0; .NET CLR 1.1.4322)');
  $this
    ->drupalGet(url(NULL, NULL, NULL, TRUE));
  $this
    ->assertResponse('401', t('User Agent: IE') . ': %s');
  $this
    ->assertAuthentication('Basic');
  $this
    ->assertRealm(new PatternExpectation("/{$realm} - \\d\\d\\d*/"));
}