You are here

function SecureSiteBasicUserTest::testSecureSiteTypeBasicUserAccess in Secure Site 8

Request home page with correct password and access enabled.

File

src/Tests/BasicAuth/SecureSiteBasicUserTest.php, line 74
Contains Drupal\securesite\Tests\BasicAuth\SecureSiteBasicUserTest

Class

SecureSiteBasicUserTest
Functional tests for basic authentication with user credentials.

Namespace

Drupal\securesite\Tests\BasicAuth

Code

function testSecureSiteTypeBasicUserAccess() {
  $this->curl_options[CURLOPT_USERPWD] = $this->access_user->name . ':' . $this->access_user->pass_raw;
  $this
    ->drupalGet(NULL);
  $this
    ->assertResponse(200, t('Requesting home page with correct password and access enabled.'));
  $this
    ->assertText($this->access_user->name, t('Checking for user name when password is correct and access is enabled.'));
  $this
    ->assertText('My account', t('Checking for account link when password is correct and access is enabled.'));
  $this
    ->assertText('Log out', t('Checking for log-out link when password is correct and access is enabled.'));
  $this
    ->drupalHead('user/logout');
  $this
    ->assertResponse(401, t('Requesting log-out page.'));
}