You are here

public function SecureSiteTypeDigestNoneFunctionalTest::testSecureSiteTypeDigestNone in Secure Site 7.2

Same name and namespace in other branches
  1. 6.2 securesite.test \SecureSiteTypeDigestNoneFunctionalTest::testSecureSiteTypeDigestNone()

Request home page without credentials.

File

./securesite.test, line 1672
Tests for Secure Site module.

Class

SecureSiteTypeDigestNoneFunctionalTest
Functional test for digest authentication without credentials.

Code

public function testSecureSiteTypeDigestNone() {
  $this
    ->drupalHead(NULL);
  $this
    ->assertResponse(401, t('Requesting home page without credentials.'));
  $challenge = array();
  list($scheme, $value) = explode(' ', $this
    ->drupalGetHeader('WWW-Authenticate'), 2);
  if ($scheme == 'Digest') {
    module_load_include('inc', 'securesite');
    $challenge = _securesite_parse_directives($value);
  }
  $this
    ->assertTrue(isset($challenge['realm']) && isset($challenge['nonce']), t('Checking for digest authentication scheme.'));
}