You are here

function SecureSiteDigestUserUnstoredTest::setUp in Secure Site 8

Implements setUp().

Overrides WebTestBase::setUp

File

src/Tests/DigestAuth/SecureSiteDigestUserUnstoredTest.php, line 38
Contains Drupal\securesite\Tests\DigestAuth\SecureSiteDigestUserUnstoredTest

Class

SecureSiteDigestUserUnstoredTest
Functional tests for digest authentication with user credentials.

Namespace

Drupal\securesite\Tests\DigestAuth

Code

function setUp() {
  parent::setUp();

  //todo wtf is this function?
  _securesite_copy_script_config($this);
  $this->user = $this
    ->drupalCreateUser(array(
    'access secured pages',
  ));
  $config = \Drupal::config('securesite.settings');
  $config
    ->set('securesite_enabled', SECURESITE_ALWAYS);

  // Should work with all authentication methods enabled.
  $config
    ->set('securesite_type', array(
    SECURESITE_FORM,
    SECURESITE_BASIC,
    SECURESITE_DIGEST,
  ));
  $config
    ->save();

  //todo curl options
  $this->curl_options[CURLOPT_HTTPAUTH] = CURLAUTH_DIGEST;
  $this->curl_options[CURLOPT_USERPWD] = $this->user->name . ':' . $this->user->pass_raw;
}