You are here

public function ShieldTest::testShieldCred in Shield 8

Validate the Shield credential provider.

Throws

\Behat\Mink\Exception\ExpectationException

File

tests/src/Functional/ShieldTest.php, line 96

Class

ShieldTest
Tests Shield module.

Namespace

Drupal\Tests\shield\Functional

Code

public function testShieldCred() {

  // Configure shield so it is enabled.
  $this
    ->config('shield.settings')
    ->set('shield_enable', TRUE)
    ->save();

  // Assert we are presented with a http auth prompt.
  $this
    ->drupalGet('user');
  $this
    ->assertSession()
    ->statusCodeEquals(401);
  $this
    ->drupalGet('user', [], [
    'Authorization' => 'Basic ' . base64_encode('user:password'),
  ]);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
}