You are here

function SecureSiteDigestNoneTest::testSecureSiteTypeDigestNone in Secure Site 8

Request home page without credentials.

File

src/Tests/DigestAuth/SecureSiteDigestNoneTest.php, line 50
Contains Drupal\securesite\Tests\DigestAuth\SecureSiteDigestNoneTest

Class

SecureSiteDigestNoneTest
Functional test for digest authentication without credentials.

Namespace

Drupal\securesite\Tests\DigestAuth

Code

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.'));
}